OSPF con escenario de dos rutas por defecto

Fecha: 21 de marzo del 2023

 

Escenario

 

Este escenario es parte de la saga #233 , #234 y sus primos #107 y #122. Aquí planteamos ¿que pasa si un router ABR (una pata en cada área)

recibe dos rutas por defecto ? una desde el área 0 y otra desde el área 1 ¿balancea carga o alguna tiene prioridad? Fin del asunto.

 

 

Siguiendo la tradición de los dos anteriores, veremos tanto en Packet Tracer como con los equipos reales. A los bifes…(o lo que sea).

 

1.- Generamos ruta por defecto en RT-ASBR:

 

Aquí existía la ruta del escenario #233 pero repetimos el proceso para tener una visión completa del escenario.

 

1.1.- Verificación inicial:

 

RT-ABR#sh ip route

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

 

      10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        10.0.0.0/24 is directly connected, Vlan1000

L        10.0.0.1/32 is directly connected, Vlan1000

O     192.168.0.0/21 is a summary, 00:00:47, Null0

      192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.1.0/24 is directly connected, Vlan1

L        192.168.1.1/32 is directly connected, Vlan1

      192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.3.0/24 is directly connected, Vlan3

L        192.168.3.1/32 is directly connected, Vlan3

      192.168.4.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.4.0/24 is directly connected, Vlan4

L        192.168.4.1/32 is directly connected, Vlan4

      192.168.5.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.5.0/24 is directly connected, Vlan5

L        192.168.5.1/32 is directly connected, Vlan5

      192.168.6.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.6.0/24 is directly connected, Vlan6

L        192.168.6.1/32 is directly connected, Vlan6

      192.168.7.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.7.0/24 is directly connected, Vlan7

L        192.168.7.1/32 is directly connected, Vlan7

      192.168.8.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.8.0/24 is directly connected, Vlan8

L        192.168.8.1/32 is directly connected, Vlan8

RT-ABR#

 

1.2.- Activamos el debug:

 

RT-ABR#debug ip routing

IP routing debugging is on

RT-ABR#

 

1.3.- Generamos una inteface dummy:

 

RT-ASBR#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

RT-ASBR(config)#int loop 0

RT-ASBR(config-if)#ip add 200.0.0.1 255.255.255.255

RT-ASBR(config-if)#exit

RT-ASBR(config)#

 

1.4.- Generamos la ruta por defecto (también dummy):

 

RT-ASBR(config)#ip route 0.0.0.0 0.0.0.0 loop0

%Default route without gateway, if not a point-to-point interface, may impact performance (este mensaje es normal en estas pruebas)

RT-ASBR(config)#

 

1.5.- La redistribuimos en OSPF:

 

RT-ASBR(config)#router ospf 1

RT-ASBR(config-router)#default-information originate

RT-ASBR(config-router)#end

RT-ASBR#

 

1.6.- Resultado del debug:

 

RT-ABR#

Mar 21 15:05:38.501: RT: updating ospf 0.0.0.0/0 (0x0)  :

    via 192.168.1.2 Vl1  0 1048578

 

Mar 21 15:05:38.501: RT: add 0.0.0.0/0 via 192.168.1.2, ospf metric [110/1]

Mar 21 15:05:38.501: RT: default path is now 0.0.0.0 via 192.168.1.2  (la agrega como default porque es la primera)

RT-ABR#

 

1.7.- Captura de Wireshark:

 

 

Frame 5: 98 bytes on wire (784 bits), 98 bytes captured (784 bits)

Ethernet II, Src: 70:81:05:b5:77:82, Dst: 01:00:5e:00:00:05

Internet Protocol Version 4, Src: 192.168.1.2, Dst: 224.0.0.5

Open Shortest Path First

    OSPF Header

        Version: 2

        Message Type: LS Update (4)

        Packet Length: 64

        Source OSPF Router: 192.168.1.2

        Area ID: 0.0.0.1

        Checksum: 0x3e0c [correct]

        Auth Type: Null (0)

        Auth Data (none): 0000000000000000

    LS Update Packet

        Number of LSAs: 1

        LSA-type 5 (AS-External-LSA (ASBR)), len 36

            .000 0000 0000 0001 = LS Age (seconds): 1

            0... .... .... .... = Do Not Age Flag: 0

            Options: 0x20, (DC) Demand Circuits

            LS Type: AS-External-LSA (ASBR) (5)

            Link State ID: 0.0.0.0

            Advertising Router: 192.168.1.2

            Sequence Number: 0x80000001

            Checksum: 0x1c2a

            Length: 36

            Netmask: 0.0.0.0

            1... .... = External Type: Type 2 (metric is larger than any other link state path)

            .000 0000 = TOS: 0

            Metric: 1

            Forwarding Address: 0.0.0.0

            External Route Tag: 1

 

 

2.- Generamos ruta por defecto en RT-Backbone:

 

2.1.- Generamos una inteface dummy:

 

RT-Backbone#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

RT-Backbone(config)#int loop 0

RT-Backbone(config-if)#ip add 190.0.0.1 255.255.255.255

RT-Backbone(config-if)#exit

RT-Backbone(config)#

 

2.2.- Generamos la ruta por defecto (también dummy):

 

RT-Backbone(config)#ip route 0.0.0.0 0.0.0.0 loop0

%Default route without gateway, if not a point-to-point interface, may impact performance (este mensaje es normal en estas pruebas)

RT-Backbone(config)#

 

2.3.- La redistribuimos en OSPF:

 

RT-Backbone(config)#router ospf 1

RT-Backbone(config-router)#default-information originate

RT-Backbone(config-router)#end

RT-Backbone#

 

2.4.- Resultado del debug:

 

RT-ABR#

Mar 21 15:07:31.990: RT: updating ospf 0.0.0.0/0 (0x0)  :

    via 10.0.0.2 Vl1000  0 1048578

 

Mar 21 15:07:31.990: RT: add 0.0.0.0/0 via 10.0.0.2, ospf metric [110/1] (la agrega a la ruta por default)

RT-ABR#

 

 

3.- Verificamos en ABR:

 

Podemos comprobar que el router realizará balanceo de carga independientemente del área que provenga la ruta, ambas con las mismas

AD y métrica. Esta última, en las rutas redistribuídas como en los puntos anteriores será de 1 independientemente de los routers que saltemos

hasta llegar al router que la publica.

¿Cual utilizarán los usuarios que tengan RT-ABR como gateway ? dependiendo del destino del tráfico ambas, y haciendo round-robin en cada

una por cada IP destino. Mismo destino, misma ruta ya cacheada en el CEF.

 

RT-ABR#sh ip route

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 192.168.1.2 to network 0.0.0.0 (sólo porque la aprendió primero)

 

O*E2  0.0.0.0/0 [110/1] via 192.168.1.2, 00:57:02, Vlan1 (vía RT-ASBR)

                          [110/1] via 10.0.0.2, 00:50:48, Vlan1000 (vía RT-Backbone)

      10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        10.0.0.0/24 is directly connected, Vlan1000

L        10.0.0.1/32 is directly connected, Vlan1000

O     192.168.0.0/21 is a summary, 01:57:02, Null0

       192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.1.0/24 is directly connected, Vlan1

L        192.168.1.1/32 is directly connected, Vlan1

     192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.2.0/24 is directly connected, Vlan2

L        192.168.2.1/32 is directly connected, Vlan2

      192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.3.0/24 is directly connected, Vlan3

L        192.168.3.1/32 is directly connected, Vlan3

      192.168.4.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.4.0/24 is directly connected, Vlan4

L        192.168.4.1/32 is directly connected, Vlan4

      192.168.5.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.5.0/24 is directly connected, Vlan5

L        192.168.5.1/32 is directly connected, Vlan5

      192.168.6.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.6.0/24 is directly connected, Vlan6

L        192.168.6.1/32 is directly connected, Vlan6

      192.168.7.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.7.0/24 is directly connected, Vlan7

L        192.168.7.1/32 is directly connected, Vlan7

      192.168.8.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.8.0/24 is directly connected, Vlan8

L        192.168.8.1/32 is directly connected, Vlan8

RT-ABR#

 

 

4.- Solución para que quede una ruta principal y otra de respaldo:

 

4.1.- Modificamos el tipo de ruta OSPF en RT-Backbone:

 

RT-Backbone(config-router)#default-information originate metric-type 1 (por default es type 2)

RT-Backbone(config-router)#end

RT-Backbone#

 

4.2.- Análisis de Wireshark:

 

 

Frame 46: 98 bytes on wire (784 bits), 98 bytes captured (784 bits)

Ethernet II, Src: 88:f0:31:7e:21:e0, Dst: 01:00:5e:00:00:05

Internet Protocol Version 4, Src: 10.0.0.2, Dst: 224.0.0.5

Open Shortest Path First

    OSPF Header

        Version: 2

        Message Type: LS Update (4)

        Packet Length: 64

        Source OSPF Router: 10.0.0.2

        Area ID: 0.0.0.0 (Backbone)

        Checksum: 0xf7b3 [correct]

        Auth Type: Null (0)

        Auth Data (none): 0000000000000000

    LS Update Packet

        Number of LSAs: 1

        LSA-type 5 (AS-External-LSA (ASBR)), len 36

            .000 0000 0000 0001 = LS Age (seconds): 1

            0... .... .... .... = Do Not Age Flag: 0

            Options: 0x20, (DC) Demand Circuits

            LS Type: AS-External-LSA (ASBR) (5)

            Link State ID: 0.0.0.0

            Advertising Router: 10.0.0.2

            Sequence Number: 0x80000001

            Checksum: 0x51d5

            Length: 36

            Netmask: 0.0.0.0

            0... .... = External Type: Type 1 (metric is specified in the same units as interface cost)

            .000 0000 = TOS: 0

            Metric: 1 (a esta métrica le suma 1 que es el costo de la interface)

            Forwarding Address: 0.0.0.0

            External Route Tag: 1

 

4.3.- Resultado del debug:

 

RT-ABR#

Mar 21 15:18:20.910: RT: updating ospf 0.0.0.0/0 (0x0)  :

    via 10.0.0.2 Vl1000  0 1048578

 

Mar 21 15:18:20.910: RT: closer admin distance for 0.0.0.0, flushing 2 routes (elimina las dos rutas anteriores)

Mar 21 15:18:20.910: RT: add 0.0.0.0/0 via 10.0.0.2, ospf metric [110/2] (agrega la ruta con métrica 2)

RT-ABR#

 

4.4.- Verificamos:

 

Al modificar el tipo de ruta OSPF (external type-2 a external type-1) se altera la métrica en 2 (1 + 1 salto a RT-Backbone), asi y todo

esto es preferible por OSPF como más confiable, ya que muestra el costo real, a diferencia del type-2 que siempre es 1.

 

Otro detalle es que la elección de este tipo de ruta es independiente del área que provenga.

 

 

 

RT-ABR#sh ip route

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 10.0.0.2 to network 0.0.0.0

 

O*E1  0.0.0.0/0 [110/2] via 10.0.0.2, 00:01:14, Vlan1000 (vía RT-Backbone)

      10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        10.0.0.0/24 is directly connected, Vlan1000

L        10.0.0.1/32 is directly connected, Vlan1000

O     192.168.0.0/21 is a summary, 01:59:22, Null0

      192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.1.0/24 is directly connected, Vlan1

L        192.168.1.1/32 is directly connected, Vlan1

      192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.2.0/24 is directly connected, Vlan2

L        192.168.2.1/32 is directly connected, Vlan2

      192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.3.0/24 is directly connected, Vlan3

L        192.168.3.1/32 is directly connected, Vlan3

      192.168.4.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.4.0/24 is directly connected, Vlan4

L        192.168.4.1/32 is directly connected, Vlan4

      192.168.5.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.5.0/24 is directly connected, Vlan5

L        192.168.5.1/32 is directly connected, Vlan5

      192.168.6.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.6.0/24 is directly connected, Vlan6

L        192.168.6.1/32 is directly connected, Vlan6

      192.168.7.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.7.0/24 is directly connected, Vlan7

L        192.168.7.1/32 is directly connected, Vlan7

      192.168.8.0/24 is variably subnetted, 2 subnets, 2 masks

C        192.168.8.0/24 is directly connected, Vlan8

L        192.168.8.1/32 is directly connected, Vlan8

RT-ABR#

 

 

5.- Resumen:

 

Podemos confirmar estos resultados mediante el RFC que describe el funcionamiento mismo del OSPF.

 

RFC 2328 Section 16.4 Calculating AS external routes (https://www.rfc-editor.org/rfc/rfc2328#page-173)

 

 

(6) (b) Type 1 external paths are always preferred over type 2 external paths.

 

A type 1 route has a more accurate path info since it adds the costs on links inside the OSPF network to the cost of the external link.

A type 2 route only has the cost of the external link no matter how many links it passes through in the internal network. So generally,

a type-1 route will have a higher cost than a type 2 route anyway and routers in the OSPF network will prefer the type-1 route.

 

 

6.- Otro punto de vista:

 

OSPF-running routers use these criteria to select the best route to be installed in the routing table:

 

When there are multiple routes available to the same network with different route types, routers use this order of preference (from highest to lowest):

 

Intra-area routes

Inter-area routes

External Type-1 routes

External Type-2 routes

 

If there are multiple routes to a network with the same route type, the OSPF metric calculated as cost based on the bandwidth is used for selecting

the best route. The route with the lowest value for cost is chosen as the best route.

If there are multiple routes to a network with the same route type and cost, it chooses all the routes to be installed in the routing table, and the router

does equal cost load balancing across multiple paths.

 

Fuente: cisco.com

 

(2023) El peor camino a la cueva del perico…

Rosario, Argentina