Yersinia and layer 2 protocol risks: STP, DTP, CDP, and DHCP on switches
Yersinia is a lab framework for testing layer 2 protocols such as STP, DTP, CDP, and DHCP. What each protocol risk means for a switch network, and the hardening that removes it: BPDU Guard, disabled DTP, and DHCP snooping.
Diagram
Layer 2 protocols an access port should not trust
Step 1 of 4
DTP
A host negotiating a trunk could reach every VLAN.
Switch# show interfaces Gi1/0/12 switchport | include Mode Administrative Mode: dynamic auto Operational Mode: static access
The example on the open step is one illustration, or the fix you can paste into an application you own.
What this page is made of
3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.
Trunk negotiation
- What fails
- Ports left in dynamic mode can become trunks.
- Who is affected
- Every VLAN on the switch.
- What you would notice
- Access ports in dynamic auto or desirable.
- What you change
- Set switchport mode access and nonegotiate.
Spanning tree
- What fails
- BPDUs from user ports can change the topology.
- Who is affected
- The whole layer 2 domain.
- What you would notice
- No BPDU Guard on edge ports.
- What you change
- Enable BPDU Guard and Root Guard where appropriate.
Discovery leaks
- What fails
- CDP and LLDP announce details to any listener.
- Who is affected
- Network devices.
- What you would notice
- CDP enabled on user-facing ports.
- What you change
- Disable on edge ports; keep on infrastructure links if needed.
Using Yersinia responsibly
Yersinia belongs on an isolated lab switch or a simulator such as GNS3 or EVE-NG, never on a production network, where it can cause outages. In the lab, it shows whether the hardening above actually stops trunk negotiation and BPDU injection, which is the defensive question.
Auditing switch configs
Configuration audits catch most of this without sending a packet. Pull configs with your network automation tool and search for access ports missing nonegotiate or bpduguard.
$ grep -B2 -A8 "^interface GigabitEthernet1/0/" sw-floor3.cfg | grep -E "^interface|bpduguard|nonegotiate"
Check yourself
Recognition and the fix. Nothing here is a procedure.
An access port is in dynamic auto mode. What is the risk?
Sibling techniques
Pages at the same depth, plus a lab and a glossary card for this one.