more ways to configure bonding
*Setting up Network Bonding*
****************************
1. Alias The Bonding Module And Set Module Options
The module options should be on a separate line from the alias.
RHEL3: This should go in /etc/modules.conf
RHEL4, RHEL5: This should go in /etc/modprobe.conf
Quick explanation:
mode=1 - specifies failover
miimon=100 - specifies MII link monitoring frequency of 100ms
alias bond0 bonding
options bond0 mode=1 miimon=100
2. Master Interface Configuration
Create /etc/sysconfig/network-scripts/ifcfg-bond0:
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
IPADDR=<server's IP address>
NETMASK=<server's netmask>
USERCTL=no
3. Slave Interface Configuration
Change /etc/sysconfig/network-scripts/ifcfg-eth0 and ifcfg-eth1 to look like this:
DEVICE=eth<N>
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
4. Static Gateway Routes (RHEL3 Only)
NB. This is not necessary on RHEL4 and RHEL5. It may still be necessary on RHEL3 - this is currently untested. Add the following lines to /etc/sysconfig/static-routes:
bond0 v <server's IP address>
bond0 v default gw <gateway IP>
5. Change The Gateway Device
Edit the GATEWAYDEV field in /etc/sysconfig/network to 'bond0' rather than 'eth0'.
6. MAC Addresses
RHEL3, RHEL4: Make sure there is not a 'HWADDR' field in ifcfg-eth0 or ifcfg-eth1. These confuse the bonding module.
RHEL5: Make sure there is a 'HWADDR' field in ifcfg-eth0 and ifcfg-eth1 (and ifcfg-eth2 for MBU). This is necessary to avoid the interfaces flipping on reboot.
Checking for entries:
grep -i hwaddr /etc/sysconfig/network-scripts/ifcfg-eth[0-9]
Adding entries:
for i in eth0 eth1 eth2; do echo -n 'HWADDR=' >> /etc/sysconfig/network-scripts/ifcfg-$i; ifconfig $i\
| awk '/HWaddr/{print $NF}' >> /etc/sysconfig/network-scripts/ifcfg-$i; done
Adding entries if bonding is already in place (the bonding module overrides the MAC address of eth1, so we need to make sure we get the right address):
for i in eth0 eth1; do echo -n 'HWADDR=' >> /etc/sysconfig/network-scripts/ifcfg-$i; grep -A3 $i /proc/net/bonding/bond0\
| awk '/Permanent/{print $NF}' >> /etc/sysconfig/network-scripts/ifcfg-$i; done
7. Restart Networking
Restarting networking will load the module automagically, there's no need to worry about this separately.
service network restart
8. Test!
Use the one-liner below to check that the server can ping it's gateway over each NIC individually (this script is split onto three lines deliberately). If possible, reboot the machine to verify that the settings remain static.
ifenslave -c bond0 eth1 && ping -c5 `route -n | awk '/^0.0.0.0/{print $2}'`;\
ifenslave -c bond0 eth0 && ping -c5 `route -n | awk '/^0.0.0.0/{print $2}'`;\
tail -25 /var/log/messages | grep bonding && cat /proc/net/bonding/bond*
Last updated
Was this helpful?