La principal ventaja es que si una interfaz se desonecta, el server continúa recibiendo tráfico de red por la otra interfaz de forma transparente para el sistema operativo y sus aplicaciones.
Configurar una interfaz de bonding es un procedimiento relativamente sencillo, pero que puede resultar complejo si no se tiene en consideración que la configuración varía deacuerdo a la versión de RHEL. Es decir, RHEL 4 es distinto a RHEL 5 y RHEL 6.
Para esta experiencia se muestra la configuración en RHEL 5.3 64 bits.
[root@enoc ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.3 (Tikanga)
[root@enoc ~]# uname -a
Linux tmp-2 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
[root@enoc ~]#
El canal de bonding comprende dos interfaces de red, eth0 y eth1.
Archivos a modificar:
/etc/modprobe.conf
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-eth1
Crear el archivo de bonding
/etc/sysconfig/network-scripts/ifcfg-bond0
Vista de los archivos modificados:
[root@enoc ~]# cat /etc/modprobe.conf
alias bond0 bonding
alias eth0 bnx2
alias eth1 bnx2
alias eth2 bnx2
alias eth3 bnx2
alias scsi_hostadapter cciss
alias scsi_hostadapter1 ata_piix
[root@enoc ~]#
Se añade la siguiente línea para definir el nombre del canal de bonding.
alias bond0 bonding[root@enoc ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
TYPE=bonding
IPADDR=10.187.240.30
NETMASK=255.255.255.0
GATEWAY=10.187.240.1
NM_CONTROLLED=yes
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
BONDING_OPTS="mode=1 miimon=100"
#BONDING_SLAVE0=eth0
#BONDING_SLAVE1=eth1
[root@enoc ~]#
[root@enoc ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
DEVICE=eth0
BOOTPROTO=none
HWADDR=78:E3:B5:13:FA:1C
MASTER=bond0
SLAVE=yes
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
[root@enoc ~]#
[root@enoc ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
# Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
DEVICE=eth1
BOOTPROTO=none
HWADDR=78:E3:B5:13:FA:1E
MASTER=bond0
SLAVE=yes
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
[root@enoc ~]#
Una vez terminada la configuración, se debe reiniciar todo el módulo de red para aplicar los cambios.
[root@enoc network-scripts]# /etc/init.d/network restart
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface bond0: [ OK ]
[root@enoc network-scripts]#
[root@enoc network-scripts]# ifconfig
bond0 Link encap:Ethernet HWaddr 78:E3:B5:13:FA:1C
inet addr:10.187.240.30 Bcast:10.187.240.255 Mask:255.255.255.0
inet6 addr: fe80::7ae3:b5ff:fe13:fa1c/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:28 errors:0 dropped:0 overruns:0 frame:0
TX packets:53 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2122 (2.0 KiB) TX bytes:11859 (11.5 KiB)
eth0 Link encap:Ethernet HWaddr 78:E3:B5:13:FA:1C
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:256 (256.0 b) TX bytes:0 (0.0 b)
Interrupt:170 Memory:f2000000-f2012100
eth1 Link encap:Ethernet HWaddr 78:E3:B5:13:FA:1C
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:24 errors:0 dropped:0 overruns:0 frame:0
TX packets:53 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1866 (1.8 KiB) TX bytes:11859 (11.5 KiB)
Interrupt:178 Memory:f0000000-f0012100
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:548577 errors:0 dropped:0 overruns:0 frame:0
TX packets:548577 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:42866149 (40.8 MiB) TX bytes:42866149 (40.8 MiB)
[root@enoc network-scripts]#
Tip para monitorear el tráfico:
Como mencioné en el articulo "LINUX-Cómo utilizar SAR (System Activity Report)" se puede utilizar el comando SAR para obtener estadísticas actuales e históricas acerca del uso de las interfaces de red:
[root@enoc ~]# sar -n DEV 1 1
Linux 2.6.18-128.el5 (enoc) 09/09/2014
12:00:35 PM IFACE rxpck/s txpck/s rxbyt/s txbyt/s rxcmp/s txcmp/s rxmcst/s
12:00:36 PM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00
12:00:36 PM eth0 0.00 0.00 0.00 0.00 0.00 0.00 0.00
12:00:36 PM eth1 4.00 3.00 360.00 370.00 0.00 0.00 0.00
12:00:36 PM eth2 0.00 0.00 0.00 0.00 0.00 0.00 0.00
12:00:36 PM eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
12:00:36 PM sit0 0.00 0.00 0.00 0.00 0.00 0.00 0.00
12:00:36 PM bond0 4.00 3.00 360.00 370.00 0.00 0.00 0.00
Average: IFACE rxpck/s txpck/s rxbyt/s txbyt/s rxcmp/s txcmp/s rxmcst/s
Average: lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: eth0 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: eth1 4.00 3.00 360.00 370.00 0.00 0.00 0.00
Average: eth2 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: sit0 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: bond0 4.00 3.00 360.00 370.00 0.00 0.00 0.00
[root@enoc ~]#
Fuentes:
http://www.oracle-base.com/articles/linux/nic-channel-bonding.php
http://www.linuxtopia.org/online_books/rhel5/rhel5_administration/rhel5_s1-networkscripts-interfaces.html
http://www.cyberciti.biz/tips/linux-bond-or-team-multiple-network-interfaces-nic-into-single-interface.html
http://www.oracle-base.com/articles/linux/nic-channel-bonding.php
http://www.linuxtopia.org/online_books/rhel5/rhel5_administration/rhel5_s1-networkscripts-interfaces.html
http://www.cyberciti.biz/tips/linux-bond-or-team-multiple-network-interfaces-nic-into-single-interface.html
No hay comentarios:
Publicar un comentario