RHEL7: Configure network bonding between two RHEL systems.
Presentation
There are several ways to configure network bonding in RHEL 7:
- using the nmtui command and a Text User Interface,
- using the nmcli command at the Command Line Interface,
- using the graphical interface,
- through direct changes in the network configuration files.
For the rest of this tutorial, it is the nmcli option that has been chosen because it’s the quickest method and arguably the least prone to errors.
Prerequisites
To put into practice this tutorial, you need two VM and access to their respective console. Each VM has been installed with a base distribution (minimal distribution should work but was not tested). Each VM’s got two network interfaces called eth0 and eth1.
If a previous network configuration was set up, remove it on both VM:
# nmcli con show
NAME UUID TYPE DEVICE
Wired connection 1 f32cfcb7-3567-4313-9cf3-bdd87010c7a2 802-3-ethernet eth1
System eth0 257e9416-b420-4218-b1eb-f14302f20941 802-3-ethernet eth0
# nmcli con del f32cfcb7-3567-4313-9cf3-bdd87010c7a2
# nmcli con del 257e9416-b420-4218-b1eb-f14302f20941
Bonding Configuration
Execute the following steps at the console of both VM.
Create the bonding interface:
# nmcli con add type bond con-name mybond0 ifname bond0 mode active-backup
[88934.922710] bonding: bond0: Setting MII monitoring interval to 100.
[88934.923313] bonding: bond0: setting mode to active-backup (1).
[88934.923845] bonding: bond0: Setting ARP monitoring interval to 0.
[88934.924382] bonding: bond0: setting arp_validate to none (0).
[88934.924891] bonding: bond0: Setting primary slave to None.
[88934.925375] bonding: bond0: setting primary_reselect to always (0).
[88934.925920] bonding: bond0: Setting fail_over_mac to none (0).
[88934.926409] bonding: bond0: Setting use_carrier to 1.
[88934.926819] bonding: bond0: Setting ad_select to stable (0).
[88934.927286] bonding: bond0: setting xmit hash policy to layer2 (0).
[88934.927786] bonding: bond0: Setting resend_igmp to 1.
Connection 'mybond0' (304e66f0-c31c-4b57-92e8-734e2b53bdac) successfully added.
Note: If you don’t specify con-name mybond0, the bonding interface will be named bond-bond0.
Add an IPv4 configuration: In RHEL 7.0:
# nmcli con mod mybond0 ipv4.addresses "192.168.1.10/24 192.168.1.1"
# nmcli con mod mybond0 ipv4.method manual
From RHEL 7.1 on:
# nmcli con mod mybond0 ipv4.addresses 192.168.1.10/24
# nmcli con mod mybond0 ipv4.gateway 192.168.1.1
# nmcli con mod mybond0 ipv4.method manual
Note: If you don’t specify any IP configuration, both VM will get their ip address and gateway through DHCPby default.
Add the eth0 interface to the bonding interface:
# nmcli con add type bond-slave con-name bond0-eth0 ifname eth0 master bond0
[89010.860765] bonding: bond0: making interface eth0 the new active one.
[89010.861336] bonding: bond0: enslaving eth0 as an active interface with an up link.
Connection 'bond0-eth0' (35081742-5962-4edf-8465-6843603d7777) successfully added.
Note: If you don’t specify con-name bond0-eth0, the bonding slave interface will be named bond-slave-eth0.
Add the eth1 interface to the bonding interface:
# nmcli con add type bond-slave con-name bond0-eth1 ifname eth1 master bond0
[89146.655598] bonding: bond0: enslaving eth1 as a backup interface with an up link.
Connection 'bond0-eth1' (037019f3-7115-46a4-a6f9-8fba7bf2adcd) successfully added.
Note: If you don’t specify con-name bond0-eth1, the bonding slave interface will be named bond-slave-eth1.
Activate the bonding interface:
# nmcli con up mybond0
[89222.099283] bonding: bond0: releasing backup interface eth1
[89222.102432] bonding: bond0: releasing active interface eth0
[89222.126862] bonding: bond0: Setting MII monitoring interval to 100.
[89222.127410] bonding: bond0: setting mode to active-backup (1).
[89222.127950] bonding: bond0: Setting ARP monitoring interval to 0.
[89222.128494] bonding: bond0: setting arp_validate to none (0).
[89222.128991] bonding: bond0: Setting primary slave to None.
[89222.129460] bonding: bond0: setting primary_reselect to always (0).
[89222.129964] bonding: bond0: Setting fail_over_mac to none (0).
[89222.130443] bonding: bond0: Setting use_carrier to 1.
[89222.130847] bonding: bond0: Setting ad_select to stable (0).
[89222.131307] bonding: bond0: setting xmit hash policy to layer2 (0).
[89222.131801] bonding: bond0: Setting resend_igmp to 1.
[89222.132219] IPv6: ADDRCONF(NETDEV_UP): bond0: link is not ready
[89222.251450] bonding: bond0: making interface eth1 the new active one.
[89222.252022] bonding: bond0: first active interface up!
[89222.252462] bonding: bond0: enslaving eth1 as an active interface with an up link.
[89222.253641] IPv6: ADDRCONF(NETDEV_CHANGE): bond0: link becomes ready
[89222.305553] bonding: bond0: enslaving eth0 as a backup interface with an up link.
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/70)
Check the configuration:
# nmcli con show
NAME UUID TYPE DEVICE
mybond0 304e66f0-c31c-4b57-92e8-734e2b53bdac bond bond0
bond0-eth1 037019f3-7115-46a4-a6f9-8fba7bf2adcd 802-3-ethernet eth1
bond0-eth0 35081742-5962-4edf-8465-6843603d7777 802-3-ethernet eth0
Source: RHEL 7 Networking Guide.
Additional Resources
The Geek Diary website provides an interesting tutorial about Changing the currently active slave interface online.
Leave a comment