In this lesson, we will learn about two concepts,
how to bridge network devices and how to bond network devices.
Now, what does it mean to bridge or bond?
It means that we can take two or more network
devices and glue them together under the operating system.
And this creates a virtual network device.
In one case, it's called a bridge
and the other case, it's called a bond.
So if bridging and bonding glue together multiple
network devices into a single virtual one,
how are these methods?
Different?
The clues are in the words themselves, bridge and bond.
Now when we bridge two network devices,
we're actually doing exactly what the word implies that is
we build a bridge between network one and network two.
Such a bridge allows computers on two separate networks to talk to
each other as if they are part of the same network.
Now, here we have an imaginary server at the top.
And this server has two network cards where we insert our networking cables,
any network device is called a network interface in Linux.
So network interface one and network interface two are simply our network cards.
And we can add these two network interfaces to a bridge.
And now all of the servers below can talk
to each other even though they're on separate networks.
For example, server, one would be able to contact server eight through our bridge,
just like bridges in real life, connect two pieces of land separated by water.
A bridge in Linux connects two networks.
In fact, even more than two networks can be bridged if needed.
In Linux networking terms,
the bridge is also called the controller and the network
devices that are part of the bridge are called ports.
Now, let's discuss our next topic. Bonding.
We can take two or more network devices and bond them together
depending on the bond type. This can help in different ways.
Here are three examples. One, it can make the connection to a network more resilient
and able to keep working. Even if a network card goes down or gets disconnected
two, it can increase network throughput.
For example, if one network card supports a 1000 meg connection,
two cards can be combined to reach much higher speeds,
it wouldn't get to exactly 2000 megs,
but it'll be much higher than a single card sports.
And three, it can make a connection more reliable.
For example, a single network device might experience a few slowdowns.
But if we bond three network devices,
we might be able to eliminate those slowdowns and increase stability.
Let's see how bonding works.
First imagine this setup,
we have a server with two network cards called interfaces.
And Linux,
there's a wire connecting the first network card to some network in the office
and we have a wire connecting the second network
card to the same network in the office.
The problem with this setup is we'd normally define
two separate connections to this network under Linux,
even though both connections go to the same place.
And this wouldn't provide any of the benefits mentioned earlier.
No speed increase and no resistance to failures.
A program could either use the first connection
or the second connection to communicate with the network on the bottom.
And it would have to pick just one network path that it wants to use.
Let's say it picks the first network card
and goes through the connection on the left.
If the wire on the left is cut,
then the program suddenly gets disconnected and it fails the data transfer.
Now, let's see how bonding can prevent this.
If we bond these network interfaces.
From a hardware perspective, we still have the same setup.
Two network cards are connected to some network with the use of two separate cables.
But from a software perspective, things now look like this
to any program that wants to reach the network below.
It looks like there's a single network interface, the bond we just created.
And as far as the program is concerned,
there's also a single wire connecting it to the network, it wants to reach.
And now the negative scenario described earlier is eliminated.
Let's say if some application is exchanging data with the network below,
suddenly the wire from network interface one is cut. Well, now there's no issue.
Linux can simply switch over to using network interface two
which still has a functional wire.
As far as the application is concerned,
the connection from the bond it's using to the network below is still working.
In other words,
the operating system pretends there's a single wire
between our server and the network below.
And that simplifies things for us.
We don't have to configure applications to
use various network cards and various connections.
And IP addresses all to reach the same destination through different paths.
We just tell our applications use the bond interface.
Let's talk about bonding modes.
Linux can handle network traffic through these bonds in
many ways to decide how it should handle it.
We should choose what's called a bonding mode.
Currently, most Linux operating systems support seven bonding modes.
Their codes range from mode zero to mode six.
If no mode is specified, some operating systems will pick mode zero by default.
Also called round robin.
Not all modes, increase network throughput.
Above what a single card can achieve one mode that can increase network throughput.
Above what a single card can achieve is mode four also called I triple E 802.3 ad
here is the list of modes and what each number corresponds to
each has its own set of advantages, disadvantages and limitations
making the choice is a complex task that requires
thorough knowledge of the entire network in your organization.
Diving into the details here would take hours to explain.
But here's a short summary about the modes,
mode zero. Round robin uses network interfaces in sequential order
for a certain amount of data network interface. 1 may be used
then for another amount of data network interface two
and so on.
Mode one or active backup uses a single interface
and it keeps all others inactive as backups.
If the active interface goes down, then a backup becomes the new active one
mode two X or pick the interface to use based
on the source and destination of the data packet.
This ensures that if device one wants to reach device two through this bond,
it will always go through the same interface.
And if device one wants to reach device three,
it might go through a different interface but
it will be the same one for every transfer
mode three. Broadcast means all data is sent through all interfaces at once.
Mode four I triple E 802.3 ad can help
increase network transfer rates above what a single interface supports
mode five adaptive transmit load balancing
load balances outgoing traffic from the bond.
That is it will try to send data from the interface. That's the least busy
mode six
adaptive load balancing tries to load balance,
both outgoing and incoming traffic.
In the context of a bond,
all network interfaces that are added to it are called ports.
If we oversimplify, we can now differentiate between bridging and bonding.
A bridge glues together two or more networks, helping the devices on them,
talk to each other as if they're on a single network.
A bond glues together two or more connections to a network
that is two or more roads to a network that are presented as a single road.
These are the typical use cases,
at least talented network administrators can find
many more varied and creative uses.