IT141 · SESSION 9 · FIELD NOTES

Switch Security Configuration: Locking the Doors

Session 8 walked the building and listed every way in. This session closes them, one feature at a time: empty ports parked, every desk port limited to the device that belongs there, DHCP answers accepted only from the direction of the real server, forged ARP replies dropped, and any port that hears a BPDU shut on the spot. The hard part isn't the commands. It's deciding which ports to trust.

New material Module 11 — Switch Security Configuration Network change HQ and Shipping hardened Next session Modules 12–13 — WLAN Concepts and Configuration

Module 11

What Session 9 covers

One module, in NetAcad's order: securing unused ports and configuring port security; the steps that stop VLAN attacks; DHCP snooping; Dynamic ARP Inspection; and PortFast with BPDU Guard. Each one answers an attack from Session 8.

Cold open · Night Shift, the next week

The Surveyor pins Case File D-06 to the NOC's corkboard and hands the Rookie a list. "Every trick on that card, and the door it comes through. Tonight we close them." The Rookie reads it twice. "Most of these are one command." "Most of them are one command," she agrees. "The hard part is the word next to it. Trusted, or untrusted. Get that wrong on one port and you've either locked out the real DHCP server, or let the Impostor sign for it."

Topology used on this page The network as Sessions 7 and 8 left it. Today HQ and Shipping change: S1, S2 and S3 get every feature on this page. D1, R1 and R2 don't change. The edge ports are every port that isn't a link between switches: f0/1 - 22 on S1 and S2 (Session 4's preview used f0/1 - 20; the two spares are edge ports too), and every S3 port except G0/1, its uplink to R2. Every edge feature goes on the whole range, parked ports included, so a port that's unparked later is already protected. Some output is labelled illustration: what the switches would log if someone tried. The MAC addresses are made up.
The order matters DHCP snooping goes on first, then the DHCP clients renew so the switches record their leases, and only then Dynamic ARP Inspection. Leases from Session 6 were handed out before snooping existed, so the switches have no record of them. Turn on DAI first and it would cut PC-D off.

Module 11.1

Park every unused port

The simplest defence there is: a port nobody uses should be shut. HQ has parked its spare ports in VLAN 999 since Session 2, but left the empty desk jacks inside the VLAN 10 and 30 ranges live. Session 8's exposure map called those the main hole. Session 2 promised this session would close it.

Every empty desk jack goes into VLAN 999, the parking VLAN, and is shut. That includes S1 F0/5, the jack every Session 8 illustration used.

S1 · park everything but PC-A
S1# configure terminal ! PC-A stays on F0/1. Everything else in the desk ranges is empty. S1(config)# interface range f0/2 - 20 S1(config-if-range)# switchport mode access S1(config-if-range)# switchport access vlan 999 S1(config-if-range)# shutdown S1(config-if-range)# end
S2 · park around PC-C and PC-D
S2# configure terminal ! PC-C is on F0/1 and PC-D is on F0/11. Park around them. S2(config)# interface range f0/2 - 10 , f0/12 - 20 S2(config-if-range)# switchport mode access S2(config-if-range)# switchport access vlan 999 S2(config-if-range)# shutdown S2(config-if-range)# end

S3 at Shipping has never had a parking VLAN, so it's created first. S3's three devices and its uplink are also set to access mode explicitly; port security will need that.

S3 · create VLAN 999, then park
S3# configure terminal ! S3 has never had VLAN 999. Create it first. S3(config)# vlan 999 S3(config-vlan)# name PARKING S3(config-vlan)# exit ! The three Shipping devices and the uplink, set explicitly S3(config)# interface range f0/1 - 3 , g0/1 S3(config-if-range)# switchport mode access S3(config-if-range)# switchport access vlan 20 S3(config-if-range)# exit ! Everything else is parked S3(config)# interface range f0/4 - 24 , g0/2 S3(config-if-range)# switchport mode access S3(config-if-range)# switchport access vlan 999 S3(config-if-range)# shutdown S3(config-if-range)# end
S2 · the proof
S2# show interfaces status Port Name Status Vlan Duplex Speed Type Fa0/1 connected 10 a-full a-100 10/100BaseTX Fa0/2 disabled 999 auto auto 10/100BaseTX Fa0/3 disabled 999 auto auto 10/100BaseTX ... Fa0/10 disabled 999 auto auto 10/100BaseTX Fa0/11 connected 30 a-full a-100 10/100BaseTX Fa0/12 disabled 999 auto auto 10/100BaseTX ... Fa0/21 disabled 999 auto auto 10/100BaseTX Fa0/22 disabled 999 auto auto 10/100BaseTX Fa0/23 connected trunk a-full a-100 10/100BaseTX Fa0/24 connected trunk a-full a-100 10/100BaseTX Gi0/1 connected trunk a-full a-1000 10/100/1000BaseTX Gi0/2 connected trunk a-full a-1000 10/100/1000BaseTX Po1 connected trunk a-full a-100 Po3 connected trunk a-full a-1000
S2 · shut ports still belong to their VLAN
S2# show vlan brief VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active 10 FRONT-DESK active Fa0/1 30 LOGISTICS active Fa0/11 99 MGMT active 900 NATIVE active 999 PARKING active Fa0/2, Fa0/3, Fa0/4, Fa0/5 Fa0/6, Fa0/7, Fa0/8, Fa0/9 Fa0/10, Fa0/12, Fa0/13, Fa0/14 Fa0/15, Fa0/16, Fa0/17, Fa0/18 Fa0/19, Fa0/20, Fa0/21, Fa0/22 1002 fddi-default act/unsup ...

Module 11.1

Port security

Port security limits how many MAC addresses may use a port, and which ones. Each frame's source MAC is checked against the port's list of secure MAC addresses. That stops MAC address flooding cold: the thousandth made-up address never gets in.

Only on a port that's been told what it is

Illustration A 2960 straight out of the box, not an HQ switch (look at the prompt).
A factory-default 2960 · port security on a dynamic port
Switch# configure terminal Switch(config)# interface f0/1 Switch(config-if)# switchport port-security Command rejected: FastEthernet0/1 is a dynamic port. Switch(config-if)# switchport mode access Switch(config-if)# switchport port-security Switch(config-if)# end

Port security works only on a port set to access (or trunk) by hand. A default 2960 port is dynamic auto, Session 2's "Will it trunk?" again. At HQ this never comes up: every desk port has been switchport mode access since Session 2.

Three ways to learn a secure address

MethodCommandSurvives a reload?
Static (manually configured)switchport port-security mac-address macYes, once the configuration is saved
DynamicNone: the switch learns the address of whatever is plugged inNo: it's forgotten after a reload, and whenever the link goes down (unplug the PC and the port learns whatever comes next)
Sticky (dynamically learned, kept)switchport port-security mac-address stickyYes, once the running configuration is saved: the learned address is written into it

The default maximum is one address per port; switchport port-security maximum raises it. The highest value allowed depends on the switch.

HQ's choices

SettingHQ usesWhy
Maximum1 (the default)One PC per desk
LearningStickyEach desk learns its PC once and keeps it, even with the cable out. Dynamic would forget the PC the moment it's unplugged, and accept whatever was plugged in next.
Violation modeShutdown (the default)A stranger at a desk cuts the desk off until someone looks
SRV1 (S3 F0/2)RestrictDrop and log a stranger, but keep web and DNS online for everyone
Trunks, port-channels, S3 G0/1NoneLinks between devices HQ controls; a violation there would cut off a whole switch. Trunk port security is beyond this course.
S1 · every edge port (S2 is identical)
S1# configure terminal S1(config)# interface range f0/1 - 22 S1(config-if-range)# switchport port-security ! The next two lines are the defaults, typed so the choice is visible. ! Neither appears in the running config. S1(config-if-range)# switchport port-security maximum 1 S1(config-if-range)# switchport port-security violation shutdown S1(config-if-range)# switchport port-security mac-address sticky S1(config-if-range)# end S1# copy running-config startup-config
S3 · every port but the uplink; SRV1 restricts
S3# configure terminal ! Every port except G0/1, the uplink to R2 S3(config)# interface range f0/1 - 24 , g0/2 S3(config-if-range)# switchport port-security S3(config-if-range)# switchport port-security maximum 1 S3(config-if-range)# switchport port-security violation shutdown S3(config-if-range)# switchport port-security mac-address sticky S3(config-if-range)# exit ! SRV1: drop and log a stranger, but keep the server online S3(config)# interface f0/2 S3(config-if)# switchport port-security violation restrict S3(config-if)# end S3# copy running-config startup-config

Verify

S2 · PC-C's port
S2# show port-security interface f0/1 Port Security : Enabled Port Status : Secure-up Violation Mode : Shutdown Aging Time : 0 mins Aging Type : Absolute SecureStatic Address Aging : Disabled Maximum MAC Addresses : 1 Total MAC Addresses : 1 Configured MAC Addresses : 0 Sticky MAC Addresses : 1 Last Source Address:Vlan : 00e0.f70c.0011:10 Security Violation Count : 0
S2 · every secure port
S2# show port-security Secure Port MaxSecureAddr CurrentAddr SecurityViolation Security Action (Count) (Count) (Count) --------------------------------------------------------------------------- Fa0/1 1 1 0 Shutdown Fa0/2 1 0 0 Shutdown ... Fa0/11 1 1 0 Shutdown Fa0/12 1 0 0 Shutdown ... Fa0/22 1 0 0 Shutdown --------------------------------------------------------------------------- Total Addresses in System (excluding one mac per port) : 0 Max Addresses limit in System (excluding one mac per port) : 8192
S2 · the secure addresses
S2# show port-security address Secure Mac Address Table ----------------------------------------------------------------------------- Vlan Mac Address Type Ports Remaining Age (mins) ---- ----------- ---- ----- ------------- 10 00e0.f70c.0011 SecureSticky Fa0/1 - 30 0090.2b5d.0030 SecureSticky Fa0/11 - ----------------------------------------------------------------------------- Total Addresses in System (excluding one mac per port) : 0 Max Addresses limit in System (excluding one mac per port) : 8192
S2 · the sticky line in the configuration
S2# show running-config interface f0/1 Building configuration... Current configuration : ... ! interface FastEthernet0/1 switchport access vlan 10 switchport mode access switchport port-security switchport port-security mac-address sticky switchport port-security mac-address sticky 00e0.f70c.0011 end

Aging

Secure addresses can be set to expire, so a port can be reused without anyone deleting the old address by hand. switchport port-security aging time sets the time, and aging type picks how it counts: absolute (deleted after the time, whatever happens) or inactivity (deleted only after the device has been silent that long).

Illustration A shared hot desk where a different laptop sits every day. HQ's desks are sticky, so HQ doesn't use aging.
A hot-desk port · ten minutes of silence frees it
Switch(config)# interface f0/7 Switch(config-if)# switchport mode access Switch(config-if)# switchport port-security Switch(config-if)# switchport port-security aging time 10 Switch(config-if)# switchport port-security aging type inactivity Switch(config-if)# end Switch# show port-security interface f0/7 Port Security : Enabled Port Status : Secure-up Violation Mode : Shutdown Aging Time : 10 mins Aging Type : Inactivity SecureStatic Address Aging : Disabled ...

Aging and sticky answer opposite needs: sticky keeps a desk's PC forever, aging lets the desk forget. Don't combine them.

Module 11.1

Violations and err-disabled ports

A violation happens when a frame arrives from a MAC address that isn't secure on the port, and the port already has its maximum. What the switch does next is the violation mode.

In every mode, frames from the unknown MAC are dropped. The modes differ in what else happens.

ModeKnown device's trafficSyslog messageViolation counterPort err-disabled
shutdown (default)Stops too: the whole port goes downYesIncrementsYes, until shutdown then no shutdown
restrictKeeps flowingYesIncrementsNo
protectKeeps flowingNoNoNo

Protect is the least secure, because nobody ever finds out. Restrict is the middle choice, and it's why SRV1 uses it:

S3 · SRV1 restricts instead of shutting
S3# show port-security interface f0/2 Port Security : Enabled Port Status : Secure-up Violation Mode : Restrict Aging Time : 0 mins Aging Type : Absolute SecureStatic Address Aging : Disabled Maximum MAC Addresses : 1 Total MAC Addresses : 1 Configured MAC Addresses : 0 Sticky MAC Addresses : 1 Last Source Address:Vlan : 0001.64a2.0100:20 Security Violation Count : 0

Under restrict, a stranger on SRV1's port would be dropped and logged, the counter would go up, and the port would stay Secure-up, still serving web and DNS.

A violation, start to finish

Session 8's intruder is back. F0/5 is parked now, so the only way into VLAN 10 is to take a live desk: it unplugs PC-C and plugs into S2 F0/1. That desk already knows its PC.

Illustration What the switch would log. The course network never did this.
S2 · the log
%PM-4-ERR_DISABLE: psecure-violation error detected on Fa0/1, putting Fa0/1 in err-disable state %PORT_SECURITY-2-PSECURE_VIOLATION: Security violation occurred, caused by MAC address 0040.0bad.0005 on port FastEthernet0/1. %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to down
S2 · err-disabled, not administratively down
S2# show interfaces f0/1 FastEthernet0/1 is down, line protocol is down (err-disabled) Hardware is Lance, address is ... ...
S2 · who did it, and how many times
S2# show port-security interface f0/1 Port Security : Enabled Port Status : Secure-shutdown Violation Mode : Shutdown Aging Time : 0 mins Aging Type : Absolute SecureStatic Address Aging : Disabled Maximum MAC Addresses : 1 Total MAC Addresses : 1 Configured MAC Addresses : 0 Sticky MAC Addresses : 1 Last Source Address:Vlan : 0040.0bad.0005:10 Security Violation Count : 1

Recovery, once the laptop is gone and PC-C is plugged back in:

S2 · bring the desk back
S2# configure terminal S2(config)# interface f0/1 S2(config-if)# shutdown S2(config-if)# no shutdown S2(config-if)# end %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

Module 11.2

Mitigate VLAN attacks

NetAcad's five steps against VLAN hopping. HQ's design has followed every one since Session 2, so this is a check, not a change.

StepCommandAt HQ
1 · No DTP on access portsswitchport mode accessEvery host port, since Session 2
2 · Unused ports shut, in an unused VLANshutdown, switchport access vlan 999Finished today
3 · Trunks made by handswitchport mode trunkEvery trunk, since Session 2
4 · No DTP on trunksswitchport nonegotiateEvery trunk, since Session 2
5 · A native VLAN other than VLAN 1switchport trunk native vlan vlanVLAN 900, with no hosts, since Session 2
S1 · every trunk static, native VLAN 900
S1# show interfaces trunk Port Mode Encapsulation Status Native vlan Po1 on 802.1q trunking 900 Po2 on 802.1q trunking 900 Port Vlans allowed on trunk Po1 10,30,99,900 Po2 10,30,99,900 Port Vlans allowed and active in management domain Po1 10,30,99,900 Po2 10,30,99,900 Port Vlans in spanning tree forwarding state and not pruned Po1 10,30,99,900 Po2 10,30,99,900

Module 11.3

DHCP snooping

Port security alone can stop the simplest DHCP starvation, where each request comes from a new source MAC. It can't stop a tool that keeps one real source MAC and puts made-up addresses inside the DHCP message, and it does nothing against a rogue server. DHCP snooping does.

DHCP snooping sorts every port into two kinds:

TrustedUntrusted (the default)
Which portsThe ones that lead toward the real DHCP server: uplinks and trunks to devices the network team controlsEvery access port, and anything else
DHCP server messages (OFFER, ACK)AllowedDropped: no device here should be answering DHCP
Client requestsAllowedAllowed, up to a rate limit

As leases pass through, the switch records each client on an untrusted port in its DHCP snooping binding table: the MAC address, the IP address it was given, the VLAN and the port. Dynamic ARP Inspection depends on that table.

Four steps: ip dhcp snooping globally; ip dhcp snooping trust on the trusted ports; ip dhcp snooping limit rate on the untrusted ones; and ip dhcp snooping vlan for the VLANs to protect. Snooping does nothing in a VLAN that isn't listed.

HQ's trusted ports

SwitchTrustedWhy
S1Po2 (to D1), Po1 (to S2)R1's replies come back through D1's relay
S2Po3 (to D1), Po1 (to S1)The same, from S2's side
S3G0/1 (to R2)R2 is Shipping's DHCP server
S2 · DHCP snooping, with the VLAN line last (S1 is the same, trusting Po2 and Po1)
S2# configure terminal S2(config)# ip dhcp snooping ! Real IOS: stop the switch adding option 82 (see below) S2(config)# no ip dhcp snooping information option ! The two port-channels toward D1 and S1 carry the real server's replies S2(config)# interface port-channel 3 S2(config-if)# ip dhcp snooping trust S2(config-if)# interface port-channel 1 S2(config-if)# ip dhcp snooping trust S2(config-if)# exit ! Every edge port stays untrusted (the default), with a rate limit S2(config)# interface range f0/1 - 22 S2(config-if-range)# ip dhcp snooping limit rate 6 S2(config-if-range)# exit ! Last: turn it on for the user VLANs S2(config)# ip dhcp snooping vlan 10,30 S2(config)# end
S3 · Shipping trusts its uplink to R2
S3# configure terminal S3(config)# ip dhcp snooping S3(config)# no ip dhcp snooping information option ! The uplink to R2, Shipping's DHCP server S3(config)# interface g0/1 S3(config-if)# ip dhcp snooping trust S3(config-if)# exit S3(config)# interface range f0/1 - 24 , g0/2 S3(config-if-range)# ip dhcp snooping limit rate 6 S3(config-if-range)# exit S3(config)# ip dhcp snooping vlan 20 S3(config)# end
The option 82 line Not on Module 11's list, but needed on real switches. By default a snooping switch adds a tag (DHCP option 82) to each client request, saying which switch and port it came from, and leaves the relay-address field at zero. D1's relay and R2's server treat that combination as suspicious and drop the request, so every new lease would fail. no ip dhcp snooping information option on the three access switches stops the tag, so D1, R1 and R2 need no change.

Then every DHCP client renews, so the switches watch a full exchange and record a binding: PC-C and PC-D at HQ, PC-B at Shipping.

PC-C, PC-D and PC-B · renew under snooping
C:\> ipconfig /release C:\> ipconfig /renew

What snooping doesn't cover: DHCPv6 and router advertisements. PC-B's SLAAC and stateless DHCPv6, and Session 7's stray-router warning, are untouched. The IPv6 equivalents (RA Guard, DHCPv6 Guard) are beyond this course.

Verify

S2 · snooping on, the trusted ports, the rate limits
S2# show ip dhcp snooping Switch DHCP snooping is enabled DHCP snooping is configured on following VLANs: 10,30 DHCP snooping is operational on following VLANs: 10,30 DHCP snooping is configured on the following L3 Interfaces: Insertion of option 82 is disabled circuit-id default format: vlan-mod-port remote-id: 0002.16aa.0012 (MAC) Option 82 on untrusted port is not allowed Verification of hwaddr field is enabled Verification of giaddr field is enabled DHCP snooping trust/rate is configured on the following Interfaces: Interface Trusted Allow option Rate limit (pps) ----------------------- ------- ------------ ---------------- FastEthernet0/1 no no 6 Custom circuit-ids: FastEthernet0/2 no no 6 Custom circuit-ids: ... FastEthernet0/22 no no 6 Custom circuit-ids: Port-channel1 yes yes unlimited Custom circuit-ids: Port-channel3 yes yes unlimited Custom circuit-ids:
S2 · the binding table
S2# show ip dhcp snooping binding MacAddress IpAddress Lease(sec) Type VLAN Interface ------------------ --------------- ---------- ------------- ---- -------------------- 00:E0:F7:0C:00:11 192.168.10.101 86367 dhcp-snooping 10 FastEthernet0/1 00:90:2B:5D:00:30 192.168.30.10 86372 dhcp-snooping 30 FastEthernet0/11 Total number of bindings: 2

Two rogue servers at Shipping

Session 6 warned about the home router plugged in by a LAN port, and Session 8 showed what PC-B would get. Now:

Illustration What the switch would log. The course network never did this.

Case 1: the home router moves to a LAN port. Its LAN side has a different MAC from the internet port stuck on F0/3, so port security catches it first:

S3 · port security gets there first
%PM-4-ERR_DISABLE: psecure-violation error detected on Fa0/3, putting Fa0/3 in err-disable state %PORT_SECURITY-2-PSECURE_VIOLATION: Security violation occurred, caused by MAC address 0001.97e1.0004 on port FastEthernet0/3. %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to down

Case 2: an allowed device starts answering DHCP. Someone turns on SRV1's own DHCP service. SRV1's MAC is the sticky one, so port security has no objection. Only snooping can stop this one. S3 drops the offer, because F0/2 is untrusted; newer IOS versions also log it:

S3 · an OFFER on an untrusted port
%DHCP_SNOOPING-5-DHCP_SNOOPING_UNTRUSTED_PORT: DHCP_SNOOPING drop message on untrusted port, message type: DHCPOFFER, MAC sa: 0001.64a2.0100
PC-B · still R2's lease
C:\> ipconfig /all ... Physical Address................: 0060.70AA.0020 ... IPv4 Address....................: 192.168.20.102 Subnet Mask.....................: 255.255.255.0 Default Gateway.................: FE80::2 192.168.20.1 DHCP Servers....................: 192.168.20.1 ...

Module 11.4

Dynamic ARP Inspection

DAI checks every ARP message that arrives on an untrusted port against the DHCP snooping binding table. If the IP-to-MAC pairing in the ARP message isn't in the table, the message is dropped and logged. A forged "the gateway is at my MAC", like Session 8's, is dropped before any host sees it, in every VLAN where DAI runs.

VLAN 30 only

S2 · DAI on VLAN 30 (S1 is the same, trusting Po2 and Po1)
S2# configure terminal S2(config)# ip arp inspection vlan 30 S2(config)# ip arp inspection validate src-mac dst-mac ip ! D1's SVI (192.168.30.1) is static, so it has no binding. Its ARPs arrive on the trunks. S2(config)# interface port-channel 3 S2(config-if)# ip arp inspection trust S2(config-if)# interface port-channel 1 S2(config-if)# ip arp inspection trust S2(config-if)# end S2# copy running-config startup-config

Verify

S2 · DAI active on VLAN 30, all three checks on
S2# show ip arp inspection vlan 30 Source Mac Validation : Enabled Destination Mac Validation : Enabled IP Address Validation : Enabled Vlan Configuration Operation ACL Match Static ACL ---- ------------- --------- --------- ---------- 30 Enabled Active Vlan ACL Logging DHCP Logging Probe Logging ---- ----------- ------------ ------------- 30 Deny Deny Off
S2 · the trunks trusted, the desks rate-limited
S2# show ip arp inspection interfaces Interface Trust State Rate (pps) Burst Interval --------------- ----------- ---------- -------------- Fa0/1 Untrusted 15 1 ... Fa0/11 Untrusted 15 1 ... Po1 Trusted None N/A Po3 Trusted None N/A

What DAI stops. No stranger can reach VLAN 30 any more: F0/11 sticks to PC-D, and the rest are parked. So the attack would have to come from PC-D itself, a legitimate PC with malware on it, sending gratuitous ARPs that say "192.168.30.1 is at my MAC". PC-D's MAC is the allowed one, so port security passes it.

Illustration What the switch would log. The course network never did this.
S2 · the forged ARP, dropped
%SW_DAI-4-DHCP_SNOOPING_DENY: 1 Invalid ARPs (Res) on Fa0/11, vlan 30.([0090.2b5d.0030/192.168.30.1/ffff.ffff.ffff/192.168.30.1/...])

Module 11.5

PortFast and BPDU Guard

Two features, always used together on access ports. PortFast puts a host port straight into forwarding, skipping the wait while STP checks for loops. BPDU Guard err-disables that port the moment a BPDU arrives on it, because a port with only a host on it should never hear one.

Session 4 callback Session 4 showed these commands as syntax, and explained why PortFast on a link to another switch can cause a loop. Here they go on for real, on host ports only.
S2 · PortFast and BPDU Guard on every edge port (S1 is the same; S3 uses its own range)
S2# configure terminal S2(config)# interface range f0/1 - 22 S2(config-if-range)# spanning-tree portfast %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 %Portfast will be configured in 22 interfaces due to the range command but will only have effect when the interfaces are in a non-trunking mode. S2(config-if-range)# spanning-tree bpduguard enable S2(config-if-range)# end S2# copy running-config startup-config

The other way, which Session 4 also printed. HQ doesn't use it, but it gives the same protection: portfast default covers every port in access mode, and portfast bpduguard default covers every port running PortFast (not "every access port", as NetAcad's slide puts it).

The global alternative
S2(config)# spanning-tree portfast default S2(config)# spanning-tree portfast bpduguard default

Verify

S2 · the global defaults are off, correctly
S2# show spanning-tree summary Switch is in rapid-pvst mode Root bridge for: none Extended system ID is enabled Portfast Default is disabled PortFast BPDU Guard Default is disabled Portfast BPDU Filter Default is disabled Loopguard Default is disabled EtherChannel misconfig guard is enabled UplinkFast is disabled BackboneFast is disabled Configured Pathcost method used is short ...
S2 · PC-D's port in detail
S2# show spanning-tree interface f0/11 detail Port 11 (FastEthernet0/11) of VLAN0030 is designated forwarding Port path cost 19, Port priority 128, Port Identifier 128.11. Designated root has priority 24606, address 00d0.97cc.00d1 Designated bridge has priority 32798, address 0002.16aa.0012 Designated port id is 128.11, designated path cost 3 Timers: message age 0, forward delay 0, hold 0 Number of transitions to forwarding state: 1 The port is in the portfast mode Link type is point-to-point by default Bpdu guard is enabled BPDU: sent ..., received 0
S2 · Edge in the spanning tree
S2# show spanning-tree vlan 30 ... Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Fa0/11 Desg FWD 19 128.11 P2p Edge Po1 Altn BLK 9 128.27 P2p Po3 Root FWD 3 128.29 P2p

A switch at a desk

Someone at PC-D's desk plugs in a small managed switch, to share the jack with a printer. The small switch runs STP, and sends BPDUs as soon as its link comes up.

Illustration What the switch would log. The course network never did this.
S2 · BPDU Guard fires
%SPANTREE-2-BLOCK_BPDUGUARD: Received BPDU on port Fa0/11 with BPDU Guard enabled. Disabling port. %PM-4-ERR_DISABLE: bpduguard error detected on Fa0/11, putting Fa0/11 in err-disable state %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/11, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/11, changed state to down
S2 · the reason column
S2# show interfaces status err-disabled Port Name Status Reason Err-disabled Vlans Fa0/11 err-disabled bpduguard

Recovery, once the small switch is gone and PC-D is plugged straight back in:

S2 · bring the desk back
S2# configure terminal S2(config)# interface f0/11 S2(config-if)# shutdown S2(config-if)# no shutdown S2(config-if)# end

Module 10 follow-up

CDP off on the desk ports

Session 8 showed what CDP gives away to anyone on a desk port, and said HQ would turn it off there in this session. The trunks keep it.

S1 · CDP off on every edge port (S2 is the same; S3 keeps it on G0/1)
S1# configure terminal S1(config)# interface range f0/1 - 22 S1(config-if-range)# no cdp enable S1(config-if-range)# end S1# copy running-config startup-config
S1 · only the links between switches still speak CDP
S1# show cdp interface FastEthernet0/23 is up, line protocol is up Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds FastEthernet0/24 is up, line protocol is up Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/1 is up, line protocol is up Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/2 is up, line protocol is up Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds

Case File D-06

Case closed: The Impostor

Every trick on Session 8's card, and what stops it now.

S2 · PC-D's desk port: every layer in one place
S2# show running-config interface f0/11 Building configuration... Current configuration : ... ! interface FastEthernet0/11 switchport access vlan 30 switchport mode access switchport port-security switchport port-security mac-address sticky switchport port-security mac-address sticky 0090.2b5d.0030 no cdp enable spanning-tree portfast spanning-tree bpduguard enable ip dhcp snooping limit rate 6 end
STATUS: CONTAINED

CASE FILE D-06

The Impostor

Every empty jack is shut, and every desk knows its PC. It can't flood a table, hand out addresses, forge the gateway in VLAN 30, or claim the root. What's left needs an inside job: a PC that's already allowed, in a VLAN with no ARP inspection, or anything that speaks IPv6 router advertisements.

Tell, now: an err-disabled desk port in show interfaces status err-disabled, with its Reason; a violation count in show port-security; a drop in show ip arp inspection statistics.

See also: Session 8's exposure map · Trust or not?

Trick (Session 8)Stopped byStill open
MAC address floodingPort security, max 1 sticky: the first made-up address shuts the port. Every unused port parked.Nothing at a desk
VLAN hopping, double-taggingThe five steps, done since Session 2Nothing
DHCP starvationPort security (a second source MAC shuts the port), and snooping's MAC check: a request whose client MAC doesn't match the frame's source is dropped on an untrusted port. The rate limit slows anything that's left.Nothing at a desk
DHCP spoofingSnooping: OFFERs only on trusted portsIPv6 RAs and DHCPv6 (beyond this course)
ARP spoofing and poisoningDAI on VLAN 30; parking closes Session 8's VLAN 10 jackA compromised PC in VLAN 10 or at Shipping: no DAI there, because of the static hosts
MAC and IP spoofingPartly: port security flags a known MAC on a second secure portIP Source Guard is named only
STP manipulationBPDU Guard on every desk portNothing at a desk
CDP reconnaissanceCDP off on every desk portNothing at a desk
Debrief Snooping and DAI have the same rule for every port: trusted or untrusted. What happens if an access port is marked trusted by mistake, and what happens if an uplink is left untrusted? (A trusted access port lets a rogue DHCP server, or forged ARPs, through it unchecked: The Impostor signs for the real server. An untrusted uplink blocks the real server's OFFERs, or the gateway's ARP replies, so new clients get no lease and VLAN 30 loses its gateway. One mistake opens a door; the other locks out the people who belong.)

Drill

Trust or not?

A port on this network, and a feature. Should the port be trusted?

Drill · Trust or not?

Watch for this

Common Module 11 mistakes

Most Module 11 faults are a feature switched on but not pointed anywhere, or the trust setting on the wrong side of a link.

1 · Snooping on, but no VLAN

ip dhcp snooping alone does nothing. Without ip dhcp snooping vlan, nothing is filtered and the binding table stays empty. show ip dhcp snooping shows an empty VLAN list.

2 · The uplink left untrusted

The real server's OFFERs are dropped like a rogue's: new clients get 169.254. Check the trusted list in show ip dhcp snooping.

3 · Trust on the member ports

On a bundle, trust goes on the port-channel. show ip dhcp snooping should list Port-channel3, not GigabitEthernet0/1.

4 · Option 82 left on (real switches)

Relayed HQ clients and Shipping's clients get no lease. show ip dhcp snooping says Insertion of option 82 is enabled.

5 · DAI before the clients renewed

PC-D has no binding yet, so DAI drops its ARPs and it loses its gateway. Order: snooping, renew, check the bindings, then DAI.

6 · DAI on a VLAN with static hosts

On VLAN 10, every ARP from PC-A would be dropped. The drop counter in show ip arp inspection statistics climbs.

7 · validate on three lines

Only the last one counts. show ip arp inspection vlan 30 shows two of the three checks disabled.

8 · Sticky, never saved

After a reload, the desk sticks to whatever is plugged in next. The sticky line is in show running-config but not show startup-config.

9 · A new PC at a sticky desk

The port err-disables for a legitimate swap. Remove the old sticky line, then shutdown and no shutdown.

10 · BPDU Guard on an uplink

Typed on a trunk or port-channel, it err-disables the link at D1's first BPDU, and the switch loses its root port. Reason bpduguard in show interfaces status err-disabled.

11 · Checking PortFast with the summary

show spanning-tree summary shows only the global defaults. Per-port PortFast is in show spanning-tree interface … detail.

12 · A rate limit on the trusted uplink

Under load the uplink err-disables, and the whole switch loses DHCP. Trusted ports should show unlimited.

End of session

What works now, and what doesn't

Everything that worked still works. The difference is what happens when something that shouldn't be there is plugged in.

TestResultWhy
Everything that worked at the end of Session 8WorksEvery host keeps its port, VLAN and address
A laptop on an empty desk jackNothingParked: VLAN 999, shut
A laptop swapped in for a desk's PCPort err-disabledPort security, sticky, shutdown
A rogue DHCP server on any desk portIts offers are droppedDHCP snooping
A forged ARP in VLAN 30Dropped and loggedDAI
A forged ARP in VLAN 10 or at ShippingNot checkedNo DAI there: static hosts
A switch plugged into a deskPort err-disabledBPDU Guard
CDP on a desk portOffOnly links between switches speak CDP
A rogue IPv6 router advertisementNot stoppedRA Guard is beyond this course
Coming up in Session 10 Modules 12 and 13: the company opens a wireless annex. VLAN 40 gets its gateway, its DHCP pool and its route, and a wireless LAN controller runs the access point from a web page instead of a terminal.

Recurring segment

The Ticket

Turn it into steps before you open the answer.

Ticket #141-09 · Priority: normal · From: Front Desk

The new hire's laptop arrived today. We unplugged the old PC at PC-C's old desk and plugged the laptop in where it was. Nothing works, and the little light next to the laptop's network port is off. The old PC worked fine there yesterday.

One way to break it down
  1. A new device on a desk that knew its old one, and a dark port light: port security, sticky, shutdown. Doing exactly what it was set up to do.
  2. PC-C's desk is S2 F0/1, VLAN 10. That's the port to look at.
  3. Confirm: show interfaces status err-disabled on S2 should list F0/1 with Reason psecure-violation; show port-security interface f0/1 shows Secure-shutdown and the laptop's MAC as the last source address.
  4. This is a legitimate swap, so the desk has to forget the old PC: no switchport port-security mac-address sticky with the old PC's MAC, on F0/1.
  5. Then bring the port back: shutdown, no shutdown. The laptop is learned as the new sticky address.
  6. copy running-config startup-config, or the old address comes back after a reload.
  7. Verify: show port-security address lists the laptop's MAC on F0/1; the laptop gets a 192.168.10.x lease, and S2's snooping binding table lists it.

Before Session 10

Checkpoint: Module 11

If you can do these cold, you're ready for the Modules 10–13 exam's security half.

Study

Flashcards

Click to flip. Double-click to mark as known.

Check yourself

Sample questions

Pick an answer to see if you're right. Same style as the module-group exam.

Applied

Worked examples

Think it through before you expand the answer.

Port security

Why did it err-disable?

A desk port has port security with the defaults plus mac-address sticky. Someone unplugs the PC and plugs in a laptop. The port goes err-disabled. Why, and what are two ways the administrator could have prepared for a legitimate swap?

Show answer

The defaults are a maximum of 1 and violation mode shutdown. Sticky kept the PC's MAC even while the cable was out, so the laptop's MAC was a second address: a violation, and the port shut. For a legitimate swap, either remove the old sticky address first (no switchport port-security mac-address sticky old-mac), or allow a second address with maximum 2. After the fact, remove the old address, then shutdown and no shutdown. (Without sticky, the swap would have worked: a dynamic secure address is forgotten when the link goes down.)

Sticky

Gone after a reload

An administrator turns on mac-address sticky, sees the addresses in show running-config, and reloads the switch the next morning. The addresses are gone. What was missed?

Show answer

copy running-config startup-config. Sticky addresses go into the running configuration; only saving it puts them in NVRAM.

Snooping

Nobody gets a lease

After DHCP snooping goes on, every client in a VLAN gets 169.254 addresses. Snooping is enabled globally and for the VLAN. What should you check first?

Show answer

Which ports are trusted. If the uplink toward the real DHCP server isn't trusted, snooping drops the server's OFFERs on it, exactly as it would a rogue server's. show ip dhcp snooping lists the trusted interfaces.

DAI

PC-A can't reach its gateway

Someone turns DAI on for VLAN 10 too. PC-A, with its static address, can no longer reach anything off its subnet, but PC-C, on DHCP, is fine. Why?

Show answer

DAI checks ARP against the DHCP snooping binding table, and PC-A never got a lease, so it has no binding. Its ARP messages are dropped as invalid. That's why HQ runs DAI only where every host uses DHCP. (Static hosts can be allowed with ARP ACLs, which are beyond this course.)

Trust

The server port

SRV1, the DNS and web server, is on S3 F0/2. It's a server the network team controls. Should its port be trusted for DHCP snooping?

Show answer

No. Trust is about the direction of the real DHCP server, and SRV1 isn't it; R2 is. If SRV1's port were trusted and someone turned on SRV1's own DHCP service by mistake, it would become a rogue server that snooping lets through.

BPDU Guard

Is the uplink at risk?

Someone runs spanning-tree portfast default and spanning-tree portfast bpduguard default. Is the trunk to D1 at risk?

Show answer

No. portfast default applies only to ports in access mode, and the global BPDU Guard applies only to PortFast ports, so trunks are left alone. The risk is the per-interface form: spanning-tree bpduguard enable typed on a trunk or port-channel would err-disable it at the next BPDU from D1.

Reference

Glossary & index

Every term from this session. Search, or jump by letter.