You are here

Quick Setup Notes: Network Bonding on RHEL 6

Things are a bit changed from RHEL 5 to 6, but if you are familiar with configuring bonding by hand, you'll be able to adjust.

The biggest change, is modprobe has been broken up into pieces. So, to load the bonding module, you'll need to create a new file.

vi /etc/modprobe.d/bonding.conf
alias bond0 bonding

Note that the bonding options, are no longer in the modprobe file. They are in the interface now. Let's setup the bonded interface now.

cd /etc/sysconfig/network-scripts
vi ifcfg-bond0

DEVICE="bond0"
NM_CONTROLLED="yes"
ONBOOT="yes"
BOOTPROTO=none
IPADDR=192.168.10.10
PREFIX=24
GATEWAY=192.168.10.1
DNS1=8.8.8.8
DOMAIN=techtamer.net
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
USERCTL=no
NAME=bond0
BONDING_OPTS="mode=0 miimon=1000 downdelay=5000 updelay=5000"

I didn't do anything fancy with the bonding options, but you certainly can tune it more. I like the long delays as they help prevent flapping... and anyone noticing that I bumped something... sort of the 5 second rule, but for networks. Here's a quick reminder of the modes:

Mode Name Description
0 blance-rr round-robin - the easiest to get the network guys to setup
1 active-backup active-backup AKA active-standby in the windows world. This is also easy to get the network guys to setup as they don't need to know
2 balance-xor Exclusive or. I've never used it.
3 broadcast Basically, all transmits go out all slave interfaces. I've never used it and don't know how to get the network to handle it.
4 802.3ad LACP - the best way to go, but needs good network support. In one case, I have LACP setup so it's not just redundant, but a bigger pipe as well. In that case, I have a 10G going to one switch fabirc and 10G going to the other, but through the magic of VPC on the Nexus switches, I'm getting 20Gbs.
5 balance-tlb Basically, transmits are distributed according to number of sessions, recieves switches only when there is an event.
6 balance-alb In Cisco terms, port channeling. Another good option to get buy-in from the networking crew, at least if they are a Cisco shop.

Now, don't forget to declare what interfaces are in this bond:

vi ifcfg-eth0
DEVICE="eth1"
NM_CONTROLLED="yes"
HWADDR="01:02:03:04:05:06"
ONBOOT="yes"
TYPE=Ethernet
BOOTPROTO=none
MASTER=bond0
SLAVE=yes

and do the same for eth5 or whatever you are using. Note, I just added a fake mac address for the above. You should leave your real mac in there to deal with the enumeration of ports. Don't forget udev if you break something.

All setup right, you should then see something like...

/sbin/ifconfig
bond0 Link encap:Ethernet HWaddr 1C:C1:DE:21:EE:52
inet addr:192.168.10.10 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: fe80::1ec1:deff:fe21:ee52/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:1641 errors:0 dropped:0 overruns:0 frame:0
TX packets:222 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:138303 (135.0 KiB) TX bytes:25244 (24.6 KiB)

eth1 Link encap:Ethernet HWaddr 01:02:03:04:05:06
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:795 errors:0 dropped:0 overruns:0 frame:0
TX packets:108 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:69088 (67.4 KiB) TX bytes:12499 (12.2 KiB)
Interrupt:17 Memory:f2000000-f2012800
...

That's all fine and good, but how do you check on it?

/bin/cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 1000
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth5
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 07:08:09:0a:0b:0c
Slave queue ID: 0

Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 01:02:03:04:05:06
Slave queue ID: 0

What mac is it using at the moment (it generally just grabs the first available one from the slave interfaces)

/bin/cat /sys/class/net/bond0/address

How do I test it?
The best way would be to unplug it and time it. Remotely, you can shut the port on the switch, or you can just ifdown the port and the ifup to bring it back. If all is right with the world, you won't have an interruption to service.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer