GuíasGuides · Nivel 4Level 4

Cisco: VLANs, troncales, el router de la sede y un puerto que no da redCisco: VLANs, trunks, the site router and a port that gives no network

Leer un switch Catalyst antes de tocarlo, configurar puertos de acceso y troncales sin cortar una planta, la ruta por defecto con respaldo automático en el router, el diagnóstico de un puerto en err-disabled y cómo hacer cambios en remoto con red de seguridad.Read a Catalyst switch before touching it, configure access ports and trunks without cutting off a floor, the default route with automatic failover on the router, diagnosing a port in err-disabled, and how to make remote changes with a safety net.

Qué vas a conseguir

Moverte con soltura en la red de una sede con switches Catalyst y un router ISR: entender qué hay antes de cambiar nada, dar de alta puestos y teléfonos en su VLAN, ampliar una troncal sin dejar a nadie sin red, que el router cambie solo al circuito de respaldo, y resolver el ticket de red más habitual en minutos.

Antes de empezar

  • Acceso por SSH (nunca Telnet) o consola, con usuario nominal (TACACS+ o RADIUS si existe; cuenta local solo de emergencia).
  • Una copia de la configuración de cada equipo antes de la ventana de cambio, y el cambio aprobado.
  • El plano de la sede: qué switch da servicio a qué planta, qué VLAN es qué, dónde está el uplink al core y qué IP tiene cada circuito.

1. Leer el switch antes de tocarlo

SW-P2-01 · Catalyst 9200 (IOS XE)
show version | include uptime|Softwareshow vlan briefshow interfaces statusshow interfaces trunkshow cdp neighborsSW-P2-01 uptime is 41 weeks, 2 days, 3 hours, 12 minutesCisco IOS XE Software, Version 17.09.04aVLAN Name                             Status    Ports---- -------------------------------- --------- -------------------------------10   GESTION                          active20   USUARIOS                         active    Gi1/0/1, Gi1/0/2, ... Gi1/0/4030   VOZ                              active99   IMPRESORAS                       active    Gi1/0/41, Gi1/0/42Port      Mode     Encapsulation  Status        Native vlanTe1/1/1   on       802.1q         trunking      999Port      Vlans allowed on trunkTe1/1/1   10,20,30,99Device ID        Local Intrfce     Holdtme    Capability  Platform  Port IDCORE-01          Ten 1/1/1         141             R S I  C9500     Ten 1/0/7

Con esto sabes la versión, qué VLAN existe y dónde, qué troncales hay y qué VLAN dejan pasar, y quién está al otro lado de cada enlace (CDP). Si una VLAN no aparece en *Vlans allowed on trunk*, esa VLAN no llega a esta planta.

2. Un puesto con teléfono: puerto de acceso

SW-P2-01 · configuración
configure terminalinterface GigabitEthernet1/0/12 description PUESTO 2.14 switchport mode access switchport access vlan 20 switchport voice vlan 30 spanning-tree portfast spanning-tree bpduguard enable no shutdownendcopy running-config startup-config
  • switchport voice vlan 30: el teléfono IP marca su tráfico en la VLAN de voz y el PC que cuelga de él sigue en la 20. Un solo cable, dos redes.
  • portfast hace que el puerto pase a reenviar al instante (el PC coge IP sin esperar 30 segundos) y bpduguard lo apaga si alguien conecta un switch. Siempre van juntos en los puertos de usuario.
  • Sin copy running-config startup-config, el cambio se pierde en el siguiente reinicio.

3. La troncal: añadir una VLAN sin cortar la planta

SW-P2-01 · troncal hacia el core
show interfaces Te1/1/1 trunkconfigure terminalinterface TenGigabitEthernet1/1/1 switchport trunk allowed vlan add 40end

switchport trunk allowed vlan 40 (sin add) sustituye la lista entera: la troncal deja pasar solo la VLAN 40 y la planta se queda sin red de usuarios, voz y gestión, incluida tu sesión SSH. Es el error de red más caro y más repetido. Siempre add o remove, y la lista completa revisada con show interfaces trunk antes y después.

La VLAN 40 también tiene que existir en el switch (vlan 40, name INVITADOS) y estar permitida en el otro extremo, en el core. Y la VLAN nativa de las troncales es una que no use nadie (aquí la 999), no la 1.

4. El router de la sede: salida y circuito de respaldo

La sede tiene un circuito principal y uno de respaldo. El router sale por el principal mientras el proveedor responda, y cambia solo al respaldo cuando deja de hacerlo.

RT-SEDE-01 · ISR 4331
configure terminalip sla 1 icmp-echo 203.0.113.1 source-interface GigabitEthernet0/0/0 frequency 10ip sla schedule 1 life forever start-time nowtrack 1 ip sla 1 reachabilityip route 0.0.0.0 0.0.0.0 203.0.113.1 track 1ip route 0.0.0.0 0.0.0.0 198.51.100.1 250endshow track 1Track 1  IP SLA 1 reachability  Reachability is Up    2 changes, last change 3d04h
  • IP SLA hace ping cada 10 segundos a la puerta de enlace del proveedor principal; el track sigue ese resultado.
  • La ruta por defecto principal depende del track. Cuando el ping falla, desaparece y queda la de respaldo, que tiene distancia administrativa 250 (*ruta flotante*).
  • Para comprobarlo sin esperar a una avería: show ip route 0.0.0.0 dice qué ruta está activa; en una ventana de cambio, se apaga la interfaz del principal y se mira cuánto tarda en cambiar.

En la interfaz de cada VLAN de usuarios del core, ip helper-address 10.20.1.10 reenvía las peticiones de DHCP al servidor: sin ella, los puestos de una VLAN nueva se quedan con una IP 169.254.x.x.

5. El ticket: "el puesto 2.14 no tiene red"

SW-P2-01 · diagnóstico
show interfaces Gi1/0/12 statusshow logging | include Gi1/0/12Port      Name          Status       Vlan  Duplex  Speed TypeGi1/0/12  PUESTO 2.14   err-disabled 20    auto    auto  10/100/1000BaseTX%SPANTREE-2-BLOCK_BPDUGUARD: Received BPDU on port Gi1/0/12 with BPDU Guard enabled. Disabling port.%PM-4-ERR_DISABLE: bpduguard error detected on Gi1/0/12, putting Gi1/0/12 in err-disable state

El estado del puerto dice casi todo:

EstadoQué significaQué haces
connectedHay enlaceshow mac address-table interface Gi1/0/12: ¿aparece la MAC del PC? Si sí, el problema es IP/DHCP, no el switch
notconnectNo hay enlaceCable, roseta, el patch del armario o la tarjeta del PC
err-disabledEl switch lo ha apagado a propósitoshow logging dice por qué (bpduguard, port-security, flapping)
disabledAlguien lo apagó (shutdown)El historial de cambios dice quién y por qué

Aquí alguien conectó un switch pequeño en su mesa para tener más puertos. Se retira el aparato y se reactiva el puerto:

SW-P2-01
configure terminalinterface Gi1/0/12 shutdown no shutdownend

Si en show interfaces Gi1/0/12 aparecen errores de CRC o *input errors* que suben, el problema es físico: el cable o la roseta.

6. Cambios en remoto con red de seguridad

Antes de un cambio que podría dejarte sin acceso
reload in 10configure terminal# ... el cambio ...end# si sigues conectado y todo va bien:reload cancelcopy running-config startup-config

reload in 10 programa un reinicio dentro de 10 minutos. Si el cambio te deja fuera, el equipo arranca con la configuración guardada (la anterior) y vuelves a entrar. Si todo va bien, reload cancel y se guarda. Es la diferencia entre una corrección en dos minutos y un viaje a la sede.

7. Lo que revisas cada mes

  • Copias de configuración automáticas (Oxidized, RANCID o el propio archive de IOS) y que el último cambio está en el repositorio.
  • Versiones de IOS XE frente a los avisos de seguridad de Cisco: los equipos con un aviso crítico tienen fecha de actualización.
  • Puertos err-disabled y puertos sin uso en más de 90 días (show interfaces | include line protocol|Last input): los que no se usan se apagan y se dejan en una VLAN sin servicio.
  • Que el track del router ha cambiado tantas veces como averías ha tenido el circuito. Si cambia sin avería, el ping se está perdiendo y hay que hablar con el proveedor.

Siguientes pasos

  • 802.1X con Cisco ISE o NPS: el puerto da la VLAN según quién se conecta, no según el puerto.
  • NetBox como fuente de verdad (qué puerto va a qué roseta) y Ansible con la colección cisco.ios para cambios repetibles (guía de Ansible del Nivel 3).
  • SD-WAN cuando las sedes son muchas y los circuitos, variados.
  • La guía de FortiGate (próximamente) cubre el cortafuegos que suele estar entre este router y el resto del mundo.

¿Falta algo o en tu entorno es distinto? Escríbeme y lo corrijo.

What you'll get

Moving with ease in a site's network with Catalyst switches and an ISR router: understanding what is there before changing anything, bringing desks and phones onto their VLAN, extending a trunk without leaving anyone offline, having the router switch to the backup circuit by itself, and solving the most common network ticket in minutes.

Before you start

  • Access over SSH (never Telnet) or console, with a named account (TACACS+ or RADIUS if available; local account for emergencies only).
  • A copy of the configuration of every device before the change window, and the change approved.
  • The site map: which switch serves which floor, which VLAN is which, where the uplink to the core is and which IP each circuit has.

1. Read the switch before touching it

SW-F2-01 · Catalyst 9200 (IOS XE)
show version | include uptime|Softwareshow vlan briefshow interfaces statusshow interfaces trunkshow cdp neighborsSW-F2-01 uptime is 41 weeks, 2 days, 3 hours, 12 minutesCisco IOS XE Software, Version 17.09.04aVLAN Name                             Status    Ports---- -------------------------------- --------- -------------------------------10   MANAGEMENT                       active20   USERS                            active    Gi1/0/1, Gi1/0/2, ... Gi1/0/4030   VOICE                            active99   PRINTERS                         active    Gi1/0/41, Gi1/0/42Port      Mode     Encapsulation  Status        Native vlanTe1/1/1   on       802.1q         trunking      999Port      Vlans allowed on trunkTe1/1/1   10,20,30,99Device ID        Local Intrfce     Holdtme    Capability  Platform  Port IDCORE-01          Ten 1/1/1         141             R S I  C9500     Ten 1/0/7

With this you know the version, which VLANs exist and where, which trunks there are and which VLANs they carry, and who is on the other side of each link (CDP). If a VLAN isn't in *Vlans allowed on trunk*, that VLAN doesn't reach this floor.

2. A desk with a phone: access port

SW-F2-01 · configuration
configure terminalinterface GigabitEthernet1/0/12 description DESK 2.14 switchport mode access switchport access vlan 20 switchport voice vlan 30 spanning-tree portfast spanning-tree bpduguard enable no shutdownendcopy running-config startup-config
  • switchport voice vlan 30: the IP phone tags its traffic on the voice VLAN and the PC hanging off it stays on 20. One cable, two networks.
  • portfast makes the port forward straight away (the PC gets an IP without waiting 30 seconds) and bpduguard shuts it down if someone plugs in a switch. They always go together on user ports.
  • Without copy running-config startup-config, the change is lost at the next reload.

3. The trunk: adding a VLAN without cutting off the floor

SW-F2-01 · trunk to the core
show interfaces Te1/1/1 trunkconfigure terminalinterface TenGigabitEthernet1/1/1 switchport trunk allowed vlan add 40end

switchport trunk allowed vlan 40 (without add) replaces the whole list: the trunk carries only VLAN 40 and the floor loses the user, voice and management networks, including your SSH session. It is the most expensive and most repeated network mistake. Always add or remove, and the full list checked with show interfaces trunk before and after.

VLAN 40 also has to exist on the switch (vlan 40, name GUESTS) and be allowed at the other end, on the core. And the trunks' native VLAN is one nobody uses (999 here), not 1.

4. The site router: egress and backup circuit

The site has a primary circuit and a backup one. The router goes out through the primary while the provider responds, and switches to the backup by itself when it stops responding.

RT-SITE-01 · ISR 4331
configure terminalip sla 1 icmp-echo 203.0.113.1 source-interface GigabitEthernet0/0/0 frequency 10ip sla schedule 1 life forever start-time nowtrack 1 ip sla 1 reachabilityip route 0.0.0.0 0.0.0.0 203.0.113.1 track 1ip route 0.0.0.0 0.0.0.0 198.51.100.1 250endshow track 1Track 1  IP SLA 1 reachability  Reachability is Up    2 changes, last change 3d04h
  • IP SLA pings the primary provider's gateway every 10 seconds; the track follows that result.
  • The primary default route depends on the track. When the ping fails it disappears and the backup one remains, with administrative distance 250 (a *floating route*).
  • To check it without waiting for a fault: show ip route 0.0.0.0 says which route is active; in a change window, shut the primary interface and time how long it takes to switch.

On each user VLAN interface on the core, ip helper-address 10.20.1.10 forwards DHCP requests to the server: without it, desks on a new VLAN end up with a 169.254.x.x address.

5. The ticket: "desk 2.14 has no network"

SW-F2-01 · diagnosis
show interfaces Gi1/0/12 statusshow logging | include Gi1/0/12Port      Name          Status       Vlan  Duplex  Speed TypeGi1/0/12  DESK 2.14     err-disabled 20    auto    auto  10/100/1000BaseTX%SPANTREE-2-BLOCK_BPDUGUARD: Received BPDU on port Gi1/0/12 with BPDU Guard enabled. Disabling port.%PM-4-ERR_DISABLE: bpduguard error detected on Gi1/0/12, putting Gi1/0/12 in err-disable state

The port status says almost everything:

StatusWhat it meansWhat you do
connectedThere is a linkshow mac address-table interface Gi1/0/12: does the PC's MAC show up? If yes, the problem is IP/DHCP, not the switch
notconnectNo linkCable, wall socket, the patch in the cabinet or the PC's network card
err-disabledThe switch shut it down on purposeshow logging says why (bpduguard, port-security, flapping)
disabledSomeone shut it down (shutdown)The change history says who and why

Here someone plugged a small switch into their desk to get more ports. The device is removed and the port re-enabled:

SW-F2-01
configure terminalinterface Gi1/0/12 shutdown no shutdownend

If show interfaces Gi1/0/12 shows CRC errors or *input errors* going up, the problem is physical: the cable or the wall socket.

6. Remote changes with a safety net

Before a change that could lock you out
reload in 10configure terminal# ... the change ...end# if you are still connected and everything works:reload cancelcopy running-config startup-config

reload in 10 schedules a reload in 10 minutes. If the change locks you out, the device boots with the saved (previous) configuration and you get back in. If all is well, reload cancel and save. It is the difference between a two-minute fix and a trip to the site.

7. What you review each month

  • Automatic configuration backups (Oxidized, RANCID or IOS's own archive) and that the latest change is in the repository.
  • IOS XE versions against Cisco's security advisories: devices with a critical advisory have an upgrade date.
  • Ports in err-disabled and ports unused for more than 90 days (show interfaces | include line protocol|Last input): unused ones are shut down and left in a VLAN with no service.
  • That the router's track has changed as many times as the circuit has had faults. If it changes without a fault, pings are being lost and it's time to talk to the provider.

Next steps

  • 802.1X with Cisco ISE or NPS: the port gives a VLAN based on who connects, not on the port.
  • NetBox as the source of truth (which port goes to which socket) and Ansible with the cisco.ios collection for repeatable changes (Level 3 Ansible guide).
  • SD-WAN when there are many sites and the circuits are varied.
  • The FortiGate guide (coming soon) covers the firewall that usually sits between this router and the rest of the world.

Is something missing, or different in your environment? Get in touch and I'll fix it.

Tech Career Lab · newsletter

¿Te ha servido? Cada dos semanas envío una idea práctica para perfiles IT: LinkedIn, proyectos, networking y procesos de selección.Found this useful? Every two weeks I send one practical idea for IT professionals: LinkedIn, projects, networking and hiring processes.

Apúntate y llévate las 33 ideasSign up and get the 33 ideas →