Teaming your network cards

From LinuxIntro
Jump to: navigation, search

Teaming your network cards, also called bonding, is a measure to ensure the availability of your network. When one card fails, e.g. due to a broken cable, the other card can take over and continue seamlessly.

Here is an example configuration for the SUSE Linux distribution:

/etc/sysconfig/network/ifcfg-bond0

BOOTPROTO='dhcp'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR=''
MTU=''
NAME='Unex ND010'
NETMASK=''
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
UNIQUE='rBUF.H7G5bqPjD8F'
USERCONTROL='no'
_nm_name='bus-pci-0000:02:0c.0'
BONDING_MASTER=yes
BONDING_SLAVE_0='bus-pci-0000:02:0c.0'
BONDING_SLAVE_1='bus-pci-0000:02:0d.0'
BONDING_MODULE_OPTS='miimon=100 mode=1 use_carrier=0'

Bonding cheatSheet

# hwinfo --netcard --short
network:                                                        
  eth0                 Broadcom NetXtreme II BCM5709S Gigabit Ethernet
  eth1                 Broadcom NetXtreme II BCM5709S Gigabit Ethernet
  eth2                 Intel 82599EB 10 Gigabit Dual Port Backplane Connection
  eth3                 Intel 82599EB 10 Gigabit Dual Port Backplane Connection
# ifconfig
bond0     Link encap:Ethernet  HWaddr 00:24:E8:65:5C:62
          inet addr:10.68.204.16  Bcast:10.68.205.255  Mask:255.255.254.0
          inet6 addr: fe80::224:e8ff:fe65:5c62/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:9000  Metric:1
          RX packets:8749827 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3616424 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:32341066615 (30842.8 Mb)  TX bytes:1290907301 (1231.1 Mb)

bond0:foo Link encap:Ethernet  HWaddr 00:24:E8:65:5C:62
          inet addr:192.168.51.6  Bcast:192.168.51.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:9000  Metric:1

eth2      Link encap:Ethernet  HWaddr 00:24:E8:65:5C:62
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:9000  Metric:1
          RX packets:7829884 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3616424 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:32284068709 (30788.4 Mb)  TX bytes:1290907301 (1231.1 Mb)

eth3      Link encap:Ethernet  HWaddr 00:24:E8:65:5C:62
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:9000  Metric:1
          RX packets:919943 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:56997906 (54.3 Mb)  TX bytes:0 (0.0 b)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:164615 errors:0 dropped:0 overruns:0 frame:0
          TX packets:164615 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:39524555 (37.6 Mb)  TX bytes:39524555 (37.6 Mb)

# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.5.0 (November 4, 2008)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth2
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth2
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:24:e8:65:5c:62

Slave Interface: eth3
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:24:e8:65:5c:64
# ifenslave
Usage: ifenslave [-f] <master-if> <slave-if> [<slave-if>...]
       ifenslave -d   <master-if> <slave-if> [<slave-if>...]
       ifenslave -c   <master-if> <slave-if>
       ifenslave --help

See also

  • /usr/src/linux/Documentation/networking/bonding in the kernel source