Linux network bonding driver provides a method for joining multiple physical network interfaces into a single logical bonded interface thus aiming to provide us with a higher level of bandwidth and also ensuring network redundancy and load balancing at the NIC level.
Set up Network Bonding
As part of this assignment, I’ve attached two NICs on my VM. We will join two NICs (ens192, and ens122) and we will attempt to make them into one bonded NIC named bond0 and apply a round-robin policy for fault tolerance and load balancing.
Virtual Machine | Network Interface Name | Purpose | Bonded Interface |
virt-scale-05 | ens192 | NIC_A | BOND0 |
ens224 | NIC_B | BOND0 | |
ens225 | DRAC |
Types of Network Load balancing
1 |
bond.options: [balance-rr, active-backup, balance-xor, broadcast, 802.3ad, balance-tlb, balance-alb]. |
Display Current network devices
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[root@virt-scale-05 ~]# nmcli device DEVICE TYPE STATE CONNECTION ens192 ethernet connected ens192 ens224 ethernet connected Wired connection 1 ens256 ethernet connected Wired connection 3 lo loopback connected (externally) lo [root@virt-scale-05 ~]# [root@virt-scale-05 ~]# nmcli connection NAME UUID TYPE DEVICE ens192 abff0fa6-e3fe-349f-aeb7-dfc4c7cf99af ethernet ens192 lo 99652507-3507-4fb0-bdcf-6ae5e32e2a68 loopback lo Wired connection 1 710af5a3-d55c-3557-87df-80478e9576bb ethernet ens224 Wired connection 3 bca103c8-27f1-3d02-8f32-56e17ecfd72f ethernet ens256 Wired connection 2 c211ac69-97a2-3fb9-801e-fa9210026f3c ethernet -- |
Delete existing network connections
1 2 3 4 5 6 7 |
[root@virt-scale-05 ~]# nmcli connection delete ens192 Connection 'ens192' (abff0fa6-e3fe-349f-aeb7-dfc4c7cf99af) successfully deleted. [root@virt-scale-05 ~]# nmcli connection delete ens192 Error: unknown connection 'ens192'. Error: cannot delete unknown connection(s): 'ens192'. [root@virt-scale-05 ~]# nmcli connection delete Wired\ connection\ 1 Connection 'Wired connection 1' (710af5a3-d55c-3557-87df-80478e9576bb) successfully deleted. |
Show Interfaces
1 2 3 4 5 6 7 8 9 |
[root@virt-scale-05 ~]# [root@virt-scale-05 ~]# nmcli device DEVICE TYPE STATE CONNECTION ens256 ethernet connected Wired connection 3 lo loopback connected (externally) lo ens192 ethernet <strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">disconnected</mark></strong> -- ens224 ethernet <strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">disconnected</mark></strong> -- [root@virt-scale-05 ~]# |
Add a new bonding device eg – [bond0]
1 2 3 4 |
[root@virt-scale-05 ~]# nmcli connection add type bond ifname bond0 con-name bond0 bond.options "mode=balance-rr" Connection 'bond0' (6d13e394-1b7e-4867-9963-b65e9df709ec) successfully added. [root@virt-scale-05 ~]# |
Add member devices to the bonding device
[root@virt-scale-05 ~]# nmcli connection add type bond ifname bond0 con-name bond0 bond.options “mode=balance-rr”
Connection ‘bond0’ (6d13e394-1b7e-4867-9963-b65e9df709ec) successfully added.
[root@virt-scale-05 ~]#
Show Interfaces
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
[root@virt-scale-05 ~]# <strong>nmcli connection</strong> NAME UUID TYPE DEVICE Wired connection 3 bca103c8-27f1-3d02-8f32-56e17ecfd72f ethernet ens256 bond0 6d13e394-1b7e-4867-9963-b65e9df709ec bond bond0 lo 99652507-3507-4fb0-bdcf-6ae5e32e2a68 loopback lo bond-slave-ens192 a9d38f24-215c-4ea4-a414-6fdb7288d19f ethernet ens192 bond-slave-ens224 58a3778d-1270-4126-8624-3dd48e0ef267 ethernet ens224 Wired connection 2 c211ac69-97a2-3fb9-801e-fa9210026f3c ethernet -- [root@virt-scale-05 ~]# [root@virt-scale-05 ~]#<strong> nmcli device</strong> DEVICE TYPE STATE CONNECTION ens256 ethernet connected Wired connection 3 bond0 bond connected bond0 lo loopback connected (externally) lo ens192 ethernet connected bond-slave-ens192 ens224 ethernet connected bond-slave-ens224 [root@virt-scale-05 ~]# |
Configure Networking on the bonding device
1 2 3 4 5 6 7 8 |
[root@virt-scale-05 ~]# nmcli connection modify bond0 ipv4.addresses 192.168.11.30/24 nmcli connection modify bond0 ipv4.gateway 192.168.11.253 nmcli connection modify bond0 ipv4.dns "192.168.11.10 192.168.11.11" nmcli connection modify bond0 ipv4.dns-search "ash.local" nmcli connection down bond0 && nmcli connection up bond0 Connection 'bond0' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5) |
Verify connection state
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
root@virt-scale-05 ~]# nmcli device DEVICE TYPE STATE CONNECTION ens256 ethernet connected Wired connection 3 bond0 bond connected bond0 lo loopback connected (externally) lo ens192 ethernet <mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color"><strong>connected</strong></mark> bond-slave-ens192 ens224 ethernet <mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color"><strong>connected</strong></mark> bond-slave-ens224 [root@virt-scale-05 ~]# [root@virt-scale-05 ~]# nmcli connection NAME UUID TYPE DEVICE Wired connection 3 bca103c8-27f1-3d02-8f32-56e17ecfd72f ethernet ens256 bond0 6d13e394-1b7e-4867-9963-b65e9df709ec bond bond0 lo 99652507-3507-4fb0-bdcf-6ae5e32e2a68 loopback lo bond-slave-ens192 a9d38f24-215c-4ea4-a414-6fdb7288d19f ethernet ens192 bond-slave-ens224 58a3778d-1270-4126-8624-3dd48e0ef267 ethernet ens224 Wired connection 2 c211ac69-97a2-3fb9-801e-fa9210026f3c ethernet -- [root@virt-scale-05 ~]# |
Verify Bonding state
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
[root@virt-scale-05 ~]# cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v5.14.0-284.30.1.el9_2.x86_64 Bonding Mode: load balancing (<strong>round-robin</strong>) MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0 Peer Notification Delay (ms): 0 Slave Interface: ens192 MII Status: up Speed: 10000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:50:56:b5:87:40 Slave queue ID: 0 Slave Interface: ens224 MII Status: up Speed: 10000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:50:56:b5:68:eb Slave queue ID: 0 [root@virt-scale-05 ~]# |
Location of Config files
1 2 3 4 5 6 7 |
[root@virt-scale-05 ~]# ll /etc/NetworkManager/system-connections/ total 16 -rw-------. 1 root root 309 Sep 17 11:10 bond0.nmconnection -rw-------. 1 root root 166 Sep 17 10:45 bond-slave-ens192.nmconnection -rw-------. 1 root root 166 Sep 17 10:45 bond-slave-ens224.nmconnection -rw-------. 1 root root 241 Sep 17 10:27 'Wired connection 2.nmconnection' [root@virt-scale-05 ~]# |