L’ip bonding est une technique permettant d’agréger plusieurs interfaces réseau sous la forme d’une interface réseau virtuelle permettant d’augmenter la bande passante offerte ainsi que de fournir une solution de haute disponibilité.

On fait le nécessaire pour charger le module comme il faut. Pour cela on fait un fichier /etc/modprobe.d/bonding contenant :

alias bond0 bonding
options bonding mode=active-backup miimon=100 downdelay=200 updelay=200

Pour des explications sur les différents paramètres, un simple modinfo bonding fera l’affaire.

Installation des paquets :

# apt-get install ifenslave-2.6

Création d’une interface virtuelle à partir des interfaces eth0 et eth1 :

# ifconfig bond0 192.168.69.50/24 up
# ifenslave bond0 eth0 eth1

Les journaux du noyau sont à ce propos assez explicite sur ce qu’il se passe :

[   89.475954] Ethernet Channel Bonding Driver: v3.2.5 (March 21, 2008)
[   89.476317] bonding: MII link monitoring set to 100 ms
[   89.513622] ADDRCONF(NETDEV_UP): bond0: link is not ready
[   89.574130] eth0: link up, 100Mbps, full-duplex
[   89.590222] bonding: bond0: enslaving eth0 as a backup interface with an up link.
[   89.594131] eth1: link up, 100Mbps, full-duplex
[   89.595283] bonding: bond0: enslaving eth1 as a backup interface with an up link.
[   89.810411] bonding: bond0: link status definitely up for interface eth0.
[   89.810679] bonding: bond0: link status definitely up for interface eth1.
[   89.810893] bonding: bond0: making interface eth0 the new active one.
[   89.811506] bonding: bond0: first active interface up!
[   89.816522] ADDRCONF(NETDEV_CHANGE): bond0: link becomes ready

Le mieux étant de pouvoir automatiser tout ça, sous debian cela se configure dans le fichier /etc/network/interfaces :

auto lo
iface lo inet loopback

auto bond0
iface bond0 inet static
        address 192.168.69.50
        netmask 255.255.255.0
        gateway 192.168.69.254
        up ifenslave bond0 eth0 eth1

auto eth0
iface eth0 inet static
        address 192.168.69.51
        netmask 255.255.255.0
        gateway 192.168.69.254

auto eth1
iface eth1 inet static
        address 192.168.69.52
        netmask 255.255.255.0
        gateway 192.168.69.254