Cuantas rutas se pueden anunciar en un solo update BGP

Fecha: Septiembre del 2023

 

Escenario

 

Este laboratorio analiza cuantas rutas se pueden anunciar o mejor dicho, cuantas rutas entran en un solo

update BGP al intercambiar rutas con su vecino.

 

¿Este dato es relevante? sólo en casos donde exista fragmentación y su problemática asociada, o para otro

 laboratorio donde se estimen cuantos paquetes (tramas/paquetes/segmentos) se necesitan para intercambiar

rutas entre dos peers BGP conectados a internet (para tener una idea de eso ver este lab).

 

 

 

1.- Prueba inicial:

 

Intercambiamos información BGP entre los routers A y B, para ello generamos rutas estáticas en el Router-A

y las redistribuimos en BGP al Router-B.

 

 

 

1.1.- Comenzamos sin rutas para tener una idea del formato de la cabecera BGP:

 

 Router-A#conf t

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

Router-A(config)#router bgp 65534

Router-A(config-router)#redistribute static

Router-A(config-router)#exit

Router-A(config)#

 

1.2.- Generamos la adyacencia:

 

 

 

1.3.- Verificamos en Wireshark:

 

 

 

La trama/paquete/segmento #10 es el update de 10.0.0.1 que vamos a estudiar y sin rutas es de sólo 77 bytes.

 

Frame 10: 77 bytes on wire (616 bits), 77 bytes captured (616 bits) on interface id 0

Ethernet II, Src: cc:46:d6:2b:5a:54, Dst: 70:81:05:b5:77:82

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

Transmission Control Protocol, Src Port: 43955, Dst Port: 179, Seq: 96, Ack: 78, Len: 23

Border Gateway Protocol - UPDATE Message (no existe campo de Network Layer Reachability Information (NLRI)

    Marker: ffffffffffffffffffffffffffffffff                               ya que aún no hay rutas/redes que publicar)

    Length: 23

    Type: UPDATE Message (2)

    Withdrawn Routes Length: 0

    Total Path Attribute Length: 0

 

 

2.- Pruebas con rutas en el Update:

 

2.1.- Agregamos las rutas para redistribuir en BGP:

 

Agregamos rutas “fantasma”mediante una interface null para forzar la publicación BGP sin un escenario complejo.

La rutas son 200.1.x.0/24 y 200.2.x.0/24, lo que consume 4 bytes por cada red publicada: el prefijo de 3 bytes 200.1.x y la máscara /24

de 1 byte (no consume bytes el octeto o porción de host).

 

El valor 200.2.90.0 se buscó disminuyendo la cantidad de rutas desde 200.2.255.0 a 200.2.128.0 luego a 100.0 y luego a 90.0, no lo se

documentó aquí por brevedad y arrancamos directamente con la 90.0/24.

 

Router-A(config)#ip route 200.1.0.0 255.255.255.0 null 0

Router-A(config)#ip route 200.1.1.0 255.255.255.0 null 0

Router-A(config)#ip route 200.1.2.0 255.255.255.0 null 0

Router-A(config)# (resto de las rutas)

Router-A(config)#ip route 200.2.90.0 255.255.255.0 null 0

Router-A(config)#end

Router-A#

 

2.2- Forzamos el update:

 

 

*Sep 25 15:02:23: %BGP-5-NBR_RESET: Neighbor 10.0.0.2 reset (Interface flap)

*Sep 25 15:02:23: %BGP-5-ADJCHANGE: neighbor 10.0.0.2 Down Interface flap

*Sep 25 15:02:23: %BGP_SESSION-5-ADJCHANGE: neighbor 10.0.0.2 IPv4 Unicast topology base removed from session  Interface flap

*Sep 25 15:02:23: %BGP-5-ADJCHANGE: neighbor 10.0.0.2 Up

 

 

 

Las tramas/paquetes/segmentos #13 y #15 son el update de 10.0.0.1 que estamos estudiando.

 

                                                                         (trama casi completa)

                                                                           |

Frame 13: 1514 bytes on wire (12112 bits), 1514 bytes captured (12112 bits) on interface id 0

Ethernet II, Src: cc:46:d6:2b:5a:54, Dst: 70:81:05:b5:77:82

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

Transmission Control Protocol, Src Port: 55528, Dst Port: 179, Seq: 96, Ack: 194, Len: 1460

    Source Port: 55528

    Destination Port: 179

    [Stream index: 0]

    [Conversation completeness: Incomplete, DATA (15)]

    [TCP Segment Len: 1460]

    Sequence Number: 96    (relative sequence number)

    Sequence Number (raw): 2377976575

    [Next Sequence Number: 1556    (relative sequence number)]

    Acknowledgment Number: 194    (relative ack number)

    Acknowledgment number (raw): 1459410852

    0101 .... = Header Length: 20 bytes (5)

    Flags: 0x010 (ACK)

    Window: 16191

    [Calculated window size: 16191]

    [Window size scaling factor: -2 (no window scaling used)]

    Checksum: 0x635d [unverified]

    [Checksum Status: Unverified]

    Urgent Pointer: 0

    [Timestamps]

    [SEQ/ACK analysis]

    TCP payload (1460 bytes)

    [Reassembled PDU in frame: 15]

    TCP segment data (22 bytes)

Border Gateway Protocol - UPDATE Message

    Marker: ffffffffffffffffffffffffffffffff

    Length: 1438

    Type: UPDATE Message (2)

    Withdrawn Routes Length: 0

    Total Path Attribute Length: 27

    Path attributes

        Path Attribute - ORIGIN: INCOMPLETE

        Path Attribute - AS_PATH: 65534

        Path Attribute - NEXT_HOP: 10.0.0.1 (indica el salto para alcanzar las redes)

        Path Attribute - MULTI_EXIT_DISC: 0

    Network Layer Reachability Information (NLRI) (indica las redes a alcanzar vía este gateway)

        200.1.0.0/24

        200.1.1.0/24

        200.1.2.0/24

        200.1.3.0/24

        ---resumido---

        200.2.88.0/24

        200.2.89.0/24

        200.2.90.0/24

 

Frame 15: 60 bytes on wire (480 bits), 60 bytes captured (480 bits) on interface id 0

Ethernet II, Src: cc:46:d6:2b:5a:54, Dst: 70:81:05:b5:77:82

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

Transmission Control Protocol, Src Port: 55528, Dst Port: 179, Seq: 1556, Ack: 194, Len: 1

    Source Port: 55528

    Destination Port: 179

    [Stream index: 0]

    [Conversation completeness: Incomplete, DATA (15)]

    [TCP Segment Len: 1]

    Sequence Number: 1556    (relative sequence number)

    Sequence Number (raw): 2377978035

    [Next Sequence Number: 1557    (relative sequence number)]

    Acknowledgment Number: 194    (relative ack number)

    Acknowledgment number (raw): 1459410852

    0101 .... = Header Length: 20 bytes (5)

    Flags: 0x018 (PSH, ACK)

    Window: 16191

    [Calculated window size: 16191]

    [Window size scaling factor: -2 (no window scaling used)]

    Checksum: 0xb5dc [unverified]

    [Checksum Status: Unverified]

    Urgent Pointer: 0

    [Timestamps]

    [SEQ/ACK analysis]

    TCP payload (1 byte)

    TCP segment data (1 byte)

[2 Reassembled TCP Segments (23 bytes): #13(22), #15(1)]

    [Frame: 13, payload: 0-21 (22 bytes)]

    [Frame: 15, payload: 22-22 (1 byte)]

    [Segment count: 2]

    [Reassembled TCP length: 23]

    [Reassembled TCP Data: ffffffffffffffffffffffffffffffff00170200000000]

Border Gateway Protocol - UPDATE Message (1 de los 23 bytes de esta cabecera BGP que aquí vemos completa)

    Marker: ffffffffffffffffffffffffffffffff

    Length: 23

    Type: UPDATE Message (2)

    Withdrawn Routes Length: 0

    Total Path Attribute Length: 0

 

Por lo tanto determinamos que BGP actualiza en un solo UPDATE, pero el TCP del router fragmenta el payload en dos,

completando a full el primer segmento y dejando un payload del resto en el segundo ( en este caso 1 byte).

 

 

 

 

3.- Buscando la no fragmentación:

 

3.1.- Retiramos la ruta 200.2.90.0/24:

 

Router-A(config)#no ip route 200.2.90.0 255.255.255.0 Null0

Router-A(config)#

 

 

3.2.- Forzamos el update:

 

 

*Sep 25 15:20:47: %BGP-5-NBR_RESET: Neighbor 10.0.0.2 reset (Interface flap)

*Sep 25 15:20:47: %BGP-5-ADJCHANGE: neighbor 10.0.0.2 Down Interface flap

*Sep 25 15:20:47: %BGP_SESSION-5-ADJCHANGE: neighbor 10.0.0.2 IPv4 Unicast topology base removed from session  Interface flap

*Sep 25 15:22:25: %BGP-5-ADJCHANGE: neighbor 10.0.0.2 Up

 

3.3.- Verificamos en Wireshark:

 

Ahora da 1511 bytes y no fragmenta !

 

 

 

 

3.4.- Verificamos en el Router-A:

 

Router-A#sh ip route summary

IP routing table name is default (0x0)

IP routing table maximum-paths is 32

Route Source    Networks    Subnets     Replicates   Overhead    Memory (bytes)

connected         0                  2                 0                120              360

static             346                  0                 0            20760          62280

application        0                  0                 0                     0                 0

bgp 65534        0                  7                 0                 420            1260

  External:  7 Internal: 0 Local: 0

internal             2                                                    14720

Total             348                 9                  0             21300         78620

Router-A#

 

Router-A#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

       a - application route

       + - 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/30 is directly connected, Vlan1

L        10.0.0.1/32 is directly connected, Vlan1

      190.1.0.0/24 is subnetted, 7 subnets

B        190.1.0.0 [20/0] via 10.0.0.2, 00:06:48 (aprendidas del Router-B)

B        190.1.1.0 [20/0] via 10.0.0.2, 00:07:18

B        190.1.2.0 [20/0] via 10.0.0.2, 00:07:18

B        190.1.3.0 [20/0] via 10.0.0.2, 00:07:19

B        190.1.4.0 [20/0] via 10.0.0.2, 00:07:19

B        190.1.5.0 [20/0] via 10.0.0.2, 00:07:19

B        190.1.6.0 [20/0] via 10.0.0.2, 00:07:19

S     200.1.0.0/24 is directly connected, Null0

S     200.1.1.0/24 is directly connected, Null0

S     200.1.2.0/24 is directly connected, Null0

---resumido---

S     200.2.88.0/24 is directly connected, Null0

S     200.2.89.0/24 is directly connected, Null0

Router-A#

 

3.5.- Verificamos en el Router-B:

 

Router-B#sh ip route summary

IP routing table name is default (0x0)

IP routing table maximum-paths is 32

Route Source    Networks    Subnets     Replicates  Overhead    Memory (bytes)

connected           0               16               0                896              2752

static                   0                 0               0                0                  0

bgp 65535       346                0               0                19432           59684

    External: 346 Internal: 0 Local: 0

internal                2                                                                        15232

Total                349              16               0                20328           77668

Router-B#

 

Router-B#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, + - replicated route

 

Gateway of last resort is not set

 

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

C        10.0.0.0/30 is directly connected, Vlan1

L        10.0.0.2/32 is directly connected, Vlan1

      190.1.0.0/16 is variably subnetted, 14 subnets, 2 masks

C       190.1.0.0/24 is directly connected, Vlan10

L        190.1.0.1/32 is directly connected, Vlan10

C       190.1.1.0/24 is directly connected, Vlan11

L        190.1.1.1/32 is directly connected, Vlan11

C       190.1.2.0/24 is directly connected, Vlan12

L        190.1.2.1/32 is directly connected, Vlan12

C       190.1.3.0/24 is directly connected, Vlan13

L        190.1.3.1/32 is directly connected, Vlan13

C       190.1.4.0/24 is directly connected, Vlan14

L        190.1.4.1/32 is directly connected, Vlan14

C       190.1.5.0/24 is directly connected, Vlan15

L        190.1.5.1/32 is directly connected, Vlan15

C       190.1.6.0/24 is directly connected, Vlan16

L        190.1.6.1/32 is directly connected, Vlan16

B     200.1.0.0/24 [20/0] via 10.0.0.1, 00:49:43

B     200.1.1.0/24 [20/0] via 10.0.0.1, 00:49:43

B     200.1.2.0/24 [20/0] via 10.0.0.1, 00:49:43

B     200.1.3.0/24 [20/0] via 10.0.0.1, 00:49:43

---resumido---

B     200.2.87.0/24 [20/0] via 10.0.0.1, 00:50:05

B     200.2.88.0/24 [20/0] via 10.0.0.1, 00:50:05

B     200.2.89.0/24 [20/0] via 10.0.0.1, 00:50:05 (aunque aquí es transparente si hay fragmentación o no)

Router-B#

 

 

4.- Forzando unos bytes más…

 

4.1.- Agregamos la ruta 200.3.0.0/16 que ocupa 3 bytes, ya que es una ruta sumarizada (2 bytes el prefijo + 1 byte la máscara,

o sea, 1 byte 200, 1 byte 3, y 1 byte el /16) y con esto completaríamos la trama full full…

 

Router-A(config)#ip route 200.3.0.0 255.255.0.0 null 0

Router-A(config)#

 

4.2.- Forzamos el update:

 

 

*Sep 25 16:09:47: %BGP-5-NBR_RESET: Neighbor 10.0.0.2 reset (Interface flap)

*Sep 25 16:09:47: %BGP-5-ADJCHANGE: neighbor 10.0.0.2 Down Interface flap

*Sep 25 16:09:47: %BGP_SESSION-5-ADJCHANGE: neighbor 10.0.0.2 IPv4 Unicast topology base removed from session  Interface flap

*Sep 25 16:09:25: %BGP-5-ADJCHANGE: neighbor 10.0.0.2 Up

 

4.3.- Verificamos en Wireshark:

 

 

Frame 13: 1514 bytes on wire (12112 bits), 1514 bytes captured (12112 bits) on interface id 0

Ethernet II, Src: cc:46:d6:2b:5a:54, Dst: 70:81:05:b5:77:82

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

Transmission Control Protocol, Src Port: 179, Dst Port: 50415, Seq: 96, Ack: 194, Len: 1460

Border Gateway Protocol - UPDATE Message

    Marker: ffffffffffffffffffffffffffffffff

    Length: 1437

    Type: UPDATE Message (2)

    Withdrawn Routes Length: 0

    Total Path Attribute Length: 27

    Path attributes

    Network Layer Reachability Information (NLRI)

        200.1.0.0/24

        200.1.1.0/24

        200.1.2.0/24

        200.1.3.0/24

       ---resumido---

        200.2.87.0/24

        200.2.88.0/24

        200.2.89.0/24

        200.3.0.0/16   (últimos 3 bytes que llevan la trama de 1511 a 1514, mas lo 4 byres de CRC son 1518 bytes)

Border Gateway Protocol - UPDATE Message

    Marker: ffffffffffffffffffffffffffffffff

    Length: 23

    Type: UPDATE Message (2)

    Withdrawn Routes Length: 0

    Total Path Attribute Length: 0

 

 

 

                                                                                                                                      05e0  e1 e2  e3   e4 e5  e6  e7   e8  e9 = 1513

 

La última posición marcada en azul es 05e9 que es el número 1513, pero contando desde la posición 0000 son 1514 bytes, trama completa !

 

 

4.4.- Verificación en el Router-B:

 

Router-B#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, + - replicated route

 

Gateway of last resort is not set

 

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

C        10.0.0.0/30 is directly connected, Vlan1

L        10.0.0.2/32 is directly connected, Vlan1

      190.1.0.0/16 is variably subnetted, 14 subnets, 2 masks

C       190.1.0.0/24 is directly connected, Vlan10

L        190.1.0.1/32 is directly connected, Vlan10

C       190.1.1.0/24 is directly connected, Vlan11

L        190.1.1.1/32 is directly connected, Vlan11

C       190.1.2.0/24 is directly connected, Vlan12

L        190.1.2.1/32 is directly connected, Vlan12

C       190.1.3.0/24 is directly connected, Vlan13

L        190.1.3.1/32 is directly connected, Vlan13

C       190.1.4.0/24 is directly connected, Vlan14

L        190.1.4.1/32 is directly connected, Vlan14

C       190.1.5.0/24 is directly connected, Vlan15

L        190.1.5.1/32 is directly connected, Vlan15

C       190.1.6.0/24 is directly connected, Vlan16

L        190.1.6.1/32 is directly connected, Vlan16

B     200.1.0.0/24 [20/0] via 10.0.0.1, 00:49:43

B     200.1.1.0/24 [20/0] via 10.0.0.1, 00:49:43

B     200.1.2.0/24 [20/0] via 10.0.0.1, 00:49:43

B     200.1.3.0/24 [20/0] via 10.0.0.1, 00:49:43

---resumido---

B     200.2.87.0/24 [20/0] via 10.0.0.1, 00:50:05

B     200.2.88.0/24 [20/0] via 10.0.0.1, 00:50:05

B     200.2.89.0/24 [20/0] via 10.0.0.1, 00:50:05

B     200.3.0.0/16 [20/0] via 10.0.0.1, 00:50:05 (aunque aquí es transparente si hay fragmentación o no)

Router-B#

 

5.- Resumen:

 

Desde la posición 0068 a la 05d3 hay 1387 bytes (05d3 – 0068 es 1491 – 104 = 1387) disponibles para anuncios de redes, que dependiendo

del prefijo utilizará mas o menos bytes (1, 2, 3, 4 o 5 en el caso de subredes /25 a /30).

También debemos tener en cuenta que aquí tenemos un único next-hop 10.0.0.1 y casi sin carga de otros atributos BGP. Es sólo una prueba

de laboratorio para estimar mas adelante cuantos updates necesitaríamos para todo una clase A, B o C, o toda la tabla, quien sabe.

 

  

 

Otro dato de color es que el router anuncia a su vecino adyacente en la misma LAN (recordemos que no es mandatorio en BGP) siempre con

un TTL de 1, sólo una curiosidad al margen de tantos números hexadecimales.

 

 

¿Por qué una curiosidad? Porque siempre leemos por ahí que cuando un router recibe un pquete con TTL=1 lo descarta, y en este caso no.

 

 

(2023) Route to madness…

Rosario, Argentina