Balanceo de carga en EIGRP
Al igual que otros IGP, EIGRP permite el balanceo de carga cuando conoce la misma red por varios vecinos, y esta posee el mismo costo en todas estas. Esto es conocido como enrutamiento equal-cost multipath (ECMP, o enrutamiento de múltiples rutas del mismo costo).
Por defecto, en plataformas IOS vienen habilitadas un máximo de 4 rutas para hacer balanceo de carga (se permiten tener 4 rutas del mismo costo), la cual puede aumentar hasta un máximo de 32 ECMP por prefijos (redes).
La topología a usar para validar esto, es la siguiente:
Lo primero que hacemos es configurar EIGRP en cada router.
R1:
R1(config)#router eigrp 12345 R1(config-router)#no auto-summary R1(config-router)#net 192.168.12.1 0.0.0.0 R1(config-router)#net 192.168.13.1 0.0.0.0 R1(config-router)#net 192.168.14.1 0.0.0.0
R2:
R2(config)#router eigrp 12345 R2(config-router)#no auto-summary R2(config-router)#net 192.168.12.2 0.0.0.0 R2(config-router)# *Jan 5 21:28:21.359: %DUAL-5-NBRCHANGE: EIGRP-IPv4 12345: Neighbor 192.168.12.1 (FastEthernet0/0) is up: new adjacency R2(config-router)#net 192.168.25.2 0.0.0.0
R3:
R3(config)#router eigrp 12345 R3(config-router)#no auto-summary R3(config-router)#net 192.168.13.2 0.0.0.0 R3(config-router)# *Jan 5 21:29:28.123: %DUAL-5-NBRCHANGE: EIGRP-IPv4 12345: Neighbor 192.168.13.1 (FastEthernet0/0) is up: new adjacency R3(config-router)#net 192.168.35.2 0.0.0.0
R4:
R4(config)#router eigrp 12345 R4(config-router)#no auto-summary R4(config-router)#net 192.168.14.2 0.0.0.0 R4(config-router)# *Jan 5 21:30:22.955: %DUAL-5-NBRCHANGE: EIGRP-IPv4 12345: Neighbor 192.168.14.1 (Serial1/1) is up: new adjacency R4(config-router)#net 192.168.45.2 0.0.0.0
R5:
R5(config)#router eigrp 12345 R5(config-router)#no auto-summary R5(config-router)#net 192.168.25.1 0.0.0.0 R5(config-router)# *Jan 5 21:31:31.967: %DUAL-5-NBRCHANGE: EIGRP-IPv4 12345: Neighbor 192.168.25.2 (Serial1/0) is up: new adjacency R5(config-router)#net 192.168.35.1 0.0.0.0 R5(config-router)# *Jan 5 21:31:38.219: %DUAL-5-NBRCHANGE: EIGRP-IPv4 12345: Neighbor 192.168.35.2 (Serial1/1) is up: new adjacency R5(config-router)#net 192.168.45.1 0.0.0.0 R5(config-router)# *Jan 5 21:31:45.663: %DUAL-5-NBRCHANGE: EIGRP-IPv4 12345: Neighbor 192.168.45.2 (Serial1/2) is up: new adjacency R5(config-router)#net 5.5.5.5 0.0.0.0
Como se comentó, por defecto las plataformas que usan IOS tienen configurados un máximo de 4 ECMP:
R1#sh ip protocols *** IP Routing is NSF aware *** Routing Protocol is "eigrp 12345" Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Default networks flagged in outgoing updates Default networks accepted from incoming updates EIGRP-IPv4 Protocol for AS(12345) Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 NSF-aware route hold timer is 240 Router-ID: 192.168.14.1 Topology : 0 (base) Active Timer: 3 min Distance: internal 90 external 170 Maximum path: 4 Maximum hopcount 100 Maximum metric variance 1 Automatic Summarization: disabled Maximum path: 4 Routing for Networks: 192.168.12.1/32 192.168.13.1/32 192.168.14.1/32 Routing Information Sources: Gateway Distance Last Update 192.168.14.2 90 00:10:39 192.168.12.2 90 00:10:39 192.168.13.2 90 00:10:39 Distance: internal 90 external 170
Para poder modificar este valor, es necesario utilizar el comando maximum-paths en la configuración de EIGRP:
R1(config)#router eigrp 12345 R1(config-router)#maximum-paths ? <1-32> Number of paths R1(config-router)#maximum-paths 10 R1(config-router)#do sh ip pro *** IP Routing is NSF aware *** Routing Protocol is "eigrp 12345" Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Default networks flagged in outgoing updates Default networks accepted from incoming updates EIGRP-IPv4 Protocol for AS(12345) Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 NSF-aware route hold timer is 240 Router-ID: 192.168.14.1 Topology : 0 (base) Active Timer: 3 min Distance: internal 90 external 170 Maximum path: 10 Maximum hopcount 100 Maximum metric variance 1 Automatic Summarization: disabled Maximum path: 10 Routing for Networks: 192.168.12.1/32 192.168.13.1/32 192.168.14.1/32 Routing Information Sources: Gateway Distance Last Update 192.168.14.2 90 00:00:07 192.168.12.2 90 00:00:07 192.168.13.2 90 00:00:07 Distance: internal 90 external 170
Por lo tanto, el máximo de rutas de igual costo que se pueden instalar en la RIB (Routing Information Base, o tabla de enrutamiento), se puede modificar, llegando hasta un máximo de 32.
En esta topología, se tienen dos rutas con el mismo costo:
R1#sh ip ro eigrp Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP + - replicated route, % - next hop override Gateway of last resort is not set 5.0.0.0/24 is subnetted, 1 subnets D 5.5.5.0 [90/2300416] via 192.168.13.2, 00:13:07, FastEthernet2/0 [90/2300416] via 192.168.12.2, 00:13:07, FastEthernet0/0 D 192.168.25.0/24 [90/2172416] via 192.168.12.2, 00:13:07, FastEthernet0/0 D 192.168.35.0/24 [90/2172416] via 192.168.13.2, 00:13:07, FastEthernet2/0 D 192.168.45.0/24 [90/2681856] via 192.168.14.2, 00:13:07, Serial1/0
Pero a diferencia de otros protocolos de enrutamiento, EIGRP también soporta balanceo de carga con rutas de costo distinto (unequal-cost multipath, UCMP), permitiendo instalar rutas de los sucesores y los sucesores factibles (FS):
R1#sh ip eigrp topology EIGRP-IPv4 Topology Table for AS(12345)/ID(192.168.14.1) Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, r - reply Status, s - sia Status P 192.168.25.0/24, 1 successors, FD is 2172416 via 192.168.12.2 (2172416/2169856), FastEthernet0/0 P 192.168.35.0/24, 1 successors, FD is 2172416 via 192.168.13.2 (2172416/2169856), FastEthernet2/0 P 192.168.12.0/24, 1 successors, FD is 28160 via Connected, FastEthernet0/0 P 5.5.5.0/24, 2 successors, FD is 2300416 via 192.168.12.2 (2300416/2297856), FastEthernet0/0 via 192.168.13.2 (2300416/2297856), FastEthernet2/0 via 192.168.14.2 (2809856/2297856), Serial1/0 P 192.168.45.0/24, 1 successors, FD is 2681856 via 192.168.14.2 (2681856/2169856), Serial1/0 P 192.168.13.0/24, 1 successors, FD is 28160 via Connected, FastEthernet2/0 P 192.168.14.0/24, 1 successors, FD is 2169856 via Connected, Serial1/0
Para lograr esto, es necesario modificar el multiplicador variance.
El valor del variance es la multiplicación de la distancia factible (FD) con el multiplicador variance, donde por defecto, el multiplicador variance está configurado en 1.
Entonces, si hacemos el cálculo del valor del variance, quedaría lo siguiente:
2300416 * 1 = 2300416
Lo que significa, que se permite hacer balanceo de carga con rutas que tengan una métrica (FD) de 2300416.
Ahora, si el multiplicador variancia lo cambiamos a 2, podemos incorporar la ruta a través de R4, debido que ahora el valor del variance es:
2300416 * 2 = 4600832
Donde podemos apreciar que la métrica por R4 (2809856) se encuentra dentro del valor del variance.
Para configurar esto, es necesario ir a la configuración de EIGRP:
R1(config)#router eigrp 12345 R1(config-router)#variance ? <1-128> Metric variance multiplier R1(config-router)#variance 2
Para validar el valor configurado, usamos el comando show ip protocols:
R1#sho ip protocols | in variance
Maximum metric variance 2
Y si ahora vemos la RIB, podremos ver que se tienen las 3 rutas instaladas:
R1#sh ip ro eigrp Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP + - replicated route, % - next hop override Gateway of last resort is not set 5.0.0.0/24 is subnetted, 1 subnets D 5.5.5.0 [90/2809856] via 192.168.14.2, 00:03:26, Serial1/0 [90/2300416] via 192.168.13.2, 00:03:26, FastEthernet2/0 [90/2300416] via 192.168.12.2, 00:03:26, FastEthernet0/0 D 192.168.25.0/24 [90/2172416] via 192.168.12.2, 00:03:26, FastEthernet0/0 D 192.168.35.0/24 [90/2172416] via 192.168.13.2, 00:03:26, FastEthernet2/0 D 192.168.45.0/24 [90/2681856] via 192.168.14.2, 00:03:26, Serial1/0
Pero lo que se pueden estar preguntado, una vez configurado el variance, es si el balanceo de carga entre cada ruta es igual (el primer paquete se envía por el vecino 192.168.14.2, luego el segundo por el vecino 192.168.13.2 y el tercer por el vecino 192.168.12.2, y así sucesivamente).
El tema, es que como tenemos rutas con distintos costos, el balanceo de carga que viene configurado por defecto en EIGRP, hace que se envíen más paquetes por los enlaces con mejor métrica que por los enlaces de peor métrica.
Para saber el tipo de balanceo de carga que viene activado por defecto en EIGRP, usamos el siguiente comando:
R1#sh run all | sec router eigrp router eigrp 12345 timers active-time 3 timers graceful-restart purge-time 240 metric maximum-hops 100 metric weights 0 1 0 1 0 0 traffic-share balanced maximum-paths 10 variance 2 network 192.168.12.1 0.0.0.0 network 192.168.13.1 0.0.0.0 network 192.168.14.1 0.0.0.0 distance eigrp 90 170 no auto-summary no passive-interface default eigrp log-neighbor-changes eigrp log-neighbor-warnings 10 eigrp event-log-size 500 no shutdown
Y si usamos el comando show ip route para ver la red específica aprendida por EIGRP, podemos observar que tiene un parámetro llamado traffic share count:
R1#sh ip ro 5.5.5.0 Routing entry for 5.5.5.0/24 Known via "eigrp 12345", distance 90, metric 2300416, type internal Redistributing via eigrp 12345 Last update from 192.168.14.2 on Serial1/0, 09:22:56 ago Routing Descriptor Blocks: 192.168.14.2, from 192.168.14.2, 09:22:56 ago, via Serial1/0 Route metric is 2809856, traffic share count is 49 Total delay is 45000 microseconds, minimum bandwidth is 1544 Kbit Reliability 255/255, minimum MTU 1500 bytes Loading 1/255, Hops 2 192.168.13.2, from 192.168.13.2, 09:22:56 ago, via FastEthernet2/0 Route metric is 2300416, traffic share count is 60 Total delay is 25100 microseconds, minimum bandwidth is 1544 Kbit Reliability 255/255, minimum MTU 1500 bytes Loading 1/255, Hops 2 * 192.168.12.2, from 192.168.12.2, 09:22:56 ago, via FastEthernet0/0 Route metric is 2300416, traffic share count is 60 Total delay is 25100 microseconds, minimum bandwidth is 1544 Kbit Reliability 255/255, minimum MTU 1500 bytes Loading 1/255, Hops 2
Aquí se especifica que los primeros 49 paquetes serán enviados por el vecino 192.168.14.2, luego los siguientes 60 a través de 192.168.13.2 y los otros 60 a través de 192.168.12.2, y luego se repite lo mismo.
Pero, ¿cómo EIGRP calcula esto?
La respuesta es que, al igual que como calcula su métrica, existe una fórmula matemática para obtener este ratio. A continuación, mostraré sin mucho detalle, cómo se calcula este valor:
La principal fórmula es dividiendo la mejor métrica, con la peor, y luego multiplicándola por 240:
2300416 / 2809856 * 240 = 196.4868804665 ≈ 196
2300416 / 2300416 * 240 = 240
Luego se obtiene el máximo común divisor de estos números, en este caso es 4, y luego estos valores son divididos por el MCD:
196 / 4 = 49
240 / 4 = 60
Por lo tanto, en caso de que tengamos varias rutas con el mismo costo, el valor traffic share count es 1:
R1#sh ip ro 5.5.5.0 Routing entry for 5.5.5.0/24 Known via "eigrp 12345", distance 90, metric 2300416, type internal Redistributing via eigrp 12345 Last update from 192.168.13.2 on FastEthernet2/0, 00:00:11 ago Routing Descriptor Blocks: * 192.168.13.2, from 192.168.13.2, 00:00:11 ago, via FastEthernet2/0 Route metric is 2300416, traffic share count is 1 Total delay is 25100 microseconds, minimum bandwidth is 1544 Kbit Reliability 255/255, minimum MTU 1500 bytes Loading 1/255, Hops 2 192.168.12.2, from 192.168.12.2, 00:00:11 ago, via FastEthernet0/0 Route metric is 2300416, traffic share count is 1 Total delay is 25100 microseconds, minimum bandwidth is 1544 Kbit Reliability 255/255, minimum MTU 1500 bytes Loading 1/255, Hops 2