2.16 Création et gestion du bonding

De UnixWiki
Aller à : navigation, rechercher

Configuration du bonding

Sous Suse, Redhat, CentOS

 # cat ifcfg-bond0
 BOOTPROTO='static'
 STARTMODE='auto'
 USERCONTROL='no'
 BONDING_MASTER='yes'
 BONDING_MODULE_OPTS='mode=802.3ad miimon=100'
 BONDING_SLAVE0='eth0'
 BONDING_SLAVE1='eth2'
 IPADDR='10.68.82.66/24'
 # cat ifcfg-eth0
 BOOTPROTO='none'
 STARTMODE='auto'
 USERCONTROL='no'
 ETHTOOL_OPTIONS='autoneg on'

Sous Debian

 # cat /etc/network/interfaces
 auto eth0
 auto eth1
 auto bond0
 iface bond0 inet static address 192.168.0.1network 255.255.255.0	gateway 192.168.0.254 up 
 /sbin/ifenslave bond0 eth0 eth1

mode 0 ou équilibrage de charge mode 1 ou sauvegarde active mode 2 ou balance XOR mode 3 ou broadcast mode 4 ou 802.3ad mode 5 ou Traffic load balancing mode 6 ou Adaptive load balancing

Afficher le status du bonding

 # cat /proc/net/bonding/bond0
 Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: IEEE 802.3ad Dynamic link aggregation Transmit Hash Policy: layer2 (0) MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0
802.3ad info LACP rate: slow Aggregator selection policy (ad_select): stable Active Aggregator Info: Aggregator ID: 1 Number of ports: 2 Actor Key: 17 Partner Key: 34476 Partner Mac Address: 00:23:04:ee:bf:2d
Slave Interface: eth0 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 2 Permanent HW addr: d4:ae:52:e8:18:17 Aggregator ID: 1 Slave queue ID: 0
Slave Interface: eth2 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 1 Permanent HW addr: d4:ae:52:e8:18:1b Aggregator ID: 1 Slave queue ID: 0

Afficher la carte slave

(marche pas en LACP, normal...)

 # cat /sys/class/net/bond0/bonding/active_slave
 eth1
 # cat /sys/class/net/bond0/bonding/slaves
 eth0 eth1

Ajouter une carte du bonding

 # ifenslave -c bond0 eth0
 # echo +eth0 > /sys/class/net/bond0/bonding/slaves

Retirer une carte du bonding

 # ifenslave -d bond0 eth0
 # echo -eth0 > /sys/class/net/bond0/bonding/slaves

Module bonding

Le module bonding doit être chargé

 # lsmod | grep bond

Démarrer le bonding

 # /etc/init.d/network start
 Bringing up loopback interface:                            [  OK  ]
 Bringing up interface bond0:                               [  OK  ]
 bonding               139865  0