Tolerancia a fallos tarjetas de red (bonding)
Lo ideal en un servidor Ubuntu es tener, al menos, 2 tarjetas de red que hagan o bien balanceo de carga, o tolerancia a fallos o ambas.
En este caso, veremos como obtener el "bonding" en Ubuntu Server.
Para ello, necesitamos, en primer lugar instalar el paquete adecuado:
$ sudo apt-get install ifenslave
Luego, instalamos las dos tarjetas de red físicamente en el servidor (que deben ser wired, no sirven las inalambricas), de modo que cuando hagamos un
$sudo ifconfig
Nos aparezcan las dos (eth0 y eth2 en mí caso).
Editamos el fichero /etc/network/interfaces y lo dejamos tal que así:
# 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
auto bond0
iface bond0 inet dhcp
hwaddress ether "00:1D:60:63:95:53"
slaves eth0 eth2
bond-mode 0
bond-milimon 100
#auto eth0 eth2
donde:
- hwaddress: Es la MAC de una de las tarjetas que representará a las dos
- bond0: será el nombre de la tarjeta de red "virtual" que hará el balanceo de carga y la tolerancia a fallos
- bond-mode: hay de 0 a 6 modos (http://www.howtoforge.com/network_bonding_ubuntu_6.10)
Reiniciamos la red:
$ sudo /etc/init.d/networking restart
Y debería aparecer algo así al hacer de nuevo el ifconfig:
jpcozar@svrubuntu:~$ ifconfig
bond0 Link encap:Ethernet HWaddr 00:1d:60:63:95:53
inet addr:10.71.11.68 Bcast:10.71.11.255 Mask:255.255.252.0
inet6 addr: fe80::21d:60ff:fe63:9553/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:9128 errors:0 dropped:0 overruns:0 frame:0
TX packets:2624 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1756519 (1.7 MB) TX bytes:491603 (491.6 KB)
eth0 Link encap:Ethernet HWaddr 00:1d:60:63:95:53
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:4668 errors:0 dropped:0 overruns:0 frame:0
TX packets:1312 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:881551 (881.5 KB) TX bytes:260576 (260.5 KB)
Interrupt:17
eth2 Link encap:Ethernet HWaddr 00:1d:60:63:95:53
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:4460 errors:0 dropped:0 overruns:0 frame:0
TX packets:1312 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:874968 (874.9 KB) TX bytes:231027 (231.0 KB)
Interrupt:17
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:24 errors:0 dropped:0 overruns:0 frame:0
TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1440 (1.4 KB) TX bytes:1440 (1.4 KB)
page revision: 4, last edited: 07 Apr 2010 14:45