Network Bytes · Episode 88 · CCNA 2.5
"PortFast and BPDU Guard"
Spanning Tree makes a new switch port wait about 30 seconds before it forwards, in case the link creates a loop. PortFast skips that wait on ports to end devices, and BPDU Guard shuts a PortFast port down if a switch is plugged into it.
Why a new port waits 30 seconds
Switches run Spanning Tree Protocol (STP) to stop loops: if two links make a circle, frames could spin around forever. So when a new link comes up, the switch acts like an inspector at a new door. In classic STP the port first listens and then learns MAC addresses, each stage lasting one forward delay of 15 seconds by default, before it starts forwarding. That is the 30 seconds a freshly plugged-in PC can sit there with no network.
Rapid PVST+, the version the CCNA focuses on, can move a link between switches to forwarding quickly with a handshake. But a PC never answers that handshake, so a port toward a PC falls back to the same timers.
PortFast: skip the wait for end devices
PortFast tells the switch that this door only leads to one office: a PC, a printer, or another end device that can't create a loop. The port goes straight to forwarding as soon as the link comes up. In RSTP terms such a port is an edge port.
On Cisco IOS you enable it on an access port with spanning-tree portfast. If a PortFast port does hear a BPDU, it normally loses its PortFast status and runs Spanning Tree like any other port.
BPDU Guard: lock the door if a switch shows up
PortFast trusts you. If someone plugs a switch (or a second cable to the same switch) into that port, a loop could form before Spanning Tree catches it. BPDU Guard adds a lock: switches send hello messages called BPDUs (bridge protocol data units), and end devices don't. If a BPDU arrives on a BPDU Guard port, the switch puts the port in the err-disabled state, which shuts it down.
Enable it per interface with spanning-tree bpduguard enable, or for every PortFast port at once with the global command spanning-tree portfast bpduguard default. An err-disabled port stays down until an admin enters shutdown and then no shutdown, or until errdisable recovery is configured.
Where PortFast belongs
PortFast goes on ports to end devices, never on links between switches. Links between switches are exactly where loops can happen, so they need Spanning Tree's full checks.
Try it yourself
In Cisco Packet Tracer, connect a PC to a switch and watch the port light: it stays amber for about 30 seconds before turning green. Then on the switch enter interface fastEthernet0/1, spanning-tree portfast and spanning-tree bpduguard enable, unplug and replug the PC, and the light goes green almost at once. Now connect a second switch to that same port: the port goes err-disabled, and show interfaces status lists it that way.
Good to know
- CCNA 2.5 covers Rapid PVST+ concepts, including PortFast and BPDU guard (EP32 covers loops, EP33 the root bridge and BPDUs).
- The 30 seconds is two forward-delay periods of 15 seconds each: listening then learning in classic 802.1D STP; with Rapid PVST+, a port toward a PC gets no RSTP handshake reply, so it also falls back to the timers (discarding, then learning). "Two fifteen-second stages" skips the state names.
- PortFast (an edge port in RSTP terms) goes straight to forwarding; a PortFast port that receives a BPDU normally loses its PortFast status and runs STP like any port.
- BPDU guard ("spanning-tree bpduguard enable" per interface, or "spanning-tree portfast bpduguard default" globally for all PortFast ports) puts the port in the err-disabled state when a BPDU arrives; it stays down until an admin enters "shutdown" then "no shutdown", or errdisable recovery is configured.
- PortFast is set with "spanning-tree portfast" on an access port ("spanning-tree portfast trunk" exists for trunks to servers, which the short skips).
- "Inspector at each new door" is the analogy.
For CCNA learners
CCNA exam topic 2.5 is interpret basic operations of Rapid PVST+ Spanning Tree Protocol, and it names PortFast and BPDU guard. Know that PortFast skips the listening and learning wait on ports to end devices, and that BPDU guard err-disables such a port when a BPDU arrives.
Answer to the comment question
24. Only the 24 ports to PCs should get PortFast. The 2 uplinks go to other switches, where a loop can form, so they must keep Spanning Tree's normal checks and must not get PortFast.
Test your knowledge
Quick quiz: "PortFast and BPDU Guard"
4 multiple-choice questions. Pick one answer for each, then check how you did.
Sources
- Cisco, "Spanning Tree PortFast BPDU Guard Enhancement": BPDU guard puts a PortFast port in the error-disabled state when it receives a BPDU; set per interface or globally
- Cisco, "Using PortFast and Other Commands to Fix Workstation Startup Connectivity Delays": a port waits through listening and learning, 15 seconds each by default, before forwarding; PortFast skips this on ports to end stations (older Cisco address; it may redirect)
- Cisco Community, "PortFast and BPDUguard with RPVST": PortFast and BPDU guard work with Rapid PVST+; a PortFast port that receives a BPDU loses its PortFast status (community thread, not official documentation)
- Cisco, "CCNA 200-301 v1.1 exam topics": 2.5 interpret basic operations of Rapid PVST+ Spanning Tree Protocol, including PortFast and BPDU guard
Video transcript
Why does a new PC sometimes wait thirty seconds before its switch port works?
Spanning Tree checks every new link for loops, like an inspector at each new door. The port waits through two fifteen-second stages before forwarding.
PortFast tells the switch: this door only leads to one office, a PC or a printer. Skip the waiting and forward right away.
But what if someone plugs a switch into that door? BPDU Guard watches for the hello messages switches send, called BPDUs. If one arrives, the port shuts down.
So PortFast belongs on ports to end devices, never on links between switches.
A switch has twenty-four ports to PCs and two uplinks to other switches. How many ports should get PortFast? Comment your answer below!
That's your byte.
More from Network Bytes
- EP86"VRFs: one router, separate routing tables"
- EP87"Containers vs virtual machines"
- EP89"IPv6 unique local addresses"
- EP90"IPv6 anycast addresses"