Command
Spanning-Tree Portfast
Use
This command essentially disables spanning-tree on an interface and brings it immediately into the forwarding state. Only use this command on access ports
Syntax
Switch(config-if)#spanning-tree portfast
Example
In the below example we will configure SW1’s Fa0/2 to use port-fast to immediately skip to the forwarding state. First, we will flap Fa0/2 and observe how spanning-tree normally treats the interface.
SW1(config)#int fa0/2 SW1(config-if)#shut
The port goes through all the spanning tree timers. Here is the listening phase.
SW1(config-if)#do sh spanning vlan 10 VLAN0010 Spanning tree enabled protocol ieee Root ID Priority 24586 Address 0012.00cb.6c80 This bridge is the root Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 24586 (priority 24576 sys-id-ext 10) Address 0012.00cb.6c80 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 15 Interface Role Sts Cost Prio.Nbr Type —————- —- — ——— ——– ——————————– Fa0/1 Desg FWD 19 128.1 P2p Fa0/2 Desg LIS 19 128.2 P2p Fa0/4 Desg FWD 19 128.4 P2p Fa0/5 Desg FWD 19 128.5 P2p Fa0/8 Desg FWD 19 128.8 P2p Fa0/9 Desg FWD 19 128.9 P2p Fa0/10 Desg FWD 19 128.10 P2p Fa0/19 Desg FWD 19 128.19 P2p
Here is the learning phase.
SW1(config-if)#do sh spanning vlan 10 VLAN0010 Spanning tree enabled protocol ieee Root ID Priority 24586 Address 0012.00cb.6c80 This bridge is the root Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 24586 (priority 24576 sys-id-ext 10) Address 0012.00cb.6c80 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 15 Interface Role Sts Cost Prio.Nbr Type —————- —- — ——— ——– ——————————– Fa0/1 Desg FWD 19 128.1 P2p Fa0/2 Desg LRN 19 128.2 P2p Fa0/4 Desg FWD 19 128.4 P2p Fa0/5 Desg FWD 19 128.5 P2p Fa0/8 Desg FWD 19 128.8 P2p Fa0/9 Desg FWD 19 128.9 P2p Fa0/10 Desg FWD 19 128.10 P2p Fa0/19 Desg FWD 19 128.19 P2p
Finally the port is forwarding.
SW1(config-if)#do sh spanning vlan 10 VLAN0010 Spanning tree enabled protocol ieee Root ID Priority 24586 Address 0012.00cb.6c80 This bridge is the root Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 24586 (priority 24576 sys-id-ext 10) Address 0012.00cb.6c80 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 15 Interface Role Sts Cost Prio.Nbr Type —————- —- — ——— ——– ——————————– Fa0/1 Desg FWD 19 128.1 P2p Fa0/2 Desg FWD 19 128.2 P2p Fa0/4 Desg FWD 19 128.4 P2p Fa0/5 Desg FWD 19 128.5 P2p Fa0/8 Desg FWD 19 128.8 P2p Fa0/9 Desg FWD 19 128.9 P2p Fa0/10 Desg FWD 19 128.10 P2p Fa0/19 Desg FWD 19 128.19 P2p
Now we will configure portfast on Fa0/2.
SW1(config)#int fa0/2 SW1(config-if)#spanning 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 has been configured on FastEthernet0/2 but will only have effect when the interface is in a non-trunking mode.
Notice how Fa0/2 is no longer seen in spanning tree.
SW1(config-if)#do sh spanning vlan 10 VLAN0010 Spanning tree enabled protocol ieee Root ID Priority 24586 Address 0012.00cb.6c80 This bridge is the root Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 24586 (priority 24576 sys-id-ext 10) Address 0012.00cb.6c80 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 15 Interface Role Sts Cost Prio.Nbr Type —————- —- — ——— ——– ——————————– Fa0/1 Desg FWD 19 128.1 P2p Fa0/4 Desg FWD 19 128.4 P2p Fa0/5 Desg FWD 19 128.5 P2p Fa0/8 Desg FWD 19 128.8 P2p Fa0/9 Desg FWD 19 128.9 P2p Fa0/10 Desg FWD 19 128.10 P2p Fa0/19 Desg FWD 19 128.19 P2p Fa0/20 Desg FWD 19 128.20 P2p