Bonding network cards
Under Linux, the Kernel allows you to bond 2 or more network cards. Bonding network cards allows you to double the speed in both directions and allows you to balance the network load between them. It can also make connection redundancy in case a network link fails. In this article, you will be shown how to bond the cards using the YaST Network Settings utility.
What you need to know
- You will need more than one network card.
- This will only work under the traditional ifup or wickedd method of configuration and doesn't work under NetworkManager or wicked network management.
- You will need to know the interface names of the cards.
- You should decide what kind of load-balancing you want to use. You can view available modes here.
Bonding via YaST
- Goto Launch menu > System > YaST
- Select 'Network Settings' under the 'Network devices' heading. This will display the network interfaces on your system and how they are configured.
- Select the 'Global Options' tab.
- Check that the 'Network Setup Method' is set to 'Traditional Method with ifup'. If not your system will be configured by NetworkManager and bonding will not work. You will first have to setup your network with ifup before continuing.
- Select the 'Overview' tab (the one you started on). This will display all the network cards available on your system.
- For each of the cards you want to bond, you will need to complete the following on each card:
- Click on a card and press the 'Edit' button. This will open on the 'Address' tab.
- You will need to change the 'Dynamic Address' or 'Statically assigned IP Address' radio button to 'No IP Address (for Bonding Devices)'. Make sure the 'Use iBFT values' tick box is not ticked.
- Click OK. This will return you to the 'Overview' tab. Next to the network card you just edited, under the 'IP Address' list heading, it should now be listed as 'NONE'.
- Repeat these steps for any other cards you will be including in the bond.
- Double check all cards you will be including all say 'NONE' in the 'IP Address' field.
- When all is done, click the 'Add' button.
- Under the 'Device Type' drop down box, change the device type from 'Ethernet' to 'Bond'. Some values below it should now grey out. Now click 'Next'.
- You should now see a page the same as when you clicked the 'Edit' button to configure the network cards you wanted to use earlier. Now select whatever your cards were using before to get an IP address (either 'Dynamic Address' or 'Statically assigned IP Address'). If your using a static address, you'll need to enter your IP address settings you want to use.
- Select the tab 'Bond Slaves'. This will list all the network cards on your computer. Tick the cards you want included in this bond.
- At the bottom of the tab is a drop down menu called 'Bond Driver Options'. This is where you select the bonding mode you want to use (see here for what the modes do and choose). You can either choose from the drop down box or type your own settings in more advanced applications.
- Once all is set, click 'Next'. You will be taken back at the 'Overview' tab.
- You should now see a device called 'Bond Network' with the 'IP Address' field as whatever you set it as. It shouldn't read 'NONE'. If all is good. Click 'OK'. Your network will now be restarted to apply the changed.
- At this point you can check that you have network connectivity by opening a web browser and trying to open a web page.
- Open Konsole from the Launch menu.
- Now type
sudo ifconfig
. This will output your network configuration. This is an example:
bond0 Link encap:Ethernet HWaddr <MAC Address> inet addr:192.168.1.249 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 RX packets:4227 errors:0 dropped:0 overruns:0 frame:0 TX packets:2870 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:592726 (578.8 Kb) TX bytes:2962763 (2.8 Mb) eth0 Link encap:Ethernet HWaddr <MAC Address> UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:2245 errors:0 dropped:0 overruns:0 frame:0 TX packets:1447 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:336065 (328.1 Kb) TX bytes:1482989 (1.4 Mb) Interrupt:17 eth1 Link encap:Ethernet HWaddr <MAC Address> UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:1982 errors:0 dropped:0 overruns:0 frame:0 TX packets:1423 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:256661 (250.6 Kb) TX bytes:1479774 (1.4 Mb) Interrupt:18
This is just an example, your values will vary depending on configuration. The key information you are checking for to make sure the configuration is correct is that the bond0
device has this line:
inet addr:192.168.1.249 Bcast:192.168.1.255 Mask:255.255.255.0
This line should only be visible under bond0
. If there is this line on any of the interfaces included in the bond, you need to go back and make sure the interfaces are set up with 'No IP Address (for Bonding Devices)'. If this line is missing from bond0
, you need to go back and change the bond interface to either 'Dynamic Address' or 'Statically assigned IP Address'.
If you can now connect to your network and the settings are all good under ifconfig
then you are good to go! Enjoy!
Choosing a bonding mode
This information is based on information from Wikipedia. These are the bonding modes available:
- Round-robin policy (mode=balance-rr) (Recommended)
- Transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.
- Active-backup policy (mode=active-backup)
- Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. The bond's MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance. The primary option affects the behaviour of this mode.
- XOR policy (mode=balance-xor)
- Transmit based on [(source MAC address XOR'd with destination MAC address) modulo slave count]. This selects the same slave for each destination MAC address. This mode provides load balancing and fault tolerance.
- Broadcast policy (mode=broadcast)
- Transmits everything on all slave interfaces. This mode provides fault tolerance.
- IEEE 802.3ad Dynamic link aggregation (mode=802.3ad)
- Creates aggregation groups that share the same speed and duplex settings. Utilizes all slaves in the active aggregator according to the 802.3ad specification.
- Adaptive transmit load balancing (mode=balance-tlb)
- Channel bonding that does not require any special switch support. The outgoing traffic is distributed according to the current load (computed relative to the speed) on each slave. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed receiving slave.
- Adaptive load balancing (mode=balance-alb)
- Includes balance-tlb plus receive load balancing (rlb) for IPV4 traffic, and does not require any special switch support. The receive load balancing is achieved by ARP negotiation. The bonding driver intercepts the ARP Replies sent by the local system on their way out and overwrites the source hardware address with the unique hardware address of one of the slaves in the bond such that different peers use different hardware addresses for the server.