Interface Bonding on Redhat
This step by step guide is for configuring interface bonding on Redhat based operating systems.
For the following guide we will use the following data and assume that you are running all commands as the root user:
Type | Value |
---|---|
Primary interface | em1 |
Secondary interface | em2 |
Bond interface | bond0 |
IP Address | 192.0.2.2 |
Netmask | 255.255.255.0 |
Gateway | 192.0.2.1 |
Primary MAC address | 00:00:5E:00:53:00 |
Step-by-step guide
How to do it:
- Determine whether the bonding module is loaded:
lsmod | grep bonding
- If it is loaded go to step 3, otherwise:
modprobe bonding
- With the bonding module loaded into the kernel we need to determine what the interfaces are called:
ls /sys/class/net/
- From this list we need to select which interfaces we are going to use in the bond (the slaves). In most cases this will be the first two interfaces (eth0 & eth1, em1 & em2, eno0 & eno1 etc.)
Before we change the physical interface configurations, we need to create the bond interface.
The simplest way to create the bond interface configuration file is to copy the primary interface file (ifcfg-em1) to the bond interface file (ifcfg-bond0) and edit it.
cp /etc/sysconfig/network-scripts/ifcfg-em1 /etc/sysconfig/network-scripts/ifcfg-bond0 && sed -i 's/em1/bond0/g' /etc/sysconfig/network-scripts/ifcfg-bond0 && sed -i 's/HWADDR/MACADDR/g' /etc/sysconfig/network-scripts/ifcfg-bond0 && sed -i '/uuid/d' /etc/sysconfig/network-scripts/ifcfg-bond0 && echo 'BONDING_OPTS="mode=802.3ad lacp_rate=1"' >> /etc/sysconfig/network-scripts/ifcfg-bond0 && echo 'USERCTL=no' >> /etc/sysconfig/network-scripts/ifcfg-bond0 && echo 'NM_CONTROLLED=no' >> /etc/sysconfig/network-scripts/ifcfg-bond0
This will do the following configuration changes:
DEVICE=em1 BOOTPROTO=static IPADDR=192.0.2.2 SCOPE="peer 192.0.2.1" GATEWAY=192.0.2.1 NETWORK=192.0.2.1 HWADDR=00:00:5E:00:53:00 NETMASK=255.255.255.255 ONBOOT=yes TYPE=Ethernet DNS1=217.112.87.147 DNS2=217.112.88.90 DNS3=217.112.88.10 IPV6INIT=yes IPV6ADDR=2001:0db8:0000:0800:0192:0000:0002:0002/128 UUID="6eb9d580-b46e-4d63-adcc-17e5df965054"
DEVICE=bond0 BOOTPROTO=static IPADDR=192.0.2.2 SCOPE="peer 192.0.2.1" GATEWAY=192.0.2.1 NETWORK=192.0.2.1 MACADDR=00:00:5E:00:53:00 NETMASK=255.255.255.255 ONBOOT=yes TYPE=Ethernet DNS1=217.112.87.147 DNS2=217.112.88.90 DNS3=217.112.88.10 IPV6INIT=yes IPV6ADDR=2001:0db8:0000:0800:0192:0000:0002:0002/128 BONDING_OPTS="mode=802.3ad lacp_rate=1" USERCTL=no NM_CONTROLLED=no
We have:
- Renamed the device from em1 to bond0
- Changed the HWADDR to MACADDR
- Set the bonding mode to LACP and set the lacp rate to “Active/Fast”
- Disabled USERCTL
- Disabled Network Manager via NM_CONTROLLED=no
- Now our bond is configured, we need to configure our slave devices, these should both be identical except for the device name (and the UUID if we are using them), you should edit the ifcfg-em1 and ifcfg-em2 files to look like this:
DEVICE=em1 BOOTPROTO=none ONBOOT=yes SLAVE=yes MASTER=bond0 USERCTL=no NM_CONTROLLED=no
DEVICE=em2 BOOTPROTO=none ONBOOT=yes SLAVE=yes MASTER=bond0 USERCTL=no NM_CONTROLLED=no
- With our interfaces configured we need to restart networking to bring up the bond and start using it:
Redhat/CentOS 6: service network restart Redhat/CentOS 7: systemctl restart network
Get in touch
If you need advice on Interface Bonding for Redhat, we’re here to help.
Call us on 0333 247 0222: Monday – Friday, 9am – 5.30pm.
Chat with us on LiveChat: Monday – Friday, 9am – 5.30pm.
Write to us: Send us a support ticket from your Simply portal and we’ll get back to you as soon as we can.
If you don’t have an account with Simply Hosting yet, you can also send our Sales team an enquiry and we’ll get back to you between 9am and 5.30pm, Monday to Friday.