Here are simple instructions on how to configure network interface bonding on Red Hat based distros. The thing I always forget. There’s also a little script which will create a bonding interface bond0 between eth0 and eth1 and migrate existing IP settings from eth0. You can find it in the bottom of this post.
But first here’s how to do it by hand.
Configure bonding module and interface alias:
/etc/modprobe.conf:
1 2 |
alias bond0 bonding options bond0 miimon=100 mode=1 |
Insert bonding module:
1 |
# modprobe bonding |
Configure network interfaces, two physical and one bonding interface:
/etc/sysconfig/network-scripts/ifcfg-eth0:
1 2 3 4 5 6 7 |
DEVICE=eth0 BOOTPROTO=static HWADDR=00:11:22:33:44:55 ONBOOT=yes TYPE=Ethernet SLAVE=yes MASTER=bond0 |
/etc/sysconfig/network-scripts/ifcfg-eth1:
1 2 3 4 5 6 7 |
DEVICE=eth1 BOOTPROTO=static HWADDR=00:11:22:33:44:56 ONBOOT=yes TYPE=Ethernet SLAVE=yes MASTER=bond0 |
/etc/sysconfig-network-scripts/ifcfg-bond0:
1 2 3 4 5 6 |
DEVICE=bond0 BOOTPROTO=none IPADDR=192.168.0.2 NETMASK=255.255.255.0 GATEWAY=192.168.0.1 ONBOOT=yes |
Restart networking (your network connections will drop at this point):
1 |
# /etc/init.d/network restart |
That’s it!
Automatic Script
Here’s the script I promised. It takes your existing IP settings from eth0 and migrates them to a newly created bond0 which is created between eth0 and eth1:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
cat >>/etc/modprobe.conf <<EOF alias bond0 bonding options bond0 miimon=100 mode=1 EOF cat >>/etc/sysconfig/network-scripts/ifcfg-bond0 <<EOF DEVICE=bond0 BOOTPROTO=none ONBOOT=yes EOF cat /etc/sysconfig/network-scripts/ifcfg-eth0 | \ egrep 'IPADDR|NETMASK|GATEWAY' >>/etc/sysconfig/network-scripts/ifcfg-bond0 HWADDR_ETH0="$(cat /etc/sysconfig/network-scripts/ifcfg-eth0 | grep HWADDR)" HWADDR_ETH1="$(cat /etc/sysconfig/network-scripts/ifcfg-eth1 | grep HWADDR)" cat > /etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF DEVICE=eth0 BOOTPROTO=static ONBOOT=yes TYPE=Ethernet SLAVE=yes MASTER=bond0 $HWADDR_ETH0 EOF cat > /etc/sysconfig/network-scripts/ifcfg-eth1 <<EOF DEVICE=eth1 BOOTPROTO=static ONBOOT=yes TYPE=Ethernet SLAVE=yes MASTER=bond0 $HWADDR_ETH1 EOF |
More information can be found in the bonding.txt of the kernel source documentation.
http://www.netmite.com/android/mydroid/kernel/Documentation/networking/bonding.txt