GuíasGuides · Nivel 2Level 2

Switches HP y Aruba: localizar equipos con LLDP, cortar un bucle con loop-protect y spanning tree, port-security y bloqueo de MACHP and Aruba switches: locating devices with LLDP, stopping a loop with loop-protect and spanning tree, port-security and MAC lockout

Seguir una MAC por LLDP hasta la boca del puesto en ArubaOS-Switch, nombres de puerto, spanning tree con puertos de borde y protección de BPDU, loop-protect para los bucles que spanning tree no ve, port-security y lockout-mac, y una planta entera sin red por un cable entre dos rosetas.Following a MAC over LLDP to the desk port on ArubaOS-Switch, port names, spanning tree with edge ports and BPDU protection, loop-protect for the loops spanning tree misses, port-security and lockout-mac, and a whole floor without network because of a cable between two wall outlets.

¿Prefieres practicarlo?Resuelve el ticket simulado «La impresora de Ventas cambió de sitio y nadie puede imprimir» en SysAdmin Desks ↗

Qué vas a conseguir

Encontrar en qué puerto está un equipo en una red de switches HP ProCurve / ArubaOS-Switch, proteger los puertos de usuario para que un cable mal puesto no tumbe una planta, limitar qué equipos se conectan a cada boca y, cuando el bucle ya ha pasado, encontrarlo y cortarlo en minutos. La guía de VLANs, copia y firmware en switches HP cubre los comandos de cada día, las VLANs y el guardado; esta parte de ahí.

Antes de empezar

  • SSH a la IP de gestión de cada switch, nivel manager (enable) y un cable de consola a mano: durante un bucle, la gestión por red suele dejar de responder.
  • Comprueba con show version que es ArubaOS-Switch (series 2530, 2930F, 3810 y similares). AOS-CX tiene sus propios comandos de loop-protect y spanning tree.
  • Qué puertos son de usuario y cuáles son enlaces entre switches o hacia el núcleo, en cada equipo.

1. Localizar un equipo por LLDP

En ArubaOS-Switch, LLDP viene activo de fábrica. Con la MAC del equipo (o su IP, que el switch de núcleo traduce con show arp):

sw-core-01 · ¿por dónde sale la MAC?
show arp | include 10.20.0.57  10.20.0.57       a0b3cc-4f12d8     dynamic 23show mac-address a0b3cc-4f12d8  Status and Counters - Address Table - a0b3cc-4f12d8  Port   VLAN  ------ ----  23     20show lldp info remote-device 23  LLDP Remote Device Information Detail  Local Port   : 23  ChassisType  : mac-address  ChassisId    : 9c8cd8-11aa00  PortId       : 49  SysName      : sw-p3-acc01  System Descr : Aruba JL256A 2930F-48G-PoE+-4SFP+ Switch, revision WC.16.11.0021  Remote Management Address     Type    : ipv4     Address : 10.10.99.13

El puerto 23 del núcleo lleva a otro switch: el SysName y la dirección de gestión dicen a cuál entrar. En sw-p3-acc01, el mismo show mac-address a0b3cc-4f12d8 da el puerto del puesto. Si el puerto que sale tiene un switch o un punto de acceso según show lldp info remote-device, hay que seguir.

Para no repetirlo, cada puerto con su nombre:

sw-p3-acc01 · nombres de puerto
configure terminalinterface 12 name "PUESTO 3.12 R3-A-12"interface 49 name "UPLINK sw-core-01 p23"exitshow name 12write memory

2. Spanning tree: puertos de borde y protección de BPDU

Spanning tree bloquea los caminos redundantes entre switches para que las tramas no den vueltas. En ArubaOS-Switch funciona en modo MSTP y, según modelo y versión, puede venir desactivado de fábrica: show spanning-tree lo dice en la primera línea.

sw-p3-acc01 · spanning tree en un switch de acceso
configure terminalspanning-treespanning-tree 1-44 admin-edge-portspanning-tree 1-44 bpdu-protectionspanning-tree bpdu-protection-timeout 300exitshow spanning-tree bpdu-protectionwrite memory
  • El núcleo tiene que ser el puente raíz: en él, spanning-tree priority 0 (el valor es un multiplicador de 4096). Si no se fija, gana el switch con la MAC más baja, a menudo el más viejo del armario.
  • admin-edge-port en los puertos de usuario: pasan a reenviar al instante, sin esperar a spanning tree. El PC coge IP antes.
  • bpdu-protection en esos mismos puertos: si por un puerto de usuario llega una BPDU (alguien ha conectado un switch, o un cable que vuelve al propio switch), el puerto se desactiva. Con el timeout, se reactiva solo a los 300 segundos; sin él, se queda abajo hasta que alguien lo habilite.
  • En los enlaces de subida (49-50) no va ni lo uno ni lo otro.

3. Loop-protect: los bucles que spanning tree no ve

Spanning tree solo ve un bucle si las BPDU dan la vuelta. Un switch de escritorio que no las deja pasar, o un switch con spanning tree apagado, forman un bucle que nadie bloquea. Loop-protect envía sus propios paquetes de prueba por cada puerto y, si vuelven por el mismo switch, apaga el puerto:

sw-p3-acc01 · loop-protect en los puertos de usuario
configure terminalloop-protect 1-44loop-protect 1-44 receiver-action send-disableloop-protect disable-timer 300loop-protect trap loop-detectedexitshow loop-protect 1-44write memory
  • send-disable (la acción por defecto) apaga el puerto que recibe el paquete; disable-timer lo reactiva a los 300 segundos. Con 0, se queda apagado hasta que alguien lo habilite: más seguro, pero más tickets.
  • trap loop-detected manda un trap SNMP a la monitorización: es el aviso que quieres recibir antes que la llamada de la planta.
  • Loop-protect y spanning tree se complementan: spanning tree para los enlaces entre switches; loop-protect y bpdu-protection en los puertos de usuario.

4. Port-security y lockout-mac

Port-security limita qué MAC puede usar un puerto. El modo static aprende las primeras MAC hasta el límite y las deja como autorizadas, y se guardan en la configuración con write memory:

sw-p3-acc01 · puesto con PC y teléfono
configure terminalport-security 12 learn-mode static address-limit 2 action send-alarmexitshow port-security 12show port-security intrusion-logwrite memory
  • action: none, send-alarm (trap y registro, el puerto sigue) o send-disable (trap, registro y el puerto se apaga). En oficina, send-alarm para empezar y send-disable donde un equipo desconocido no puede quedarse.
  • Una intrusión levanta un indicador en el puerto. Una vez revisada, port-security 12 clear-intrusion-flag, y si el puerto se apagó, interface 12 enable.
  • Si la red usa 802.1X o autenticación por MAC contra RADIUS, el control de acceso ya lo hace eso: no se mezcla con port-security en el mismo puerto.

lockout-mac bloquea una MAC concreta en todo el switch, en cualquier puerto y VLAN: lockout-mac 3c52a1-0f4401 en configuración global. Es la medida rápida ante un equipo que no debe estar en la red mientras seguridad decide qué hacer. Se quita con no lockout-mac 3c52a1-0f4401.

5. El ticket: "toda la planta se ha quedado sin red cuando alguien ha enchufado un cable a dos rosetas"

Miércoles, 10:40. Nadie en la planta 3 tiene red: ni correo, ni impresoras, ni teléfonos. Alguien ha visto un latiguillo que sobraba en una mesa y lo ha conectado de una roseta a otra. Las luces del switch parpadean todas a la vez.

  1. Entrar: SSH no responde o va a saltos, porque la VLAN de gestión también está inundada. Consola, directamente.
  2. Confirmar el bucle: CPU alta, cambios de topología disparados y dos puertos de usuario con el mismo tráfico disparado.
sw-p3-acc01 · consola
show cpu 98 percent busy, from 300 sec agoshow spanning-tree Multiple Spanning Tree (MST) Information  STP Enabled   : Noshow interfaces port-utilization Port   Mode     | Rx Kbits/sec  Rx Util | Tx Kbits/sec  Tx Util ------ -------- + ------------- ------- + ------------- ------- 17     1000FDx  | 991250        99.1    | 990830        99.0 31     1000FDx  | 990840        99.0    | 991140        99.1 49     10GigFD  | 4870210       48.7    | 4861300       48.6

Aquí spanning tree estaba apagado y los puertos de usuario no tenían loop-protect: nadie podía cortar el bucle. Dos puertos de usuario al 99 % en recepción y transmisión, a la vez, son los dos extremos del mismo cable.

  1. Cortar: apagar uno de los dos puertos. La red vuelve en segundos.
sw-p3-acc01 · apagar un extremo
configure terminalinterface 31 disableexitshow name 17,31
  1. Retirar el cable: con los nombres de puerto (paso 1) sabes en qué rosetas está. Sin nombres, el panel de parcheo y la documentación del cableado. Se retira el latiguillo y se habilita el puerto (interface 31 enable).
  2. Que no vuelva a pasar, con un cambio aprobado: spanning tree activo con el núcleo como raíz, y en todos los puertos de usuario admin-edge-port, bpdu-protection y loop-protect. Con eso, el mismo cable apaga uno de los dos puertos en un par de segundos y el resto de la planta no se entera:
sw-p3-acc01 · la próxima vez
show loop-protect 17,31 Port Enabled Loop Detected Loop Count Rx Action    Port Status ---- ------- ------------- ---------- ------------ ----------- 17   Yes     No            0          send-disable Up 31   Yes     Yes           1          send-disable Downshow logging -r

Si el bucle pasa por un switch de escritorio que alguien ha traído, retíralo, no solo el cable. Si te piden más tomas en un puesto, es una petición de cableado o un switch gestionado, no un aparato bajo la mesa.

En el ticket: hora del corte y de la vuelta, los dos puertos y las rosetas, qué se retiró y el cambio de protección que queda pendiente o aplicado.

Siguientes pasos

¿Quieres practicarlo? Resuelve el ticket «La impresora de Ventas cambió de sitio y nadie puede imprimir» en SysAdmin Desks, gratis y en el navegador.

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

Rather practise it?Solve the simulated ticket "The Sales printer moved and nobody can print" in SysAdmin Desks ↗

What you'll get

Finding which port a device is on in a network of HP ProCurve / ArubaOS-Switch switches, protecting user ports so a misplaced cable cannot take down a floor, limiting which devices connect to each port and, once a loop has already happened, finding it and cutting it in minutes. The VLANs, backup and firmware on HP switches guide covers the everyday commands, VLANs and saving; this one picks up from there.

Before you start

  • SSH to each switch's management IP, manager level (enable) and a console cable at hand: during a loop, network management usually stops responding.
  • Check with show version that it is ArubaOS-Switch (2530, 2930F, 3810 series and similar). AOS-CX has its own loop-protect and spanning tree commands.
  • Which ports are user ports and which are links between switches or to the core, on each device.

1. Locating a device with LLDP

On ArubaOS-Switch, LLDP is on out of the box. With the device's MAC (or its IP, which the core switch translates with show arp):

sw-core-01 · which port does the MAC leave through?
show arp | include 10.20.0.57  10.20.0.57       a0b3cc-4f12d8     dynamic 23show mac-address a0b3cc-4f12d8  Status and Counters - Address Table - a0b3cc-4f12d8  Port   VLAN  ------ ----  23     20show lldp info remote-device 23  LLDP Remote Device Information Detail  Local Port   : 23  ChassisType  : mac-address  ChassisId    : 9c8cd8-11aa00  PortId       : 49  SysName      : sw-p3-acc01  System Descr : Aruba JL256A 2930F-48G-PoE+-4SFP+ Switch, revision WC.16.11.0021  Remote Management Address     Type    : ipv4     Address : 10.10.99.13

Port 23 on the core leads to another switch: the SysName and the management address tell you which one to log into. On sw-p3-acc01, the same show mac-address a0b3cc-4f12d8 gives the desk port. If show lldp info remote-device shows a switch or an access point on the port you land on, keep going.

So you don't have to repeat it, each port gets its name:

sw-p3-acc01 · port names
configure terminalinterface 12 name "DESK 3.12 R3-A-12"interface 49 name "UPLINK sw-core-01 p23"exitshow name 12write memory

2. Spanning tree: edge ports and BPDU protection

Spanning tree blocks redundant paths between switches so frames don't go round in circles. On ArubaOS-Switch it runs in MSTP mode and, depending on model and version, may be disabled out of the box: show spanning-tree tells you on the first line.

sw-p3-acc01 · spanning tree on an access switch
configure terminalspanning-treespanning-tree 1-44 admin-edge-portspanning-tree 1-44 bpdu-protectionspanning-tree bpdu-protection-timeout 300exitshow spanning-tree bpdu-protectionwrite memory
  • The core has to be the root bridge: on it, spanning-tree priority 0 (the value is a multiplier of 4096). If it isn't set, the switch with the lowest MAC wins, often the oldest one in the cabinet.
  • admin-edge-port on user ports: they start forwarding straight away, without waiting for spanning tree. The PC gets its IP sooner.
  • bpdu-protection on those same ports: if a BPDU arrives on a user port (someone has plugged in a switch, or a cable loops back to the same switch), the port is disabled. With the timeout, it re-enables itself after 300 seconds; without it, it stays down until someone enables it.
  • Neither goes on the uplinks (49-50).

3. Loop-protect: the loops spanning tree misses

Spanning tree only sees a loop if the BPDUs come back round. A desktop switch that doesn't pass them, or a switch with spanning tree off, forms a loop nobody blocks. Loop-protect sends its own test packets out of each port and, if they come back to the same switch, shuts the port down:

sw-p3-acc01 · loop-protect on user ports
configure terminalloop-protect 1-44loop-protect 1-44 receiver-action send-disableloop-protect disable-timer 300loop-protect trap loop-detectedexitshow loop-protect 1-44write memory
  • send-disable (the default action) shuts down the port that receives the packet; disable-timer re-enables it after 300 seconds. With 0, it stays off until someone enables it: safer, but more tickets.
  • trap loop-detected sends an SNMP trap to monitoring: it is the alert you want to get before the floor calls.
  • Loop-protect and spanning tree complement each other: spanning tree for the links between switches; loop-protect and bpdu-protection on user ports.

4. Port-security and lockout-mac

Port-security limits which MACs can use a port. Static mode learns the first MACs up to the limit and keeps them as authorised, and they are saved in the configuration with write memory:

sw-p3-acc01 · desk with a PC and a phone
configure terminalport-security 12 learn-mode static address-limit 2 action send-alarmexitshow port-security 12show port-security intrusion-logwrite memory
  • action: none, send-alarm (trap and log, the port stays up) or send-disable (trap, log and the port shuts down). In an office, send-alarm to start with and send-disable where an unknown device cannot stay.
  • An intrusion raises a flag on the port. Once reviewed, port-security 12 clear-intrusion-flag, and if the port was shut down, interface 12 enable.
  • If the network uses 802.1X or MAC authentication against RADIUS, that already does the access control: don't mix it with port-security on the same port.

lockout-mac blocks a specific MAC across the whole switch, on any port and VLAN: lockout-mac 3c52a1-0f4401 in global configuration. It is the quick measure for a device that shouldn't be on the network while security decides what to do. It is removed with no lockout-mac 3c52a1-0f4401.

5. The ticket: "the whole floor lost network when someone plugged a cable into two wall ports"

Wednesday, 10:40. Nobody on floor 3 has network: no email, no printers, no phones. Someone saw a spare patch cable on a desk and plugged it from one wall outlet into another. All the switch's lights are flashing at once.

  1. Get in: SSH doesn't answer or lurches, because the management VLAN is flooded too. Console, straight away.
  2. Confirm the loop: high CPU, topology changes going wild and two user ports with the same runaway traffic.
sw-p3-acc01 · console
show cpu 98 percent busy, from 300 sec agoshow spanning-tree Multiple Spanning Tree (MST) Information  STP Enabled   : Noshow interfaces port-utilization Port   Mode     | Rx Kbits/sec  Rx Util | Tx Kbits/sec  Tx Util ------ -------- + ------------- ------- + ------------- ------- 17     1000FDx  | 991250        99.1    | 990830        99.0 31     1000FDx  | 990840        99.0    | 991140        99.1 49     10GigFD  | 4870210       48.7    | 4861300       48.6

Here spanning tree was off and the user ports had no loop-protect: nothing could break the loop. Two user ports at 99% receive and transmit, at the same time, are the two ends of the same cable.

  1. Cut it: disable one of the two ports. The network comes back within seconds.
sw-p3-acc01 · disable one end
configure terminalinterface 31 disableexitshow name 17,31
  1. Remove the cable: with the port names (step 1) you know which outlets it is on. Without names, the patch panel and the cabling records. The patch cable is removed and the port enabled (interface 31 enable).
  2. So it doesn't happen again, with an approved change: spanning tree on with the core as root, and on every user port admin-edge-port, bpdu-protection and loop-protect. With that, the same cable shuts down one of the two ports in a couple of seconds and the rest of the floor never notices:
sw-p3-acc01 · next time
show loop-protect 17,31 Port Enabled Loop Detected Loop Count Rx Action    Port Status ---- ------- ------------- ---------- ------------ ----------- 17   Yes     No            0          send-disable Up 31   Yes     Yes           1          send-disable Downshow logging -r

If the loop goes through a desktop switch someone brought in, remove it, not just the cable. If a desk needs more ports, that is a cabling request or a managed switch, not a box under the desk.

In the ticket: time of the outage and of recovery, the two ports and outlets, what was removed and the protection change, pending or applied.

Next steps

Want to practise it? Solve the ticket “The Sales printer moved and nobody can print” in SysAdmin Desks, free and in your browser.

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 →