Bonding & trunking
Le bonding ou teaming permet de faire du failover ou de l'agrégation d'interfaces.
Généralités
Il est nécessaire de définir dans les options à la fois miimon ou arp_interval et arp_ip_target, sinon cela va générer un warning au boot et ne permet pas d'avoir un bonding totalement efficace. Il ne faut pas avoir les options à la fois dans /etc/modprobe.conf et dans /etc/sysconfig/network-scripts/ifcfg-bond0|bond1 (ou autre fichier de configuration des interfaces réseaux). De préférence mettre les options dans la configuration de l'interface
- Dans /etc/modprobe.conf
alias bond0 bonding alias bond1 bonding
- Dans /etc/sysconfig/network-scripts/ifcfg-bond0|1
ifcfg-bond0 : BONDING_OPTS="primary=eth0 mode=1 miimon=100" ifcfg-bond1 : BONDING_OPTS="primary=eth2 mode=1 miimon=100"
Le primary= permet d avoir le mode failback (quand la primary interface revient up, le serveur rebascule dessus)
Bonding sous Centos
On doit configurer les interfaces ethX
[root@veso3folx01 network-scripts]# cat ifcfg-bond0 DEVICE=bond0 BOOTPROTO=static ONBOOT=yes IPADDR=10.80.30.1 NETMASK=255.255.255.128 NETWORK=10.80.30.0 BROADCAST=10.80.30.127 BONDING_OPTS="mode=1 miimon=100" [root@veso3folx01 network-scripts]# cat ifcfg-eth0 DEVICE=eth0 BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes MTU=1500 [root@veso3folx01 network-scripts]# cat ifcfg-eth1 DEVICE=eth1 BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes MTU=1500
Bonding sous Debian
Il faut installer le package ifenslave-2.6. On ne configure pas du tout les interfaces ethX liées au bonding
- /etc/network/interfaces
auto bond0
iface bond0 inet static
address 172.26.15.49
netmask 255.255.255.240
gateway 172.26.15.62
bond-slaves eth0 eth1
bond-mode active-backup
bond-primary eth0
bond-arp_ip_target 172.26.15.62
bond-arp_interval 1000
bond-downdelay 200
bond-updelay 200
- /etc/modprobe.d/aliases-bond.conf
alias bond0 bonding alias bond1 bonding options bond0 primary=eth0 mode=1 arp_interval=1000 arp_ip_target=172.26.15.62 options bond1 primary=eth2 mode=1 arp_interval=1000 arp_ip_target=172.26.15.30