Saturday, 15 June 2019

How to Setup NIC bonding Interface Using nmcli on CentOS 7



NIC Bonding enables two or more network interfaces to act as one interface, to provide higher data rates and as well as link failover. Linux kernel features that allows aggregating multiple interfaces. This is a great way of achieving redundancy to a server. If one physical NIC is down or unplugged, it will automatically move resource to other NIC card.
Step 1: Run the following command to check the existing network configuration:

[root@linuxcnf ~]# nmcli con show
NAME  UUID  TYPE  DEVICE
[root@linuxcnf ~]#

Step 2: Run the following command to create a network bond connection:

Here, you need to replace IP address and interface name as per actual setup IP addresses.

[root@linuxcnf ~]# nmcli con add type bond con-name bond0 ifname bond0 mode active-backup ip4 192.168.43.105/24
Connection 'bond0' (628a42b2-1587-4228-a7ad-7f96fe612830) successfully added.
[root@linuxcnf ~]#

Step 3: Verify the connection if added successfully:

[root@linuxcnf ~]# nmcli con show
NAME   UUID                                  TYPE  DEVICE
bond0  628a42b2-1587-4228-a7ad-7f96fe612830  bond  bond0
[root@linuxcnf ~]#

Step 4: Run the following commands to add the Slave Interfaces to the bond:

[root@linuxcnf ~]# nmcli con add type bond-slave ifname ens33 master bond0
Connection 'bond-slave-ens33' (8688a880-95bd-4936-9d07-b27f688092db) successfully added.
[root@linuxcnf ~]# nmcli con add type bond-slave ifname ens34 master bond0
Connection 'bond-slave-ens34' (c0a73e4d-c82c-4e0f-9cc3-390c53b4ccbc) successfully added.
[root@linuxcnf ~]#

Step 5: Verify the slave connections:

[root@linuxcnf ~]# nmcli con show
NAME   UUID                                  TYPE      DEVICE
bond0  b1972ec4-6540-4920-95fc-7be5d623fd91  bond      bond0
ens34  ffaf4925-008d-4bb5-ae5c-962f3a003249  ethernet  ens34
ens33  d3796c6a-5598-4032-8992-96656308bc42  ethernet  ens33
[root@linuxcnf ~]#

Step 6: Finally, bring up all the connections:

[root@linuxcnf ~]# nmcli con up ens34
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)
[root@linuxcnf ~]# nmcli con up ens33
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)
[root@linuxcnf ~]#
[root@linuxcnf ~]# nmcli con up bond0
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/9)
[root@linuxcnf ~]#

Step 7: Check and verify bond status:
  
[root@linuxcnf ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens33
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: ens33
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:f5:13:16
Slave queue ID: 0

Slave Interface: ens34
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: 00:0c:29:f5:13:20
Slave queue ID: 0
[root@linuxcnf ~]#

Bond configuration done!!!

No comments:

Post a Comment