1 AUTHOR: Jim Gifford <lfs-hints at jg555.com>
5 LICENSE: GNU Free Documentation License Version 1.2
7 SYNOPSIS: How to setup ethernet bonding with LFS.
9 DESCRIPTION: This hint will provide the necessary information for
10 ethernet interface teaming.
12 PREREQUISITES: Backup your /etc/syconfig/network-devices before you
19 Ethernet bonding allows you combine ethernet interfaces. You can have
20 then setup in a few different modes.
22 Round Robin - This mode provides load balancing and fault tolerance.
24 Active Backup - This mode provides fault tolerance.
26 I have tried to make this hint as easy as possible, but if you have any
27 suggestions or comment, please email me at the email address above.
31 Everything you need is included in the linux source code.
37 In the 2.4 and 2.6 Kernel, you will need to add the following option
41 Network device support --->
42 <M> Bonding driver support
44 <*> Bonding driver support
49 Networking support --->
50 <M> Bonding driver support
52 <*> Bonding driver support
54 At this point you can recompile your kernel.
59 After you are finished recompiling your kernel you will need to go to
60 the Documentation/networking directory in your linux kernel source files.
62 You will find a program called ifenslave.c. You will need to compile the
63 program in the following manner.
65 gcc -O -I/usr/src/linux/include ifenslave.c -o ifenslave
67 chmod 755 /sbin/ifenslave
70 Now we will need to create a new ifup and ifdown that is compatible with
73 cat > /etc/sysconfig/network-devices/ifup << "EOF"
76 source /etc/sysconfig/rc
78 source $network_devices/ifconfig.$1
80 if [ -f $network_devices/ifup-$1 ]
82 $network_devices/ifup-$1
84 if [ -z $IP ] && [ -z $SLAVE ]
86 echo "IP variable missing for ifconfig.$1, cannot continue"
90 if [ -z $NETMASK ] && [ -z $SLAVE ]
92 echo -n "NETMASK variable missing for ifconfig.$1, "
93 echo "using 255.255.255.0"
97 if [ -z $BROADCAST ] && [ -z $SLAVE ]
99 echo -n "BROADCAST variable missing for ifconfig.$1, "
100 echo "using default address"
105 echo "Bringing up the $1 interface..."
106 ifconfig $1 $IP netmask $NETMASK broadcast $BROADCAST
109 echo "Bringing up the $1 interface..."
116 cat > /etc/sysconfig/network-devices/ifdown << "EOF"
119 source /etc/sysconfig/rc
121 source $network_devices/ifconfig.$1
123 if [ -f $network_devices/ifdown-$1 ]
125 $network_devices/ifdown-$1
129 echo "Bringing down the $1 interface..."
136 Now we need to recreate our ifconfig.(interface files). You do not need to
137 change your existing ones if the adapter is not going to be bonding partner.
139 For interfaces that are not bonding members
141 cat > /etc/sysconfig/network-devices/ifconfig.{interface_that_is_not_bonded} << "EOF"
144 NETMASK={subnet_mask}
145 BROADCAST={broadcast_address}
148 The bonding interface is the interface name of now teamed ethernet interfaces.
149 For the bonding interface. This will either be bond0
150 cat > /etc/sysconfig/network-devices/ifconfig.bond0 << "EOF"
153 NETMASK={subnet_mask}
154 BROADCAST={broadcast_address}
157 For interfaces that are bonding members
159 cat > /etc/sysconfig/network-devices/ifconfig.{interface_that_is_bonded} << "EOF"
165 ******Explanation what we actually need to do.*******
167 Ok this is the mosting confusing part. So I am going to give examples of the above
170 eth0 is the wan interface.
171 eth1 and eth2 are the lan interfaces for network 192.168.0.0
173 ifconfig.eth0 would look like this
177 NETMASK=255.255.255.0
178 BROADCAST=64.30.195.255
180 ifconfig.bond0 would look like this
184 NETMASK=255.255.255.0
185 BROADCAST=192.168.0.255
187 ifconfig.eth1 and ifconfig.eth2 would look like this
193 Now when we boot, bond0 will be the team of eth1 and eth2.
198 You will need to add the following to your modprobe.conf for 2.6 or your
202 options bond0 miimon=100
207 Now after you have rebooted, you can check to see if your bonding is working ok.
209 You can run "ifconfig bond0", if you see data your probably fine. Make sure
210 the IP addresses information is correct.
212 Here is my output as a reference
214 bond0 Link encap:Ethernet HWaddr 00:00:D1:1F:20:49
215 inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
216 UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
217 RX packets:36491 errors:0 dropped:0 overruns:0 frame:0
218 TX packets:37519 errors:57 dropped:0 overruns:5 carrier:52
219 collisions:1 txqueuelen:0
220 RX bytes:3295515 (3.1 Mb) TX bytes:13366345 (12.7 Mb)
222 You can also use cat /proc/net/bonding/bond0.
224 Here is my output as a reference
226 Ethernet Channel Bonding Driver: v2.6.0 (January 14, 2004)
228 Bonding Mode: load balancing (round-robin)
230 MII Polling Interval (ms): 100
234 Slave Interface: eth1
236 Link Failure Count: 0
237 Permanent HW addr: 00:00:d1:1f:20:49
239 Slave Interface: eth2
241 Link Failure Count: 0
242 Permanent HW addr: 00:00:d1:1f:20:4a
244 Slave Interface: eth3
246 Link Failure Count: 0
247 Permanent HW addr: 00:00:d1:1f:20:4b
250 Want more the one ethernet Team
252 By default the bonding driver only allows one bonded group. If you want more teamed
253 interfaces you can use the following commands.
255 Change modprobe.conf or modules.conf
258 options bond0 miimon=100
260 options bond0 miimon=100 max_bonds={#_of_teams}
263 options bond0 miimon=100 max_bonds=3
265 would create bond0 bond1 bond2
268 Changes to my existing Programs
270 The only change is that you don't specify an eth{x} interface, you would
271 specify the bond0 interface instead.
276 For more information view in the kernel source Documentation/network/bonding.txt.
281 CHANGELOG: 1.1 Fixed Date
284 New Version of this document can be viewed from http://cvs.jg555.com/viewcvs.cgi/lfs-hints