spanning-tree portfast
Configures a switchport to immediately bypass the standard Spanning Tree Protocol (STP) listening and learning states. This instantly transitions the port to a forwarding state the moment a cable is plugged in, allowing end-devices like PCs to request DHCP addresses without timing out.
Quick Reference
Switch(config-if)#no spanning-tree portfastSyntax & Scope Mechanics
Under normal 802.1D conditions, when you plug a PC into a switch, the port stays amber and blocks traffic for 30 seconds to listen for rogue BPDUs. The base spanning-tree portfast command typed at the interface level forces it green instantly.
- default (Global Mode): If you type
spanning-tree portfast defaultfrom Global Config, it automatically enables PortFast on every single access port on the switch, saving you from configuring them one by one. - trunk (Interface Mode): By default, PortFast refuses to run on trunk links. However, if you are connecting to a VMware ESXi server that requires an 802.1Q trunk but is still an end-device, you can force the feature using
spanning-tree portfast trunk.
CLI Deployment Scenarios
Scenario 1: Securing a Standard User Port
You are provisioning a desk port for a new hire. You want their computer to connect to the network instantly upon booting up to ensure their PXE boot or DHCP client doesn't time out.
CCNA Exam Gotchas
The Temporary Loop Disaster
If you enable PortFast on an interface, and someone plugs a rogue switch into that wall jack creating a loop, the network will instantly suffer a broadcast storm. Because the port skipped the "Listening" state, it blindly forwarded traffic before it had time to process BPDUs and block the loop. This is why PortFast is almost always paired with BPDUGuard in production.
TCN (Topology Change Notification) Suppression
When a normal switchport goes up or down, the switch generates a TCN BPDU to flush the MAC address tables of the entire network. If a user reboots their PC, this causes massive network overhead. Ports configured with PortFast do not generate TCNs when they go up or down. This is highly tested on the CCNA.