Cisco Portfast Configuration

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:

cisco portfast example topology

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…

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You've Ever Spent on Your Cisco Career!
  • Full Access to our 660 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

503 Sign Ups in the last 30 days

satisfaction-guaranteed
100% Satisfaction Guaranteed!
You may cancel your monthly membership at any time.
No Questions Asked!

Tags:


Forum Replies

  1. Hi Rene

    It is a great lesson to understand the Topology change on the STP. I have a question which is related to the switches which receives only BPDU with TCN flag set from the Root bridge

    Assume that Switch network has few more switches and TCN notification generated by switch ( switch A on the diagram) has not been pass through on these switches . I need to know what would be the mac address aging time for the other switches which receives BPDU’s with TCN flag set. My understanding is if a switch in the switch network received the TCN from the Root bridge t

    ... Continue reading in our forum

  2. Hello Rene,

    I am getting confused with this concepts in STP, The more i read the more i am getting confused
    Please help me upnderstand this concepts, I 've wriiten my understanding and questions.

    In a Steady state Network assuming the packet between computer A and Computer B takes (Switch B --> Switch A --> Switch C --> Switch D)

    **Question related to interface states and convergence time**

    Switch C (Root Bridge) generates configuration BPDU’s and sends it to Switch A and Switch D and in turn they relay it to switch B
    When we have an indirect link failure (shut

    ... Continue reading in our forum

  3. Ravi,
    If we are talking about traditional spanning tree (802.1 D), and not rapid spanning tree (802.1 W), a switch will set the aging of the MAC address table equal to the Max Age timer when it receives the Topology Change Acknowledgement from the Root Bridge. It works like this:

    A switch, let’s say it is not the root bridge, has event that causes it to generate a topology change. It’s goal is to send this to the root bridge, and then it is the root bridge’s job to acknowledge this change. This acknowledgement starts with the Root Bridge and makes its way th

    ... Continue reading in our forum

  4. EDIT: Having looked into this further, I don’t think the process as described in the article is actually correct… if the root port on SW1 goes down, rather than sending a TCN, it will start sending inferior BPDUs to SW2. That’s according to this: https://learningnetwork.cisco.com/thread/63525

    In the scenario given, it says that SW2 receives the TCN from SW1 and then immediately makes Fa0/19 the new root port.

    A topology change doesn’t necessarily mean that the root port needs to change, so how does it know to immediately change the root port? My suspicion is th

    ... Continue reading in our forum

  5. Hello Pradeep

    For the following, we assume that we are using simple STP (802.1D). If you have a stable topology where STP has converged, and you add a new switch to one of the switchports of the switches already in the topology, then the following would happen

    ... Continue reading in our forum

47 more replies! Ask a question or join the discussion by visiting our Community Forum