Skip to content
Related Articles

Related Articles

Configuring Spanning Tree Protocol Portfast

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 31 Mar, 2022

Spanning Tree Protocol is a data link layer or layer-2 protocol whose prime objective is to prevent loops in the different network configurations or network topologies. It tracks all the links and closes the redundant ones. It uses the spanning tree algorithm(STA) to create a topology database and then search out the redundant links to disable them.

Switch Topology with Loops ( Before STP ) 

This network is vulnerable to nasty issues like broadcast storms, multiple frame copies, and MAC thrashing.

In order to understand STP, there are 3 major things you need to identify first:

  1. Identify the root bridge by checking bridge IDs.
  2. Find out root ports by determining the lowest path cost to the root bridge.
  3. Find designated ports by checking bridge IDs.

In short, identify – the root bridge, root ports, and designated ports. So let’s identify them with the below topology:

Root Bridge: Bridge having lowest Bridge ID.

Bridge ID: Combination of bridge priority and MAC address of a bridge.

Path cost: A switch may encounter one or more switches on its path to the root bridge and there may be more than one possible path. A path cost is calculated for each unique path by adding port costs encountered on the way to the root bridge. 

Root Port: The root port is the link between the lowest path cost and the root bridge. Remember the root bridge can never have a root port designation, while every other switch in a network must have one and only one root port.

Designated Port: A designated port is one that’s been determined to have the lowest cost to get to on a given network segment, compared to other ports on that segment. A designated port will be marked as a forwarding port.

Example: 

Election of Root Bridge, Root Port, and Forwarding Port (After STP)

Election of Root Bridge, Root Port, and Forwarding Port (After STP) 

In the above topology, the first root bridge is elected. Since all bridges have the same priority, the MAC address is the tiebreaker to elect the root bridge. Since Switch1 has the lowest bridge ID, it is elected as Root Bridge. Now, apart from the root bridge rest, all bridges have to find the root port. Looking at the cost of each link it’s clear that Switch2 and Switch3 use directly connected links as root ports (mentioned as RP). If Switch2 chooses a path via Switch3 to Root Bridge then the total cost would be 4 + 4 = 8. Hence it is rejected. Every port on the root bridge is a forwarding port(mentioned as F).

Now the only thing left is to choose the one forwarding port on the segment between Switch2 and Switch3. So based on the bridge ID, the port with the best and lowest(here Switch2) would become the only bridge forwarding on that segment, with the one having the highest Bridge ID (here Switch3) put into blocking mode (mentioned with a cross).

Port Fast:

For STP to converge it takes about 50 seconds i.e. to identify root bridge, root ports, blocking the port, and transition of designated to forwarding port, all these things take about 50 seconds. Now if you don’t wish to wait that long and you are absolutely sure that your topology is loop-free(and will be) you may use the feature of PortFast which is a Cisco proprietary extension to the 802.1d standard. By using PortFast the ports will transition from blocking to the forwarding state immediately. If you have a server or other devices connected to a port, you may take the help of this feature. 

Access Port: Any switch port that allows traffic of only a single VLAN is known as an access port and it belongs to that VLAN. e.g. Consider a port f0/0 that is connected to the finance department then it will be configured in such a way that only traffic belonging to the finance department will flow through that port.

Trunk Port: This term trunk port is inspired by the telephone system trunks wherein multiple telephone conversations are carried out at a time. Similarly, trunk ports in switches carry traffic of multiple VLANs at a time. Hence the bandwidth of any trunk port is usually far more than any access port – mostly in 100s, 1000s, or even 10000s of Mbps! 

Enabling PortFast on an Access Port: 

Step 1: To enable PortFast over an access port connected on a single server, workstation, or switch. Use the following command:

set spantree PortFast mod_num/port_num enable | disable

Step 2: Now, verify the PortFast setting over a switch port.

show spantree [mod_num/port_num] [vlan]

Enabling PortFast on a Trunk Port:

Step 1: To enable PortFast on a trunk port connected to a single server, workstation, or switch. Use the following command:

set spantree portfast mod_num/port_num enable trunk

Note: If the above command is written without the trunk keyword, the PortFast will remain disabled.

Step 2:  Now, verify the PortFast setting over a switch port.

show spantree portfast [mod_num/port_num]

Disabling PortFast: 

Step 1: For disabling PortFast, use the following command in the privileged mode of the system:

set spantree portfast mod_num/port_num disable

Step 2: To verify the PortFast setting, use the following command:

show spantree mod_num/port_num

Resetting PortFast:

Step 1: For resetting PortFast to default, use the following in the privileged mode of the system:

set spantree portfast mod_num/port_num default

Step 2: To verify the PortFast setting, use the following command:

show spantree mod_num/port_num
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!