Configuración
del Team/bond en las tarjetas de red
1. Creación del dispositivo de bonding (bond0)
Por defecto en los sistema operativos Red Hat Enterprise, la configuración de red se encuentra en el directorio /etc/sysconfig/network-script, lo primero que se debe realizar es crear un archivo llamado
ifcfg-bond0
con la información IP
[root@dbdwh01 ~]# vi
/etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.1.20
NETWORK=192.168.1.0
NETMASK=255.255.255.0
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
2. Modificar los archivos de configuración de las tarjetas eth0 y eth1
Una vez creado el
archivo, se deben configurar las tarjetas de red que aran parte del
bonding, para ello se deben configurar los archivos ifcfg-eth0 y
ifcfg-eth1 indicando que el MASTER sera el bond0
[root@dbdwh01 ~]# vi
/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
[root@dbdwh01 ~]# vi
/etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
3. Cargar el modulo/driver del bonding
Se debe garantizar que el
modulo del bonding se cargue en el kernel y este asociado al
dispositivo de bond0 creado en el paso numero 1
Adicionar las siguientes
lineas al final del archivo /etc/modprobe.conf
[root@dbdwh01 ~]#
vi /etc/modprobe.conf
alias bond0
bonding
options bond0
mode=balance-alb miimon=100
4. Iniciar servicio de red con bonding
Una vez se reinicie el
servicio el modulo iniciara automáticamente, pero habilitar el
modulo de inmediato se deben ejecutar los siguientes comandos:
[root@dbdwh01 ~]#
modprobe bonding
[root@dbdwh01 ~]#
service network restart
5. Probar el servicio
Para realizar las pruebas
del servicio basta con mantener un ping sostenido sobre la dirección
IP configurada en el dispositivo bond0 y desconectar manualmente una
de las tarjetas, el ping debería mantenerse (es probable detectar
algunos milisegundos de mas sobre el ping al momento de desconectar
una de la interfaces)
6. verificar el estado del bonding
Dentro del archivo de
/proc/net/bonding/bond0 podrá encontrar información adicionar sobre
el modo de funcionamiento, las interfaces incluidas, la velocidad
entre otros
[root@dbdwh01 ~]# cat
/proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.4.0-1 (October 7, 2008)
Ethernet Channel Bonding Driver: v3.4.0-1 (October 7, 2008)
Bonding Mode: adaptive load
balancing
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: e4:1f:13:ff:35:48
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: e4:1f:13:ff:35:48
Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 2
Permanent HW addr: e4:1f:13:ff:35:4a
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 2
Permanent HW addr: e4:1f:13:ff:35:4a
7. Tipos de bonding
Para verificar que tipo
de bonding se va a utilizar, es necesario tener en cuenta la
configuración del switch y que modo es el que se desea, en este el
modo es balance-tlb (modo 5) el cual se indico en el archivo
/etc/modprobe.conf y que
también se puede verificar con el siguiente comando:
[root@dbdwh01
~]#
more /sys/class/net/bond0/bonding/mode
balance-alb 6
balance-alb 6
Por ultimo dejo los
diferentes tipos de bonding
mode=1 (active-backup)
Active-backup policy:
Only one slave in the bond is active. A different slave becomes
active if, and only if, the active slave fails. The bond's MAC
address is externally visible on only one port (network adapter) to
avoid confusing the switch. This mode provides fault tolerance. The
primary option affects the behavior of this mode.
mode=2
(balance-xor)
XOR policy: Transmit
based on [(source MAC address XOR'd with destination MAC address)
modulo slave count]. This selects the same slave for each destination
MAC address. This mode provides load balancing and fault tolerance.
mode=3 (broadcast)
Broadcast policy:
transmits everything on all slave interfaces. This mode provides
fault tolerance.
mode=4 (802.3ad)
IEEE 802.3ad Dynamic link
aggregation. Creates aggregation groups that share the same speed and
duplex settings. Utilizes all slaves in the active aggregator
according to the 802.3ad specification.
Prerequisites:
Ethtool support in the
base drivers for retrieving the speed and duplex of each slave.
A switch that supports
IEEE 802.3ad Dynamic link aggregation. Most switches will require
some type of configuration to enable 802.3ad mode.
mode=5
(balance-tlb)
Adaptive transmit load
balancing: channel bonding that does not require any special switch
support. The outgoing traffic is distributed according to the current
load (computed relative to the speed) on each slave. Incoming traffic
is received by the current slave. If the receiving slave fails,
another slave takes over the MAC address of the failed receiving
slave.
Prerequisite: Ethtool
support in the base drivers for retrieving the speed of each slave.
Grandisimo aporte, buscaba esto exactamente, tengo que probarlo todavia pero Gracias!!
ResponderEliminarMuchas gracias por esta página. Me ha aclarado muchas dudas. Sólo tengo una: si tenemos dos tarjetas de red con su IP, etc y deseo establecer el bonding entre ellas, ¿necesitaría nuevas Ip, máscara etc o podría utilizar las ya existentes?
ResponderEliminarGracias.