| Home Profile Fun |
#184 Linux 22.07.2009
Channel bonding on SLES 10To get a higher throughput and redundancy it is possible to combine several network interfaces. There are different algorithms available for the load balancing between the network cards. Some need special features or configuration on the switch others don't. In this example I use "balance-rr" which means that the traffic is sent equally through all participating cards (round robin). The nice thing is that you can pull any network cable and plug it in again. As long as there is always one cable connected you will not see any interruption of the traffic. You have redundancy and a higher throughput. The switch does not need any special configuration. Other algorithms for example use the second card as a backup only but use it only if the first card fails. Our example looks like this: Static IP 192.168.1.35 on the virtual bonding interface bond0 Algorithm balance-rr All traffic is routed through bond0. The easiest way to start is to use Yast for the initial configuration of the cards. By selecting dhcp you get the appropriate files in /etc/sysconfig/network. These will be modified as follows (this is my scenario, of course you have to adapt it for yours accordingly): # cat /etc/sysconfig/network/ifcfg-eth-id-00\:00\:cb\:69\:06\:ca BOOTPROTO='static' BROADCAST='' ETHTOOL_OPTIONS='' IPADDR='' MTU='' NAME='Realtek RT8139' NETMASK='255.255.255.0' NETWORK='' REMOTE_IPADDR='' STARTMODE='auto' UNIQUE='JNkJ.IQxIdIhhuH7' USERCONTROL='no' _nm_name='bus-pci-0000:05:04.0' # cat /etc/sysconfig/network/ifcfg-eth-id-00\:11\:85\:0f\:18\:cd BOOTPROTO='static' BROADCAST='' ETHTOOL_OPTIONS='' IPADDR='' MTU='' NAME='Hewlett-Packard Company HP d530 CMT (DG746A)' NETMASK='255.255.255.0' NETWORK='' REMOTE_IPADDR='' STARTMODE='auto' UNIQUE='rBUF.7LBxAzvZZlA' USERCONTROL='no' _nm_name='bus-pci-0000:05:02.0' Then we create the file ifcfg-bond0 for the bonding interface: # cat /etc/sysconfig/network/ifcfg-bond0 BOOTPROTO='static' BROADCAST='192.168.1.255' IPADDR='192.168.1.35' NETMASK='255.255.255.0' NETWORK='192.168.1.0' REMOTE_IPADDR= STARTMODE='onboot' BONDING_MASTER='yes' BONDING_MODULE_OPTS='mode=balance-rr miimon=100' BONDING_SLAVE0='eth0' BONDING_SLAVE1='eth1' # or BONDING_SLAVE0='hwcfg-bus-pci-0000:05:02.0' # BONDING_SLAVE1='hwcfg-bus-pci-0000:05:04.0' To route everything through bond0 we need a static route: # cat /etc/sysconfig/network/routes: default 192.168.1.1 - bond0 You don't have to change /etc/modprobe.conf.local. Finally it should look like this:
gpfs:~ # ip a
1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth1: <BROADCAST,MULTICAST,SLAVE,UP> mtu 1500 qdisc pfifo_fast master bond0 qlen 1000
link/ether 00:11:85:0f:18:cd brd ff:ff:ff:ff:ff:ff
inet6 fe80::211:85ff:fe0f:18cd/64 scope link
valid_lft forever preferred_lft forever
3: eth0: <BROADCAST,MULTICAST,SLAVE,UP> mtu 1500 qdisc pfifo_fast master bond0 qlen 1000
link/ether 00:11:85:0f:18:cd brd ff:ff:ff:ff:ff:ff
inet6 fe80::211:85ff:fe0f:18cd/64 scope link
valid_lft forever preferred_lft forever
5: sit0: <NOARP> mtu 1480 qdisc noop
link/sit 0.0.0.0 brd 0.0.0.0
6: bond0: <BROADCAST,MULTICAST,MASTER,UP> mtu 1500 qdisc noqueue
link/ether 00:11:85:0f:18:cd brd ff:ff:ff:ff:ff:ff
inet 192.168.1.35/24 brd 192.168.1.255 scope global bond0
inet6 fe80::200:ff:fe00:0/64 scope link
valid_lft forever preferred_lft forever
gpfs:~ # route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 bond0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 bond0
Warning! If you try to shutdown the network at this point or you try to reboot your server the whole system will hang. You have to pull the plug. The reason for this is that the network init script tries to shut down bond0 without detaching the slaves first. Therefore it is absolutely necessary to modify the init script: In /etc/init.d/network, at line 820 from:
stop)
echo Shutting down network interfaces:
if [ -z "$INTERFACE" ] ; then
to:
stop)
echo Shutting down network interfaces:
echo "First detach bonding slaves from master:"
echo "ifenslave -d bond0 eth0"
ifenslave -d bond0 eth0
echo "ifenslave -d bond0 eth1"
ifenslave -d bond0 eth1
if [ -z "$INTERFACE" ] ; then
To simplify matters I have inserted ifenslave for both slaves directly. A more generic solution would be nice but it works like this. SLES Administration |