Introduction
In this lab, you will learn how to implement Link Aggregation, also known as port bonding, in a Linux environment. This powerful technique allows you to combine multiple physical network interfaces into a single logical interface, which can increase network throughput and provide fault tolerance. You will gain hands-on experience with essential Linux networking commands to configure and manage a bonded connection.
Following a step-by-step process, you will first identify the available network interfaces on your system using the ip a command. For a safe and practical demonstration, we will create two virtual "dummy" interfaces, dummy1 and dummy2, to simulate a multi-interface environment. You will then create a new virtual bond interface, bond0, and enslave these two dummy interfaces to it. Subsequently, you will assign a static IP address to the newly created bond0 interface to enable communication. Finally, you will verify the entire configuration and check the status of the active bond to ensure it is functioning correctly.
Identify Available Network Interfaces with ip a
In this step, you will begin by identifying the network interfaces available on your LabEx VM. Before you can combine multiple network interfaces into a single bonded link, you first need to know their names. The modern and preferred command for this task on Linux is ip a (a shorthand for ip addr show).
This command displays all network interfaces on the system, along with their IP addresses, MAC addresses, and their operational state.
First, open your terminal. It should already be open and in the ~/project directory. Now, run the ip a command to list all network interfaces:
ip a
You will see an output listing several interfaces. You should pay attention to a few key details:
lo: This is the loopback interface, a virtual interface for the system to communicate with itself. You will ignore this for bonding.eth0: This is the primary Ethernet interface. We will not use it to ensure our connection to the lab environment remains stable.docker0: This is a virtual bridge created by Docker. It's currentlyDOWNand not suitable for this lab.dummy1,dummy2: These are two dummy virtual interfaces we've added to simulate two extra network cards for this lab. These will be the interfaces we bond together.state UP: This indicates that the interface is active.
Your output will look similar to this. Note the names of your dummy interfaces, dummy1 and dummy2, as you will need them in the next steps.
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:16:3e:00:20:a3 brd ff:ff:ff:ff:ff:ff
altname enp0s5
altname ens5
inet 172.16.50.188/24 metric 100 brd 172.16.50.255 scope global dynamic eth0
valid_lft 1892159680sec preferred_lft 1892159680sec
inet6 fe80::216:3eff:fe00:20a3/64 scope link
valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:2c:eb:c9:91 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
4: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
link/ether 2a:47:04:07:1a:ea brd ff:ff:ff:ff:ff:ff
inet6 fe80::5caf:4ff:fe97:69bd/64 scope link
valid_lft forever preferred_lft forever
5: dummy2: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
link/ether 2e:5f:12:08:3a:eb brd ff:ff:ff:ff:ff:ff
inet6 fe80::5caf:4ff:fe97:69be/64 scope link
valid_lft forever preferred_lft forever
From the output above, we have identified two suitable interfaces for our bonding configuration: dummy1 and dummy2. In the following steps, you will use these interface names to create a new bonded interface.
Create and Enable the Bond Interface 'bond0'
In this step, you will create the logical "bond" interface that will serve as the master for your network cards. This requires two main actions: loading the necessary Linux kernel module for bonding and then creating and activating the interface itself.
First, you need to ensure the bonding kernel module is loaded. This module contains the code that enables the kernel to manage bonded interfaces. You can load it using the modprobe command.
sudo modprobe bonding
To confirm that the module has been loaded successfully, you can use the lsmod command, which lists all loaded kernel modules, and grep to filter for "bonding".
lsmod | grep bonding
You should see output indicating the bonding module is now in use:
bonding 196608 0
Now that the kernel is ready, you can create the new logical interface. We will name it bond0. Use the ip link command to add a new virtual link of type bond.
sudo ip link add bond0 type bond
This command creates the interface, but it is in a "down" state by default. You need to bring it "up" to make it active, similar to enabling a physical network card.
sudo ip link set dev bond0 up
You can now verify that your new bond0 interface exists and is active by using the ip a command again, but this time specifying the interface name.
ip a show bond0
The output will show the bond0 interface with its state as DOWN and without an IP address yet. That will be configured in a later step.
6: bond0: <NO-CARRIER,BROADCAST,MULTICAST,MASTER,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
You have now successfully created and enabled the master bond0 interface. The next step is to add your dummy interfaces to it as slaves.
Add Interfaces as Slaves to 'bond0'
In this step, you will enslave the virtual interfaces you identified earlier (dummy1 and dummy2) to the bond0 master interface. "Enslaving" an interface means you are placing it under the control of the bonded interface. Once enslaved, the physical interface no longer needs its own IP address; all traffic will be managed through bond0.
This approach of using dummy interfaces is completely safe and allows you to learn the bonding process without any risk of losing network connectivity.
First, add the dummy1 interface to the bond. You need to take it down before adding it as a slave.
sudo ip link set dev dummy1 down
sudo ip link set dev dummy1 master bond0
Next, do the same for the dummy2 interface.
sudo ip link set dev dummy2 down
sudo ip link set dev dummy2 master bond0
Now let's bring up the bond interface and assign it an IP address. We'll use a different subnet to avoid conflicts with the existing eth0 configuration:
sudo ip addr add 192.168.100.10/24 dev bond0
sudo ip link set dev bond0 up
Let's verify that both dummy1 and dummy2 are now enslaved to bond0:
ip a
Look at the entries for dummy1, dummy2, and bond0 in the output. You will see both dummy1 and dummy2 listed with master bond0 in their descriptions, confirming they are successfully enslaved. Also, notice that the bond0 interface is now UP and has the IP address we assigned.
4: dummy1: <BROADCAST,NOARP,SLAVE,UP,LOWER_UP> mtu 1500 qdisc noqueue master bond0 state UP group default qlen 1000
link/ether 2a:47:04:07:1a:ea brd ff:ff:ff:ff:ff:ff
5: dummy2: <BROADCAST,NOARP,SLAVE,UP,LOWER_UP> mtu 1500 qdisc noqueue master bond0 state UP group default qlen 1000
link/ether 2e:5f:12:08:3a:eb brd ff:ff:ff:ff:ff:ff
6: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 2a:47:04:07:1a:ea brd ff:ff:ff:ff:ff:ff
inet 192.168.100.10/24 scope global bond0
valid_lft forever preferred_lft forever
inet6 fe80::2847:4ff:fe07:1aea/64 scope link
valid_lft forever preferred_lft forever
With the interfaces now acting as slaves, the next step is to configure the network settings for the bond0 interface itself.
Test Bond Interface Connectivity
In this step, you will test the bond interface to ensure it's working correctly. Since we've created a functional bond with two dummy interfaces and assigned it an IP address, we can now test its basic functionality.
First, let's verify that the bond interface is up and has the correct IP address:
ip a show bond0
You should see the bond0 interface with the IP address we assigned (192.168.100.10/24) and the interface state should show as UP:
6: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 2a:47:04:07:1a:ea brd ff:ff:ff:ff:ff:ff
inet 192.168.100.10/24 scope global bond0
valid_lft forever preferred_lft forever
Now let's test the bond interface by pinging its own IP address to verify the interface is responding:
ping -c 3 192.168.100.10
You should see successful ping responses, confirming that the bond interface is functioning.
Let's also verify that our slave interfaces are properly attached to the bond:
ip a | grep "master bond0"
This command will show you the interfaces that are enslaved to bond0. You should see both dummy1 and dummy2 listed:
4: dummy1: <BROADCAST,NOARP,SLAVE,UP,LOWER_UP> mtu 1500 qdisc noqueue master bond0 state UP group default qlen 1000
5: dummy2: <BROADCAST,NOARP,SLAVE,UP,LOWER_UP> mtu 1500 qdisc noqueue master bond0 state UP group default qlen 1000
For additional verification, let's check if the bond interface appears in the routing table:
ip route | grep bond0
You should see routing entries for the 192.168.100.0/24 network through the bond0 interface.
Educational Note: This setup perfectly demonstrates the core concepts of bonding. In a production environment with multiple physical interfaces, you would see actual network traffic load balancing and redundancy based on the bonding mode you choose.
Verify the Bond Status with cat /proc/net/bonding/bond0
In this final step, you will perform the most detailed verification by inspecting the bond's status file directly. The Linux kernel exposes real-time information about each bonded interface through a special file in the /proc filesystem. For an interface named bond0, this file is located at /proc/net/bonding/bond0.
Using the cat command to view this file provides a comprehensive overview of the bond's configuration, including its mode, the status of its slave interfaces, and traffic counters.
In your terminal, run the following command:
cat /proc/net/bonding/bond0
This will display a detailed report. The output will look similar to the following, now showing two slave interfaces:
Ethernet Channel Bonding Driver: vX.X.X (Month Day, Year)
Bonding Mode: load balancing (round-robin)
Primary Slave: None
Currently Active Slave: dummy1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0
Slave Interface: dummy1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 2a:47:04:07:1a:ea
Slave queue ID: 0
Slave Interface: dummy2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 2e:5f:12:08:3a:eb
Slave queue ID: 0
Let's break down the key information in this output:
- Bonding Mode: This shows the policy used to distribute traffic. Since we didn't specify one, it defaults to
load balancing (round-robin), which transmits packets in order across the available slaves. - MII Status: This shows the overall status of the bonded link.
upmeans it's active. - Slave Interface: You can see a section for both
dummy1anddummy2. They both show anMII Statusofup, confirming that they are active and part of the bond. Note thatSpeedandDuplexmay show asUnknownor a default value for dummy interfaces.
Congratulations! You have successfully configured a bonded network interface on Linux, combining two dummy interfaces into a single, logical one.
Summary
In this lab, you learned the fundamental concepts of implementing link aggregation (port bonding) in a Linux environment. The procedure started with identifying the available network interfaces, including two pre-configured virtual interfaces, dummy1 and dummy2, using the ip a command. Following identification, you created a new virtual bond interface named bond0, enabled it, and then added both dummy interfaces as slaves to demonstrate the complete bonding process.
This approach provided a completely safe and effective way to learn bonding concepts in a remote environment without risking connectivity loss.
Key learning points included:
- Creating two dummy interfaces to simulate a multi-interface environment.
- Loading the
bondingkernel module. - Understanding the master-slave relationship in network bonding.
- Enslaving multiple interfaces to a single bond master.
- Safely assigning IP addresses to bond interfaces.
- Verifying the final bond configuration and status.
The lab concluded with examining the bond's detailed status using cat /proc/net/bonding/bond0, which provides comprehensive information about the bond's configuration, mode, and the status of all its slave interfaces. This verification step is essential in real-world scenarios to confirm that the bonding setup is functioning as intended.



