Sub topic 14
Edge ports and PortFast
This chapter assumes you know how switches learn MAC addresses, how VLANs and access ports work, and how to read a Cisco IOS command line. It also assumes you know the classic 802.1D port states and timers from earlier chapters.
Why host ports need special treatment
A classic STP port moves through blocking, listening and learning before it forwards. With default timers (15 seconds forward delay each for listening and learning), a newly connected port waits about 30 seconds before it carries traffic. A PC that requests a DHCP address during that time can time out, and the user sees "no network" on a link that is physically up.
A port that connects to a single end host cannot create a loop, because a host does not forward frames between switch ports. Waiting for STP to prove this is wasted time.
What an edge port is
An edge port is a port that connects to an end device, not to another switch. Rapid STP (802.1w) lets an edge port go straight to forwarding, with no proposal/agreement handshake. Cisco calls this feature PortFast. It also applies to classic 802.1D, where it skips the listening and learning states.
Configuring PortFast
Enable PortFast only on access ports that face hosts, and pair it with BPDU Guard.
! Cisco IOS: access port facing an end host
interface GigabitEthernet0/5
switchport mode access
switchport access vlan 10
spanning-tree portfast
spanning-tree bpduguard enableBPDU Guard puts the port into the error-disabled state if a BPDU arrives. This protects the network if someone plugs in a small switch or creates a cable loop between two wall jacks. The port stays down until an administrator fixes the cause and re-enables it, or until an errdisable recovery timer expires if you configured one.
Common errors
- Enabling PortFast on a trunk or on a link to another switch. A loop can form before STP reacts, and a broadcast storm can start within seconds.
- Enabling PortFast without BPDU Guard, which leaves the port open to a rogue switch.
- Assuming PortFast removes the STP delay on every port. It affects only the ports you configure.
- Forgetting that a trunk to a server hypervisor or a phone with a PC behind it may need
spanning-tree portfast trunk(on a trunk port) or the access-port form, depending on the design.
You can also turn PortFast on for all access ports with spanning-tree portfast default in global configuration. Trunk ports are not affected by this setting.
Verifying
show spanning-tree interface GigabitEthernet0/5 detail
show spanning-tree summary
show spanning-tree inconsistentportsIn the detail output, look for the line "The port is in the portfast mode". After a BPDU Guard event, the port shows as err-disabled in show interfaces status.
Exercise
A user plugs a small unmanaged switch into a wall jack. That jack connects to a PortFast access port with BPDU Guard enabled. The unmanaged switch has a loop cable between two of its own ports. What happens, and why is the rest of the network protected?
Show answer
The unmanaged switch may send or reflect BPDUs, and the access port receives one. BPDU Guard puts the port into the error-disabled state, so no frames pass. The loop stays inside the unmanaged switch and cannot reach the main network. An administrator must remove the device and re-enable the port, unless errdisable recovery is configured.