Pre-Requesites
We consider creating a Bond0 interface which will do a bonding from the two following physical interface : em2 and em3.
Different Bonding mode can be applied (this depends of the Switch capability).
- Mode 0 (balance-rr): This mode is also known as round-robin mode. Packets are sequentially transmitted and received through each interface one by one. This mode provides load balancing functionality.
- Mode 1 (active-backup): This mode has only one interface set to active, while all other interfaces are in the backup state. If the active interface fails, a backup interface replaces it as the only active interface in the bond. The media access control (MAC) address of the bond interface in mode 1 is visible on only one port (the network adapter), which prevents confusion for the switch. Mode 1 provides fault tolerance.
- Mode 2 (balance-xor): The source MAC address uses exclusive or (XOR) logic with the destination MAC address. This calculation ensures that the same slave interface is selected for each destination MAC address. Mode 2 provides fault tolerance and load balancing.
- Mode 3 (broadcast): All transmissions are sent to all the slaves. This mode provides fault tolerance.
- Mode 4 (802.3ad): This mode creates aggregation groups that share the same speed and duplex settings, and it requires a switch that supports an IEEE 802.3ad dynamic link. Mode 4 uses all interfaces in the active aggregation group. For example, you can aggregate three 1 GB per second (GBPS) ports into a 3 GBPS trunk port. This is equivalent to having one interface with 3 GBPS speed. It provides fault tolerance and load balancing.
- Mode 5 (balance-tlb): This mode ensures that the outgoing traffic distribution is set according to the load on each interface and that the current interface receives all the incoming traffic. If the assigned interface fails to receive traffic, another interface is assigned to the receiving role. It provides fault tolerance and load balancing.
- Mode 6 (balance-alb): This mode is supported only in x86 environments. The receiving packets are load balanced through Address Resolution Protocol (ARP) negotiation. This mode provides fault tolerance and load balancing.
Description
Backup the existing interfaces that you plan to configure as bond slaves by using the following commands:
[root@nodeum network-scripts] # ifdown em2 ; ifdown em3[root@nodeum network-scripts]# cd /etc/sysconfig/network-scripts
[root@nodeum network-scripts]# mkdir BACKUPDIR
[root@nodeum network-scripts]# mv -v ifcfg-em2 ifcfg-em3 ./BACKUPDIR
|
Check the status of the interfaces to be configured as bond slaves by using the following commands:
[root@nodeum network-scripts]# nmcli con
NAME UUID TYPE DEVICE
[root@localhost network-scripts]# nmcli con
NAME UUID TYPE DEVICE
em1 28338337-f543-4122-83c3-dc4bb132c7d2 ethernet em1
em2 4504020b-0a37-47d0-a159-faeafdf3208e ethernet --
em3 c0a6aa70-d52a-4b4f-8a25-a817b822876a ethernet --
em4 cb61666c-13fd-4208-ab38-c0c2507b11d8 ethernet --
[root@nodeum network-scripts]# ethtool em2 |grep "Link detected"
Link detected: yes
[root@nodeum network-scripts]# ethtool em3 |grep "Link detected"
Link detected: yes
|
- Create a bond interface by using the bonding options (explained in the prerequisite) :
[root@nodeum network-scripts]]#nmcli con add type bond con-name bond0 ifname bond0 mode 802.3ad ip4 x.x.x.x/yy
Connection 'bond0' (9775d497-bb24-4db5-b9d9-c155ac5fa510) successfully added.
[root@nodeum network-scripts]#nmcli con mod id bond0 bond.options mode=802.3ad,miimon=100,lacp_rate=fast,xmit_hash_policy=layer2+3
[root@nodeum network-scripts]#nmcli con mod id bond0 802-3-ethernet.mtu 9000
[root@nodeum network-scripts]#nmcli conn del 4504020b-0a37-47d0-a159-faeafdf3208e
Connection 'em2' (4504020b-0a37-47d0-a159-faeafdf3208e) successfully deleted.
[root@localhost network-scripts]# nmcli conn del c0a6aa70-d52a-4b4f-8a25-a817b822876a
Connection 'em3' (c0a6aa70-d52a-4b4f-8a25-a817b822876a) successfully deleted.
[root@nodeum network-scripts]#nmcli con add type bond-slave ifname em2 con-name em2 master bond0
Connection 'em2' (e13bffae-2a18-436f-874e-f91824947442) successfully added.
[root@nodeum network-scripts]#nmcli con add type bond-slave ifname em3 con-name em3 master bond0
Connection 'em3' (6dcb263d-03ca-4203-854c-54a7276d1a2f) successfully added.
|
- Restart the NetworkManager service by using the following command:
[root@nodeum network-scripts]#systemctl restart NetworkManager
|
- Check the status of the bond and slave interfaces to verify that the bond0 interface is running by using the following commands:
[root@nodeum network-scripts]#nmcli con
NAME UUID TYPE DEVICE
em1 28338337-f543-4122-83c3-dc4bb132c7d2 ethernet em1
em2 4504020b-0a37-47d0-a159-faeafdf3208e ethernet em2
em3 c0a6aa70-d52a-4b4f-8a25-a817b822876a ethernet em3
em4 cb61666c-13fd-4208-ab38-c0c2507b11d8 ethernet --
[root@nodeum network-scripts]# nmcli con up uuid 5a21933b-0c60-4aa6-93b2-b0e4dab6747e
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)
[root@nodeum network-scripts]#nmcli con
NAME UUID TYPE DEVICE
bond0 5a21933b-0c60-4aa6-93b2-b0e4dab6747e bond bond0
em1 28338337-f543-4122-83c3-dc4bb132c7d2 ethernet em1
em2 4504020b-0a37-47d0-a159-faeafdf3208e ethernet em2
em3 c0a6aa70-d52a-4b4f-8a25-a817b822876a ethernet em3
em4 cb61666c-13fd-4208-ab38-c0c2507b11d8 ethernet --
|
- After the configuration is complete, check the output of the following commands to verify that the bond0 interface is active and no error is found:
[root@localhost network-scripts]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2 (0)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
802.3ad info
LACP rate: slow
Min links: 0
Aggregator selection policy (ad_select): stable
System priority: 65535
System MAC address: 14:18:77:58:a1:08
Active Aggregator Info:
Aggregator ID: 1
Number of ports: 2
Actor Key: 9
Partner Key: 2
Partner Mac Address: ec:1d:8b:de:09:80
Slave Interface: em2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 14:18:77:58:a1:08
Slave queue ID: 0
Aggregator ID: 1
Actor Churn State: none
Partner Churn State: none
Actor Churned Count: 0
Partner Churned Count: 0
details actor lacp pdu:
system priority: 65535
system mac address: 14:18:77:58:a1:08
port key: 9
port priority: 255
port number: 1
port state: 61
details partner lacp pdu:
system priority: 32768
system mac address: ec:1d:8b:de:09:80
oper key: 2
port priority: 32768
port number: 280
port state: 61
Slave Interface: em3
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 14:18:77:58:a1:09
Slave queue ID: 0
Aggregator ID: 1
Actor Churn State: none
Partner Churn State: none
Actor Churned Count: 0
Partner Churned Count: 0
details actor lacp pdu:
system priority: 65535
system mac address: 14:18:77:58:a1:08
port key: 9
port priority: 255
port number: 2
port state: 61
details partner lacp pdu:
system priority: 32768
system mac address: ec:1d:8b:de:09:80
oper key: 2
port priority: 32768
port number: 282
port state: 61
|
- This completes the process of LACP bonding on RHEL or CentOS 7 by using the NMCLI tool.
Let Us Know What You Thought about this Post.
Put your Comment Below.