Pruebas de VLANs nativas en trunks
Fecha: marzo del 2019
Escenario
En una instalación real se experimentó una pérdida de conectividad justo al configurar en un trunk la VLAN
nativa existente por una VLAN que no existe como medida de seguridad.
De allí surgió el planteo de que pasa con VTP y otros protocolos de control al utilizar una VLAN
inexistente como nativa en el enlace, o tener una VLAN nativa en un extremo y otra VLAN diferente en otro.
Se simuló en Packet Tracer y luego en una maqueta con equipos reales el efecto de la modificación del enlace
para intentar reproducir la pérdida de conectividad.
1.- Simulación:
1.1.- Implementación de VLANs y server VTP:
switch-A#conf t
Enter configuration commands, one per
line. End with CNTL/Z.
switch-A(config)#vtp domain prueba
Changing VTP domain name from NULL to prueba
switch-A(config)#vlan 100
switch-A(config-vlan)#vlan 101
switch-A(config-vlan)#vlan 102
switch-A(config-vlan)#vlan 103
switch-A(config-vlan)#vlan 104
switch-A(config-vlan)#exit
switch-A(config)#int gi0/1
switch-A(config-if)#switchport mode trunk
switch-A(config-if)#spanning-tree portfast
trunk
%Warning: portfast should only be enabled on
ports connected to a single
host. Connecting hubs, concentrators, switches,
bridges, etc... to this
interface when portfast is enabled, can
cause temporary bridging loops.
Use with CAUTION
switch-A(config-if)#end
switch-A#
1.2.- Implemenatción de switch cliente:
switch-B#conf t
Enter configuration commands, one per
line. End with CNTL/Z.
Switch-B(config)#vtp domain prueba
Changing VTP domain name from NULL to prueba
Switch-B(config)#vtp mode client
Setting device to VTP CLIENT mode.
Switch-B(config)#int gi0/1
Switch-B(config-if)#sw mode trunk
Switch-B(config-if)#spanning-tree portfast
trunk
%Warning: portfast should only be enabled on
ports connected to a single
host. Connecting hubs, concentrators, switches,
bridges, etc... to this
interface when portfast is enabled, can
cause temporary bridging loops.
Use with CAUTION
Switch-B(config-if)#end
switch-B
1.3.- Verificación:
switch-B#sh vlan brief
VLAN
Name
Status Ports
---- -------------------------------- ---------
-------------------------------
1
default
active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
Gig0/2 (Gi0/1 no aparece porque es trunk)
100
VLAN0100
active (VLANs aprendidas)
101
VLAN0101
active
102 VLAN0102
active
103
VLAN0103
active
104
VLAN0104
active
1002
fddi-default
active
1003
token-ring-default
active
1004
fddinet-default
active
1005 trnet-default active
switch-B
1.4.- Se configura una native VLAN con una VLAN inexistente:
switch-A(config)#int gi0/1
switch-A(config-if)#switchport trunk native
vlan 99
switch-A(config-if)#
%CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN
mismatch discovered on GigabitEthernet0/1 (99),
with Switch-B GigabitEthernet0/1 (1). (este error es normal ya que difieren entre si)
En switch B:
%CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch
discovered on GigabitEthernet0/1 (1),
with switch-A GigabitEthernet0/1 (99).
1.5.- Creamos una VLAN nueva:
switch-A(config)#vlan 105
switch-A(config-vlan)#
1.6.- Verificación:
switch-B#sh vlan brief
VLAN
Name
Status Ports
---- -------------------------------- ---------
-------------------------------
1
default
active
Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
Gig0/2
100
VLAN0100
active
101
VLAN0101
active
102
VLAN0102
active
103 VLAN0103 active
104 VLAN0104 active
105 VLAN0105 active (la VLAN fué propagada)
1002
fddi-default
active
1003 token-ring-default active
1004
fddinet-default active
1005
trnet-default active
switch-B#
Al buscar en la bibliografía de Cisco, se describe que al no existir una VLAN válida en el enlace, el plano
de control (control-plane), que incluye los protocolos necesarios para el funcionamiento de la red (VTP,
CDP, STP, etc) y que se comunican si o si por VLANs nativas, utilizan de forma encubierta (o no declarada)
la VLAN 1.
El comanto switchport trunk allowed vlan x,y,z solamente afecta al tráfico de usuario (data-plane) y no al
tráfico de control (control-plane).
2.- Verificación en equipos Catalyst 2960:
Se crea una maqueta con dos switchs Cisco 2960X, con dos enlaces trunk (Gi1/0/23 y 24) entre ellos, y una
topología VTP cliente/servidor. También se procede con las pruebas de trunks con VLAN inexistente.
2.1.- Se verifica la conmutación de enlaces vía STP (plano de control) sin novedades ni bucles:
Interface
Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- --------
--------------------------------
Gi1/0/23
Root FWD 4 128.23
P2p
Sep 13 11:59:13.440: %LINK-3-UPDOWN: Interface
GigabitEthernet1/0/24, changed state to up
Sep 13 11:59:15.453: %LINEPROTO-5-UPDOWN: Line
protocol on Interface GigabitEthernet1/0/24, changed state to up
Gi1/0/23
Root FWD 4 128.23
P2p
Gi1/0/24
Altn BLK
4 128.24 P2p
switch-A#sh int trunk
Port
Mode Encapsulation
Status Native vlan
Gig0/1
on
802.1q
trunking 99
Gig0/2
on
802.1q
trunking 99
Port
Vlans allowed on trunk
Gig0/1 1-1005
Gig0/2 1-1005
Port
Vlans allowed and active in management domain
Gig0/1
1,100,101,102,103,104,105
Gig0/2
1,100,101,102,103,104,105
Port
Vlans in spanning tree forwarding state and not pruned
Gig0/1 1,100,101,102,103,104,105 (no hay STP en la VLAN 99 ya que no existe)
Gig0/2 1,100,101,102,103,104,105 (no hay STP en la VLAN 99 ya que no existe)
switch-A#
switch-B#sh int trunk
Port
Mode Encapsulation
Status Native vlan
Gig0/1
on
802.1q
trunking 99
Gig0/2
on
802.1q
trunking 99
Port
Vlans allowed on trunk
Gig0/1 1-1005
Gig0/2 1-1005
Port
Vlans allowed and active in management domain
Gig0/1
1,100,101,102,103,104,105
Gig0/2
1,100,101,102,103,104,105
Port
Vlans in spanning tree forwarding state and not pruned
Gig0/1 1,100,101,102,103,104,105 (no hay STP en la VLAN 99 ya que no existe)
Gig0/2 none (STP está en bloqueo)
switch-B#
switch-B#sh spanning-tree vlan 99
No spanning tree instance exists.
switch-B#
2.2.- Capturamos tráfico
con la VLAN 99 nativa y sin crear:
Podemos observar que aunque la VLAN no exista se anuncia igualmente a
traves de VLAN 1.
2.3.- Creamos la VLAN 99:
switch-A#conf t
Enter configuration commands, one per
line. End with CNTL/Z.
switch-A(config)#vlan 99
switch-A(config-vlan)#^Z
switch-A#
switch-B#conf t
Enter configuration commands, one per
line. End with CNTL/Z.
switch-B(config)#vlan 99
switch-B(config-vlan)#^Z
switch-B#
2.4.- Capturamos tráfico
con la VLAN 99 nativa creada:
Ahora vemos que también hay un proceso spanning-tree corriendo en la VLAN 99.
2.5.- Verificamos:
switch-A#sh int trunk
Port
Mode Encapsulation
Status Native vlan
Gig0/1
on
802.1q
trunking 99
Gig0/2
on
802.1q
trunking 99
Port
Vlans allowed on trunk
Gig0/1 1-1005
Gig0/2 1-1005
Port
Vlans allowed and active in management domain
Gig0/1
1,99,100,101,102,103,104,105,106
Gig0/2
1,99,100,101,102,103,104,105,106
Port
Vlans in spanning tree forwarding state and not pruned
Gig0/1 1,99,100,101,102,103,104,105,106
Gig0/2 1,99,100,101,102,103,104,105,106
switch-A#
switch-B#sh int trunk
Port
Mode Encapsulation
Status Native vlan
Gig0/1
on
802.1q
trunking 99
Gig0/2
on
802.1q
trunking 99
Port
Vlans allowed on trunk
Gig0/1 1-1005
Gig0/2 1-1005
Port
Vlans allowed and active in management domain
Gig0/1
1,99,100,101,102,103,104,105,106
Gig0/2 1,99,100,101,102,103,104,105,106
Port
Vlans in spanning tree forwarding state and not pruned
Gig0/1 1,99,100,101,102,103,104,105,106 (aprendida por VTP)
Gig0/2 none (STP está en bloqueo)
switch-B#
2.6.- Quitamos la VLAN 1 del enlace:
Switch_A(config)#int gi0/1
Switch_A(config-if)#sw trunk allowed vlan remove 1
Switch_A(config-if)#
Podemos ver que ya no hay VLAN 1 en los procesos PVST+ por lo qie la VLAN no estará disponible en el
plano de datos (tráfico de usuario).
Generamos una VLAN nueva para forzar tráfico VTP (la debe anunciar), aún sin la VLAN 1 en el enlace.
2.7.- Detalle de protocolos en ambos planos:
Fuente:
3.- Resúmen:
- Si el switch-A tiene como nativa la VLAN 99 (inexistente) y el switch-B como nativa la VLAN 1
(default) el plano de control y el plano de datos trabajan normalmente mediante la VLAN 1.
- Si el switch-A tiene como nativa la VLAN 99 (inexistente) y el switch-B como nativa la VLAN 99
(inexistente), el plano de control y el plano de datos trabajan normalmente mediante la VLAN 1.
- Si el switch-A tiene como nativa la VLAN 99 (existente) y el switch-B como nativa la VLAN 99
(existente), el plano de control trabaja mediante la VLAN 99.
- Si el trunk no tiene VLAN nativa y no tiene permitida la VLAN 1, esta última se utiliza de todas
maneras en el plano de control.
- En caso de utilizar PVST+ se utilizan todas las VLANs configuradas en el trunk, si la VLAN nativa
no existe o no se permite, no pasan tramas PVST+ de esa VLAN por el enlace.
- En caso de utilizar MSTP (multiple spanning-tree) se utiliza la VLAN nativa 1 si o si en el plano
de control.
- En el caso inicial (inestabilidad en una red real) el problema pasa por otro lado, no podemos
culpar a la VLAN nativa (inexistente o no), pérdida de conectividad sería normal por utilizar
VLANs diferentes, pero eso mas que problema sería mala praxis.
Si debatieramos temas de seguridad hay mucho para hablar de este tema (ej VLAN hopping),
pero en este lab apuntábamos al plano de control, hay mucho mas para estudiar J
(2019) Sometimes spanning-tree
blocks my mind
Rosario, Argentina