Finally today I had implemented NIC bounding (bind both NIC so that it works as a single device). We have two Dell servers that need setup with Intel Dual Gig NIC. My idea is to improve performance by pumping out more data from both NIC without using any other method.
This box act as heavy duty ftp server. Each night I need to transfer over 200GB data from this box to another box. Therefore, the network would be setup is two servers on a switch using dual network cards. I am using Red Hat enterprise Linux version 4.0.
Linux allows binding multiple network interfaces into a single channel/NIC using special kernel module called bonding. According to official bonding documentation, "The Linux bonding driver provides a method for aggregating multiple network interfaces into a single logical "bonded" interface. The behavior of the bonded interfaces depends upon the mode; generally speaking, modes provide either hot standby or load balancing services. Additionally, link integrity monitoring may be performed."
Setting up bounding is easy with RHEL v4.0.
Step #1: Create a bond0 configuration file
Red Hat Linux stores network configuration in /etc/sysconfig/network-scripts/ directory. First, you need to create bond0 config file:
# vi /etc/sysconfig/network-scripts/ifcfg-bond0Append following lines to it:DEVICE=bond0Replace above IP address with your actual IP address. Save file and exit to shell prompt.
IPADDR=192.168.1.20
NETWORK=192.168.1.0
NETMASK=255.255.255.0
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
Step #2: Modify eth0 and eth1 config files:
Open both configuration using vi text editor and make sure file read as follows for eth0 interface# vi /etc/sysconfig/network-scripts/ifcfg-eth0Modify/append directive as follows:DEVICE=eth0Open eth1 configuration file using vi text editor:
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none# vi /etc/sysconfig/network-scripts/ifcfg-eth1Make sure file read as follows for eth1 interface:DEVICE=eth1Save file and exit to shell prompt.
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
Step # 3: Load bond driver/module
Make sure bonding module is loaded when the channel-bonding interface (bond0) is brought up. You need to modify kernel modules configuration file:# vi /etc/modprobe.confAppend following two lines:alias bond0 bondingSave file and exit to shell prompt. You can learn more about all bounding options in kernel source documentation file (click here to read file online).
options bond0 mode=balance-alb miimon=100
Step # 4: Test configuration
First, load the bonding module:# modprobe bondingRestart networking service in order to bring up bond0 interface:# service network restartVerify everything is working:# less /proc/net/bonding/bond0Output:
Bonding Mode: load balancing (round-robin) MII Status: up MII Polling Interval (ms): 0 Up Delay (ms): 0 Down Delay (ms): 0 Slave Interface: eth0 MII Status: up Link Failure Count: 0 Permanent HW addr: 00:0c:29:c6:be:59 Slave Interface: eth1 MII Status: up Link Failure Count: 0 Permanent HW addr: 00:0c:29:c6:be:63
List all interfaces:# ifconfigOutput:
bond0 Link encap:Ethernet HWaddr 00:0C:29:C6:BE:59 inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 RX packets:2804 errors:0 dropped:0 overruns:0 frame:0 TX packets:1879 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:250825 (244.9 KiB) TX bytes:244683 (238.9 KiB) eth0 Link encap:Ethernet HWaddr 00:0C:29:C6:BE:59 inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fec6:be59/64 Scope:Link UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:2809 errors:0 dropped:0 overruns:0 frame:0 TX packets:1390 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:251161 (245.2 KiB) TX bytes:180289 (176.0 KiB) Interrupt:11 Base address:0x1400 eth1 Link encap:Ethernet HWaddr 00:0C:29:C6:BE:59 inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fec6:be59/64 Scope:Link UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:4 errors:0 dropped:0 overruns:0 frame:0 TX packets:502 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:258 (258.0 b) TX bytes:66516 (64.9 KiB) Interrupt:10 Base address:0x1480
Now you have bond multiple network interfaces into a single channel (NIC). Read the official howto it covers following additional topics:
- VLAN Configuration
- Cisco switch related configuration
- Advanced routing and troubleshooting
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- 10 Greatest Open Source Software Of 2009
- My 10 UNIX Command Line Mistakes
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
- Email this to a friend
- Download PDF version
- Printable version
- Comment RSS feed
- Last Updated: Nov/4/2006


{ 48 comments… read them below or add one }
Many thanks for quick instructions. It worked like a charm.
Just one more hint:
Enable spanning tree for switches. I had noticed the network speed reduction when spanning tree was not enabled.
Just my two 2 cents
Thanks for the quick help!! bonding r0x!! Just make sure that eth0 and eth1 are up when you put up the bond0. And be careful if you’re doing this over a remote ssh. *thumbs up*
Did you notice that your /proc/net/bonding/bond0 was reporting incorrect settings based on your mode and other settings?
I’m having the same problem.
hmm. did anyone experience what i did?
when i do a ifdown eth0, the ping timed out. it doesn’t seem to be bonding well.
What will be the behaviour if eth0 and eth1 interfaces does not have IP addresses and they share the IP address of bond0 in a failover scenario.
Will there be any entey for eth0 and eth1 in /proc/net/route????
- gaurav
bond0 config file needed another line in my configuration:
GATEWAY=192.168.0.1
Can you bond more than 2 nics? e.g 4 NICs?
Reason why I ask is because I want a big fat trunk of say 4×1Gig Nic’s and then run many virtulized O/S that runs it’s connection virtually though bond0.
Seno,
How many bonding devices can I have?
There is no limit.
How many slaves can a bonding device have? OR Can you bond more than 2 nics?
This is limited only by the number of network interfaces (NIC) Linux supports and/or the number of network cards you can place in your system.
HTH
HI
i have 2 uplink and 1 internal link.i want to use 2 uplink at the same time.i installed core 5.
so how can i do?
my information
etho
ip-10.241.215.163
nesk-255.255.255.240
GW-10.241.215.161
eth2
ip-10.255.8.104
nesk-255.255.255.252.0
GW-10.255.8.1
eth1
ip-192.168.1.1
nesk-255.255.255.0
Thanks
Please
Thanks!
It works very well…
Just add this :
GATEWAY=192.168.1.1 (replace with your gateway)
To the bond config file
thanks!
I have 4 DSL modems connected with 4 different ISP’s my scenario is
a) My FC-2 machine with LAN IP=192.168.10.1 and Bond0 IP=192.168.1.1
b) Modem-A LAN IP= 192.168.1.2 , ext IP=xxx.xxx.xxx.xxx
c) Modem-B LAN IP=192.168.1.3, ext IP=xxx.xxx.xxx.xxx
d) Modem-C LAN IP=192.168.1.4, ext IP=xxx.xxx.xxx.xxx
e) Modem-D LAN IP=192.168.1.5, ext IP=xxx.xxx.xxx.xxx
Modem-A, B, C, and D LAN connected with my FC-2 machine, and all 4 interfaces of my machine are in Bond0,
Now please help me what default Gateway I should set in my FC-2 machine?>??? or I have to set 4 gateways in my machine??
and will this configuration works??
my scenario will also listed in my home page, please visit Linux section for better understanding.
Thanks in advance.
Rizwan.
Karachi, Pakistan.
homepage: http://freewaresolutions.150m.com
Great tutorial however on FC7 and likely other distributions you have to manually assign an IP to the bond0. Not at all a big deal though
Great work.
What I mean by that is that after reboot on FC7 it appears you have to reassign the bond0 causing you to do the “vi /etc/sysconfig/network-scripts/ifcfg-bond0″ part again and yes I did :wq! :-)
May just be an issue with my build.
Again great work
I am using this configuration on centos 5.0 and when i do service network restart i am getting warning hardware address conflicts with eth0 change hardware address.
Please suggest me on the same.
Thanks in advance
Shyam
Perfect guide! My NIC bond went without a single hitch! Thanks and keep the guides coming… ;-)
I did this and it worked on my FC4 machine, but it doesn’t show eth1 in the ifconfig. I am not sure if it is bonded or not. Can you help me with this problem?
I did this with FC8, I’m newbie and i am confused that how can i bond two dsl modem together is this the way or this is some thing else? or this is only bonding two nic for heavy traffic/load balancing in LAN?
This is only for bonding two nics onto the same network, to provide resilience or extra throughput. It’s no use if you want to balance across multiple networks.
how to enable MII Status for eth0. Although i have done all the above steps, but its creating problem.
/proc/net/bonding/bond0, snippet :
Slave Interface: eth0
MII Status: down
Link Failure Count: 0
Permanent HW addr: 00:1b:a0:26:cb:78
Does anyone know if /proc/net/bonding/bond0 will display ‘MII status: up’ ONLY when your NICs fully support Link Aggregation?
It’s showing as UP for everything and ifconfig produces something similar to what’s shown in this article except the NICs (eth2,eth3) don’t show an inet value… Is that normal?
Great tut but will bonding work with dynamic IP’s as I do not have static IP’s from my ISP
Great guide…..managed to configure almost everything but after reboot of server, only managed to see bond0 in up status. I need to execute the network script (service network start) again in order to have eth0 in up status. Kindly advise how can this be resolve??? Thank you.
Very nice explanation!
If you are considering teaming NICs, remember the limitations of the bus itself.
For example, if you think putting 4 Gigabit cards in your PCI bus will get you more speed, you are sadly mistaken! PCI bus is limited to maximum of around 133 MB/s. Putting two gigabit NICs on PCI will be a waste of time. Better to have at least PCI-X, or even better, PCI-e before you think about teaming your adapters.
Remember too, that even on-board NICs usually share the PCI bus with the PCI slots. So adding a gig card to a machine with an onboard gig adapter would also usually be a waste of time unless your bus was, again, PCI-X or better.
I exactly need the same kind of solution in Windows 2003 Server.Please help me out on this!
Does anyone know how to trunc two bonding Interfaces to a single one with active-passive mode?
I would like to ask if it is possible to bond ethernet connection with a wireless one?
My OS: xen-dom0 on centos5
I am setting up bonding at the moment and I was wondering why we need:
ONBOOT=yes
I tried with “ONBOOT=no” and my bond interface is brought up at startup with both slaves…
As far as I understand bonding, it seems that when the bonding interface is starting up, it brings up the required slave interfaces.
Please correct me if I am wrong :-) And if you can explain why it would be excellent!
Cheers
Gael
i m new with linux.i m using redhat linux 9.0 with squid proxy server for my netcafe.i have two broadband conections.the setting of external interfaces(broadeband) are following
1)
192.168.0.1 ip
255.255.255.0 mask
192.168.0.1 gateay
2)
192.168.1.1 ip
255.255.255.0 mask
192.168.1.1 gateway
my internal nic ip is 10.0.0.1 which is for out put.plz send me the bond setting with these ips.i will be very thankfull to you.
i want to install inbuilt squid proxy in fedora server 9 pls guide me step by step configuration
i am using tata broadband
with regards
vijay
Hey Man,
Solid info provided with minimum efforts…..
Hi
I have 2 links (5Mb and 2Mb) from 2 ISP, Does this solution give traffic load balancing possibility as if I have 7Mb bandwidth ?
thanks for your any help
i m using linux fedora 9.0 with squid proxy server for my internet cafe. I have two broadband connections. The setting of external interfaces(broadband) are following
1) Bandwidth – 2 Mb uplink
10.254.55.16 ip
255.255.252.0 mask
10.254.55.1 gateay
2)Bandwidth – 3 Mb uplink
10.254.22.45 ip
255.255.252.0 mask
192.168.22.1 gateway
3)
LAN IP
192.168.1.2
255.255.255.0
192.168.1.1
What I need to get traffic load balancing. Could you Please advice me.
thank in advance
KA
Hi,
How do I connect the slave interface eth0, eth1 to the LAN switch, both interfaces need to connect or just only one ? …
If both eth0 and eth1 are connected, does the LAN switch select one higher priority than other ?
Thanks
TJ
Hi
I have a bond created. But if I bring both interfaces down, and then back up, they are not making link up; they appear as down.. They will only come up if I bring up the whole bond. Where can be the problem?
how come that u set the mode in balance-alb yet when you type ifconfig, the configuration shows round robin mode..?
options bond0 mode=balance-alb miimon=100
should be
options bonding mode=balance-alb miimon=100
Thanks for great article! ;)
Hi,
I try to configure bond interface in VMWARE with 4 ethernet cards, I follow the steps mentioned above. The problem is only bond interface have ip, there is no ip for eth0,eth1,eth2,eth3. I tried this in RHEL 5.1
I am currently having issues with bonding on a RHEL 5 machine. I have the bonding setup correctly and when I run the ifconfig command it looks to be up, however when I attempt to ping this machine from another computer I get no response. However, if I start a ping from the RHEL 5 comptuer and then attempt to ping from another computer it responds. Any insight would be greatly appreciated.
FYI, I am using “active-backup” mode.
Is there any command, which would swith the active interface in the bond?
Example: bond0 consists of eth0 and eth1
now eth1 is active
enter command
now eth0 is active
Also I’m searching for command, which would check, which interface in bond is active.
(Suse linux)
Thanks, Peter
Been searching for the answer to loptos above and thought I’d leave it here.
To find which interface is active have a look in /proc/net/bonding/bond0 (mentioned earlier).
To change which is active have a look at the ifenslave command and try something like this:
ifenslave -c bond0 eth1
In my case I wasn’t able to start a second bonding interface on a RHEL4.
bond0 : eth2 and eth3
bond1 : eth4 and eth5
Error message was :
“Bringing up interface bond1: bonding device bond1 does not seem to be present, delaying initialization.”
after 2 days of google and test i found a working configuration. My problem was in the modprobe.conf configuration file.
Here are the bonding configuration in the modprobe.conf working for me :
# allow 2 bounding interfaces
options bonding max_bonds=2
# bond0
install bond0 /sbin/modprobe -a eth2 eth3 && /sbin/modprobe bonding
alias bond0 bonding
options bond0 mode=x,miimon=100,primary=eth2,etc.
# bond1
install bond1 /sbin/modprobe -a eth4 eth5 && /sbin/modprobe bonding
alias bond1 bonding
options bond1 mode=x,miimon=100,primary=eth4,etc.
Hop it will help someone.
Fabrice
Hello sir,
here we are using 3 squid (proxy )in Redhat 4 and sharing internet for 1) for wifi 2) for Lan and 3) for staff … if one squid dead that people are suffering ..if there is any load balancing server for squid ..how share there load if one squid dead…
Thanking you
Deiveegan.S
SASTRA University
Thanjavur-Tamilnadu-India
Thanks a lot fabrice,
we are also facing exactly the same proble(multiple bonding in rhel 4.7).
Let me try with the solution provided by you,and will update the comments.
Cheers,
satya
Leave a comment… Well, this is more a question because I try to understand how to place
my actual IP address when I am using a client’s TOR network…
Hello, I have few question
last week I playing with bonding.
At work I making file server, this is ubuntu server box with 2 nic’s also we have windows 7 clients with 2 nic as well & finally cisco switch 4500. Becourse we work with huge files, network speed is our main headache, so I try to aggregate network interface. I done it, but speed stay the same. I can utilize only 1 Gb connection (110 Mb /sec), but I want more!
Trying different conf, result the same. Even I make connection between win boxes without 802.3 ab cant have more than 110 Mb/sec. Now I think may be it is cisco misconfiguration?
Please tell me if some one got multiply speed bandwidth ?