Back to Command Reference
Interface ConfigDomain 5.0

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

Execution ModeSwitch(config-if)#
Target DevicesPCs, Printers, Servers (Edge Ports Only)
STP Timers BypassedListening (15s) + Learning (15s)
Negation Commandno spanning-tree portfast

Syntax & Scope Mechanics

spanning-tree portfast [default | trunk]

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 default from 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.

Switch(config)# interface FastEthernet0/10
Switch(config-if)# switchport mode access
Switch(config-if)# 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.
! Cisco always throws this warning to ensure you know what you are doing.

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.