Mostrando entradas con la etiqueta bridge. Mostrar todas las entradas
Mostrando entradas con la etiqueta bridge. Mostrar todas las entradas

viernes, 4 de mayo de 2012

Bridges, bonding y LACP

Vamos a ver como configurar las interfaces de red en modo bridge, utilizando interfaces conectadas a dos switches distintos para aumentar la disponibilidad del sistema y en modo bonding LACP para aumentar el ancho de banda total de esa conexión.
Además veremos la configuración específica de los switches.

Primer servidor con Ubuntu 12.04, vamos a configurar dos bondings y un bridge con 6 interfaces en total (eth0 hasta eth5).
El esquema de conexión es el siguiente:


Necesitamos tener instalados algunos paquetes:
# aptitude install bridge-utils ifenslave-2.6

Modificamos el fichero /etc/network/interfaces:
auto br0
iface br0 inet static

address 192.168.164.21
netmask 255.255.255.0
network 192.168.164.0
broadcast 192.168.164.255
gateway 192.168.164.1
# # dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.100.182 192.168.100.189 192.168.100.183
dns-search rubensalazar.net

bridge_ports eth0 eth1
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp on

Reiniciamos el servicio de red:
# /etc/init.d/networking restart

Podemos comprobar si ha funcionado :
# brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.001b78976e50       yes             eth0
                                                                             eth1
La configuración en los switches es idéntica en los dos, con un show run vemos la configuración de esa interfaz:
interface GigabitEthernet0/6
 switchport access vlan 7
 switchport mode access
 spanning-tree portfast

Pasamos a configurar los bondings, añadimos en el fichero /etc/network/interfaces:

auto bond0
iface bond0 inet static
slaves eth2 eth3
bond_mode 4
bond_miimon 100
bond_updelay 200
bond_downdelay 200
address 10.0.1.21
netmask 255.255.255.0
auto bond1
iface bond1 inet static
slaves eth4 eth5
bond_mode 4
bond_miimon 100
bond_updelay 200
bond_downdelay 200
address 10.0.2.21
netmask 255.255.255.0
auto eth2
iface eth2 inet manual
          bond-master bond0
auto eth3
iface eth3 inet manual
           bond-master bond0

auto eth4
iface eth4 inet manual
           bond-master bond1

auto eth5
iface eth5 inet manual
          bond-master bond1

El modo 4 indica el tipo de bonding que configuramos, podéis encontrar más información en:
http://en.wikipedia.org/wiki/Link_Aggregation_Control_Protocol#Link_Aggregation_Control_Protocol
http://systemadmin.es/2009/04/los-modos-de-bonding

Volvemos a reiniciar el servicio de red y comprobamos que funcionan:
# 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): 200
Down Delay (ms): 200


802.3ad info
LACP rate: slow
Min links: 0
Aggregator selection policy (ad_select): stable
Active Aggregator Info:
Aggregator ID: 1
Number of ports: 2
Actor Key: 17
Partner Key: 2
Partner Mac Address: 00:19:e8:e8:02:00


Slave Interface: eth2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:26:55:d8:b5:99
Aggregator ID: 1
Slave queue ID: 0


Slave Interface: eth3
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:26:55:d8:b5:9b
Aggregator ID: 1
Slave queue ID: 0

# cat /proc/net/bonding/bond1
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): 200
Down Delay (ms): 200


802.3ad info
LACP rate: slow
Min links: 0
Aggregator selection policy (ad_select): stable
Active Aggregator Info:
Aggregator ID: 1
Number of ports: 2
Actor Key: 17
Partner Key: 2
Partner Mac Address: 00:1e:14:db:05:80


Slave Interface: eth4
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:26:55:d8:b5:98
Aggregator ID: 1
Slave queue ID: 0


Slave Interface: eth5
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:26:55:d8:b5:9a
Aggregator ID: 1
Slave queue ID: 0

La configuración de los switches es más compleja, definimos dos port channels, uno por cada red:
interface Port-channel1
 switchport access vlan 8
 switchport mode access
 spanning-tree portfast
!
interface Port-channel2
 switchport access vlan 9
 switchport mode access
 spanning-tree portfast
interface GigabitEthernet0/7
 switchport access vlan 8
 switchport mode access
 channel-group 1 mode active
 spanning-tree portfast
!
interface GigabitEthernet0/8
 switchport access vlan 8
 switchport mode access
 channel-group 1 mode active
 spanning-tree portfast
!
interface GigabitEthernet0/9
 switchport access vlan 9
 switchport mode access
 channel-group 2 mode active
 spanning-tree portfast
!
interface GigabitEthernet0/10
 switchport access vlan 9
 switchport mode access
 channel-group 2 mode active
 spanning-tree portfast