Configuramos el archivo: /etc/network/interfaces
/etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface #allow-hotplug eth0 #iface eth0 inet dhcp #auto eth0 #iface eth0 inet dhcp #auto eth1 #iface eth1 inet dhcp auto bond0 iface bond0 inet static address 10.104.0.10 netmask 255.255.248.0 gateway 10.104.0.1 slaves eth0 eth1 bond_mode balance-rr bond_miimon 100 bond_downdelay 200 bond_updelay 200
Reiniciamos las interfaces:
/etc/init.d/networking restart
Leemos el siguiente archivo para saber el estado del bonding creado:
cat /proc/net/bonding/bond0
cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: load balancing (round-robin) MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 200 Down Delay (ms): 200 Slave Interface: eth0 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: c8:60:00:c0:b9:9b Slave queue ID: 0 Slave Interface: eth1 MII Status: down Speed: 10 Mbps Duplex: half Link Failure Count: 3 Permanent HW addr: 00:1c:f0:9c:62:58 Slave queue ID: 0
Modo Tolerancia Balanceo Descripción 0 Sí Sí [balance-rr] Balanceo Round-Robin 1 Sí No [active-backup] Backup Activo 2 Sí Sí [balance-xor] Según MAC 3 Sí No [broadcast] 4 Sí Sí [802.3ad] Crea grupos esclavos con la misma configuración 5 Sí Sí [balance-tlb] Transmit Load Balancing 6 Sí Sí [balance-alb] Adaptative Load Balancing (con una única MAC)
El siguiente código esta hecho en perl y sirve para consultar el estado del bonding:
https://github.com/ankkzz/getBondStatus/
Sino tenemos el siguiente script que te saca de apuros, que postearon en serverfault:
if [ `grep -c down /proc/net/bonding/bond0` -eq 1 ]; then echo "`date +%c`" | \ mail -s "$(grep -B1 down /proc/net/bonding/bond0 | head -1 | \ awk -F': ' '{ print $2 }') is down" your@email.address fi
Fuente:
http://kudithipudi.org/2010/07/30/how-to-check-status-of-bond-interface-in-linux/
https://github.com/ankkzz/getBondStatus/blob/master/getBondStatus
http://serverfault.com/questions/312207/how-do-people-monitor-the-status-of-bonding-slave-interfaces-on-linux
HOW TO: Bonding en Debian