Bonding & trunking

De BlaxWiki
Aller à la navigationAller à la recherche


Le bonding ou teaming permet de faire du failover ou de l'agrégation d'interfaces.

Généralités

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)

  • 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 Debian

Il faut installer le package ifenslave-2.6.

  • /etc/network/interfaces file
auto bond0
iface bond0 inet static
   address 10.31.1.5
   netmask 255.255.255.0
   network 10.31.1.0
   gateway 10.31.1.254
   slaves eth0 eth1
   bond-mode active-backup
   bond-miimon 100
   bond-downdelay 200
   bond-updelay 200
  • /etc/modprobe.d/aliases-bond.conf
alias bond0 bonding
options bonding mode=1 arp_interval=2000 arp_ip_target=192.168.3.1

/etc/network/interfaces:
------------------------

# The primary network interface
#auto eth0
#iface eth0 inet static
#       address 212.43.195.133
#       netmask 255.255.255.0
#       network 212.43.195.0
#       broadcast 212.43.195.255
#       gateway 212.43.195.1
#       # dns-* options are implemented by the resolvconf package, if installed
#       dns-nameservers 212.43.194.2 212.43.194.3
#       dns-search co.fr.clara.net

auto bond0
iface bond0 inet static
       address 212.43.220.45
       netmask 255.255.255.0
       gateway 212.43.220.1
       pre-up ifconfig eth0 up
       pre-up ifconfig eth1 up
       up ifenslave bond0 eth0 eth1
       down ifenslave -d bond0 eth0 eth1
       post-down ifconfig eth0 down
       post-down ifconfig eth1 down
       dns-nameservers 212.43.194.2 212.43.194.3
       dns-search co.fr.clara.net

/etc/modules:
-------------
bonding mode=4 miimon=100

ifconfig -a:
------------

bond0     Lien encap:Ethernet  HWaddr 00:14:85:29:BE:22           inet adr:212.43.220.45  Bcast:212.43.220.255  Masque:255.255.255.0
         UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
         RX packets:540669 errors:0 dropped:0 overruns:0 frame:0
         TX packets:278688 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 lg file transmission:0          RX bytes:794712182 (757.8 MiB)  TX bytes:20612336 (19.6 MiB)

eth0      Lien encap:Ethernet  HWaddr 00:14:85:29:BE:22           UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
         RX packets:258810 errors:0 dropped:0 overruns:0 frame:0
         TX packets:278630 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 lg file transmission:1000          RX bytes:376450410 (359.0 MiB)  TX bytes:20604912 (19.6 MiB)
         Interruption:16
eth1      Lien encap:Ethernet  HWaddr 00:14:85:29:BE:22           UP BROADCAST RUNNING NOARP SLAVE MULTICAST  MTU:1500  Metric:1
         RX packets:281859 errors:0 dropped:0 overruns:0 frame:0
         TX packets:58 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 lg file transmission:1000          RX bytes:418261772 (398.8 MiB)  TX bytes:7424 (7.2 KiB)
         Interruption:17