Análizando VLANs “imposibles”
Fecha: enero del 2020
Escenario
Se analizan los logs de errores PVSTP+ en un switch Cisco 2960 que cierra un
anillo con un switch
TP-Link y un par de routers Mikrotik
con interfaces en modo bridge.
Los errores de spanning-tree se deben a que
recibe BPDUs con números de VLANs
mayores a 4095,
que es el valor máximo para un VLAN id por una cuestión tamaño de campos en la
BPDU, por ello,
analizaremos de números binarios y trataremos de entender cómo se pudieron generar
dichos logs.
Lo curioso de este escenario es que sucedió un solo día y no volvió a
repetirse, también el escenario
es mas complejo, existen otros equipos conectados
al TP-Link que podrían haber generado esto.
Los equipos Mikrotik en ambos lados no tienen STP
activado, pero no filtran las BPDU tal como lo hacen
otras marcas, el bucle sólo se evita o en el Cisco 2960 o en el TP-Link, este
último con MST.
Al tratarse de de una red en producción, los
nombres y algunos detalles fueron modificados.
Estados del spanning-tree:
Cisco2960#sh spanning-tree vlan 1400
VLAN1400
Spanning tree enabled protocol rstp
Root ID Priority 32768
Address bc16.653e.f5b0
Cost 4
Port 19 (GigabitEthernet1/0/19)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 34168 (priority 32768 sys-id-ext 1400)
Address 7486.0b35.0400
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- -------- ------ ---- -------- --------------------------------
Gi1/0/19 Root FWD 4 128.19 P2p Peer(STP)
Gi1/0/26 Altn BLK 4
128.26 P2p Peer(STP)
(evita el bucle)
Cisco2960#
Logs involucrados:
Jan 15 07:27:45: %SPANTREE-2-RECV_PVID_ERR: Received BPDU with
inconsistent peer vlan id 11807 on GigabitEthernet1/0/19 VLAN1400.
Jan 15 07:29:19: %SPANTREE-2-RECV_PVID_ERR: Received BPDU with
inconsistent peer vlan id 16173 on GigabitEthernet1/0/19 VLAN1400.
Jan 15 09:17:21: %SPANTREE-2-RECV_PVID_ERR: Received BPDU with
inconsistent peer vlan id 8707 on GigabitEthernet1/0/19 VLAN1400.
Jan 15 09:21:01: %SPANTREE-2-RECV_PVID_ERR: Received BPDU with
inconsistent peer vlan id 14762 on GigabitEthernet1/0/19 VLAN1400.
Datos de las VLANs
en el equipo conectado en el extremo:
Este equipo llega al 2960 pasando por Mikrotiks
sin STP y a los ports 19 y 26,
en este último no se registraron logs de
relevancia.
! TL-SG2216
#
vlan 1108,1164,1168,1172,1180,1200,1400,1405,1464,1476,1600
#
| |
posibles VLANs "parecidas"
Existen ciertas VLANs que tienen números
parecidos pero en decimal, si los analizamos
en binario, tal como los leen y reenvían los equipos electrónicos, no son tan
parecidos.
Análisis en binario de los VLAN id:
Número máximo de VLAN-id (realmente
4096-2 = 4094)
3 1 |
2 6 8 4 2 1
7 3 1 0 0 0 5 2 1
6 8 9 9 4 2 1 5 2 6 3 1
8 4 2 6 8 4 2 6 8 4 2 6 8 4 2
1 < peso de bit (16 bits)
0 0 1 0 1 1 1 0 0 0 0 1 1 1 1 1 11807
1 0 0 1 0 0 1 1 1 0 0 1180 < VLAN existente
0 0 1 1 1 1 1 1 0 0 1 0 1 1 0 1 16173
0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 1 8707
0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 514
0 0 1 1 1 0 0 1 1 0 1 0 1 0 1 0 14762
0 1 1 1 0 0 0 1 0 0 1476 < VLAN existente
El switch
2960 generó este error al recibir el VLAN id imposible:
Jan 15 09:21:01: %PM-3-INTERNALERROR: Port Manager Internal Software Error (vlanid >=0 && vlanid
< PM_MAX_VLANS: ../switch/pm/pm_vlan.c: 1696: pm_vlan_get_vlan_data)
-Traceback= 555EECz 2ADAFB0z 2B4B624z 2B5B874z 200C098z 1FBAFA0z 1FBB528z 2E31644z 2E2D340z
El switch
2960 bloqueó por inconsistenias:
Jan 15 09:21:01:
%SPANTREE-2-BLOCK_PVID_LOCAL: Blocking GigabitEthernet1/0/19 on VLAN1400. Inconsistent local vlan.
También se recibieron tramas sin
VLAN id:
Jan 15 09:24:09: %SPANTREE-2-RECV_BAD_TLV: Received SSTP BPDU with bad TLV on GigabitEthernet1/0/19 VLAN1400.
Explanation:
This message means that the listed interface received an SSTP BPDU that was missing the VLAN ID tag.
The BPDU is discarded. [interface] is the interface that received the SSTP BPDU.
Each SSTP-addressed BPDU has a Tag-Length-Value (TLV) appended to it. This TLV contains the VLAN ID of the spanning tree
to which the BPDU belongs and is used in order to check the Port VLAN ID (PVID).
All untagged frames are assigned to the LAN specified in the PVID parameter. When a tagged frame is received by a port, the tag
is respected. If the frame is untagged, the value contained in the PVID is considered as a tag.
In some cases, these error messages occurs due to native vlan inconsistency on the interfaces on each end of the 802.1Q trunk connection.
Analisis de una
trama PVST+ :
El número hexadecimal 8578 es en decimal el resultado de 32768 (priority) + 1400 (VLAN id).
Podemos observar que el VLAN-id se encuentra en dos campos, junto a la priority y al final
como VLAN id propiamente dicho.
Corolario:
Se recibieron BPDUs de PVST+ con información de VLANs incorrectas, fuera del rango
válido inclusive por cuestiones de campos en números binarios, no se pudieron capturar
la tramas para analizarlas y hasta el momento no se repitieron, ni con el
mismo número
de VLAN incorrecta ni ninguna otra nueva también incorrecta, o inexistente.
No se pudo generar tráfico adrede por ejemplo con Yersinia
(no soporta PVST+) como
para replicar el problema y verificar si el exceso de tramas de este tipo
genera una DoS,
considerando que causa un bloqueo del puerto. Cosas del networking.
(2020) Mutant numbers
Rosario, Argentina