Portfast is a Cisco proprietary solution to deal with spanning-tree topology changes. If you don’t know how spanning-tree reacts to topology changes then I highly recommend you to read this tutorial before you continue reading. It helps to truly understand why we need portfast.
Portfast does two things for us:
• Interfaces with portfast enabled that come up will go to forwarding mode immediately, the interface will skip the listening and learning state.
• A switch will never generate a topology change notification for an interface that has portfast enabled.
It’s a good idea to enable portfast on interfaces that are connected to hosts because these interfaces are likely to go up and down all the time. Don’t enable portfast on an interface to another hub or switch.
Let’s take a look at the difference of an interface with and without portfast. I’ll be using the following topology for this:
I have two switches and one host connected to SW1. The only reason I have two switches is so SW1 has another switch that it can send topology notification changes to. Let’s look at the without portfast scenario first…
Portfast disabled
To see the interesting stuff I will enable a debug on SW1:
SW1#debug spanning-tree events
Spanning Tree event debugging is on
Once I plug in the cable to connect the host to SW1 this is what happens:
SW1#
STP: VLAN0001 Fa0/1 -> listening
STP: VLAN0001 Fa0/1 -> learning
STP: VLAN0001 Fa0/1 -> forwarding
This is just normal spanning-tree behavior, it walks through the listening and learning states and ends up in forwarding.
Each time I unplug the cable, spanning-tree will generate a topology change notification. There’s a nice command that you can use to check how many have been sent so far:
SW1#show spanning-tree detail
VLAN0001 is executing the ieee compatible Spanning Tree protocol
Bridge Identifier has priority 32768, sysid 1, address 0019.569d.5700
Configured hello time 2, max age 20, forward delay 15
Current root has priority 32769, address 0011.bb0b.3600
Root port is 26 (FastEthernet0/24), cost of root path is 19
Topology change flag not set, detected flag not set
Number of topology changes 5 last change occurred 00:02:09 ago
from FastEthernet0/1
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0, aging 300
As you can see there have been 5 topology changes so far on VLAN 1. Let’s unplug the cable to the host to see what happens:
SW1#
STP: VLAN0001 sent Topology Change Notice on Fa0/24
Spanning-tree will send a topology change notification on the interface towards SW2 and the counter will increase:
SW1#show spanning-tree detail | include changes
Number of topology changes 6 last change occurred 00:01:12 ago
In short, everytime we unplug the cable the switch will generate a TCN. Let’s see the difference when we enable portfast…
Thanks dear
Hi Rene,
What happens when Portfast is enabled on a port but BPDU filter is not globally enabled and the port receives a BPDU.
Thanks,
Thanks Andrew. I have one more question, What is the real use of BPDU filter command in a Global mode, if a normal portfast can achieve the same functionality. Why do we need to enable BPDU filter at the global level and what enhancement does it provide at the global level. BPDU filter lesson says.
BPDUfilter can be configured globally or on the interface level and there’s a difference:
Global: if you enable BPDUfilter globally then any interface with portfast enabled will not send or receive any BPDUs. When you receive a BPDU on a portfast enabled interface th
... Continue reading in our forumHello Tejpal
What actually happens when a portfast configured port receives a BPDU actually depends on the configuration.
In simple STP (IEEE802.1D), a portfast port will be reset back to a normal port participating in STP if BDPUs arrive on the port. If a physical L2 loop is created on such a port, it will result in a temporary L2 loop until STP reconverges. This is why you will see this warning when configuring portfast (notice the word “temporary”:
Hello Swapnil
If a situation like this happens, the port that is configured with portfast will receive a BPDU. What happens next depends on how the port is configured. Take a look at the previous post above to see more details.
In general it is best practice to enable portfast only on ports that have end devices connected to them and not other switches.
I hope this has been helpful!
Laz