Haute disponibilité et agrégation de cartes réseau sous Linux
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
Commentaires
Bonjour,
J’ai trouvé tes articles intéressants, puisqu’à peu de choses près il semblerait qu’on ai la même architecture réseau [Free avec un OPENWRT]. Et de ce fait je souhaiterai savoir si tu as réussi à mettre 2 interfaces de l’OPENWRT en bonding, afin de faire de l’agrégat de liens. merci d’avance.
Jim
Salut Julien, Ah dommage pour ton routeur. Moi j’ai dernièrement acquis un Buffalo WZR-HP-G300NH j’en suis super content, et compte tenu de ce qu’il a comme ressources disponibles, je pense que je vais tester l’ethernet bonding. Enfin bref ! En tout cas merci pour tes articles qui sont intéressants.
Jim