FortiSwitch
FortiSwitch: secure, simple and scalable Ethernet solutions
ehamud
Staff
Staff
Article Id 275520

 

Description This article describes how the STP works.
Scope FortiSwitch.
Solution

STP is a Layer 2 protocol that enables Ethernet networks to build loop-free logical topologies.

Switches that run STP, exchange Bridge Protocol Data Units (BPDUs) that contain information about the network topology.

The switches then use the information in BPDUs to determine the root bridge and the cost of all links to the root bridge.

 

The switch with the lowest bridge ID is elected as the root bridge. The link with the lowest accumulated path cost to the root bridge is selected as the best link. The cost of a link is inversely proportional to its bandwidth. That is, the higher the bandwidth, the lower the cost, and vice versa.

 

Here is a table about FortiSwitch costs values:

 
 

Port Speed           |    Default STP port cost

10 Mbps                    2000000

100 Mbps                  200000

1Gbps                       20000

5Gbps                       4000

10Gbps                     2000

25Gbps                     800

40Gbps                     500

50Gbps                     400

100Gbps                   200

 

When the best link to the root bridge fails, the switch ports for the alternate links go through a series of STP states to determine the new best link. Ultimately, the switch enables the new best link to the root bridge and disables all other links.

 

When a redundancy with extra cable is added, it brings loops. For example:

 

                                                    examplestp.jpg

 

  1. PC1 sends an ARP request looking for the MAC address of PC2. An ARP request is a broadcast frame.
  2. FortiSwitch1 will forward this broadcast frame on all its interfaces, except the interface where it received the frame on.
  3. FortiSwitch2 will receive both broadcast frames.
  4. FortiSwitch2 will forward it out of every interface except the interface where it received the frame.
  5. This means that the frame that was received FortiSwitch2 on Port1 will be forwarded to FortiSwitch2 Port2
  6. Now the frame that was received on Interface Port2 from FortiSwitch1 will be forwarded to Port1 From the same FortiSwitch1.

Now there is a loop, both switches will keep forwarding over and over until one of the cables is disconnected, or the Switches will crash because of excessive traffic. It happens because ethernet frames do not have TTL value and for this reason, the loop will be forever.

 

With the Spanning tree, this situation is solved using BPDU (Bridge Protocol Data Unit) which has inside this frame two pieces of information in which STP is working:

  • MAC address.
  • Priority.                                                                              

 

Both pieces make up something called Bridge ID, BPDUs are sent between the switches, by default the priority is 32768 which is configurable.

The root Bridge will be:

  • The Switch with the lowest number priority will be the root.
  • If All Switches are tied with the same priority the MAC address is going to be the tiebreaker.

 

Another example here, the ports on the root bridge are always Designated and in a forwarding state.

Non-root bridges are every switch that is not the root, they have to find the shortest path to the root bridge.

 

The shortest path to the root bride is called the root port.

In order to decide which FortiSwitch between FortiSwitch2 and FortiSwitch3 will have the port down, the election will be again with the formula Bridge ID = Priority + MAC address.    

Lower is better because both switches have the same priority the tiebreaker is the lowest MAC, and CCC is lower than DDD, fort that reason FortiSwitch2 will have its port as Designated and FortiSwitch3 port as Alternate.

                                             

 

                                                    stp22.jpg

 

Remember, each time there are STP topologies, be careful about which Switch will be elected as a Root Bridge.

It is possible to manipulate the priority, sometimes older Switches gain the battle and are used as root Switches because they have a lower MAC address.

Contributors