bonding

Ubuntu
安装 ifenslave,用来将 slave 接口 attach/detach 到 bonding 设备:
$ sudo apt-get install ifenslave

$ cat /etc/modprobe.d/bond.conf
alias bond0 bonding
options bonding mode=1 miimon=100

$ cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual

auto eth1
iface eth1 inet manual

auto bond0
iface bond0 inet static
 address 192.168.10.53
 netmask 255.255.255.0
 gateway 192.168.10.254
 bond-slaves eth0 eth1

$ sudo /etc/init.d/networking restart

CentOS
$ cat /etc/modprobe.d/bonding.conf
alias bond0 bonding
options bond0 mode=5 miimon=100

$ pwd
/etc/sysconfig/network-scripts

$ cat ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
IPADDR=192.168.11.17
NETMASK=255.255.255.0
NETWORK=192.168.11.0
USERCTL=no
BOOTPROTO=no

$ cat ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
USERCTL=no
MASTER=bond0
SLAVE=yes
BOOTPROTO=no

$ cat ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
USERCTL=no
MASTER=bond0
SLAVE=yes
BOOTPROTO=no

$ ifconfig
bond0     Link encap:Ethernet  HWaddr 11:11:11:11:11:0F 
          inet addr:192.168.11.17  Bcast:192.168.11.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:12844796 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23873909 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3461648575 (3.2 GiB)  TX bytes:1675766839 (1.5 GiB)

eth0      Link encap:Ethernet  HWaddr 11:11:11:11:11:0F 
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:12844796 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23873909 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3461648575 (3.2 GiB)  TX bytes:1675766839 (1.5 GiB)
          Interrupt:36 Memory:d6000000-d6012800

eth1      Link encap:Ethernet  HWaddr 11:11:11:11:11:11 
          UP BROADCAST SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:0 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:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:48 Memory:d8000000-d8012800

使用过程中出现如下错误:
modprobe: FATAL: Error inserting bonding (/lib/modules/2.6.18-194.17.1.el5/kernel/drivers/net/bonding/bonding.ko): Unknown symbol in module, or unknown parameter

需要开启 ipv6 模块的支持:
$ cat /etc/modprobe.d/disable-ipv6.conf
#install ipv6 /bin/true
#
options ipv6 disable=1

ref:
https://help.ubuntu.com/community/UbuntuBonding
http://sys64738.dk/doku.php?id=interface_bonding