Skip to main content

Spanning Tree Protocol

What is STP?
Spanning Tree protocol was created to prevent loops in redundant network.

What is BPDU?

Switches send "PROBES” into the network called Bride Protocol data units (BPDUS) to discover loops. All switched in the network have that probes data back. Flipping all the switches. Checking out every single links. Actually it’s a Multicast packet. If there is redundancy in the network the switch will gets its own BPDU. Switches know there is redundant link in the network. Now switch work to find it out. That’s the goal of the BPDU.

What is ROOT Bridge?

BPDU also help to elect Root Bridge. The root bridge of the network, STP election will pick the oldest switch of the network as the root bridge by default.  All switches will find the best way to reach Root Bridge.  All other path which aren't fast to reach the root end of getting block which disable redundancy of the network.

BPDU and Elections?

BPDU are sent once every two seconds out every single port. This could identify if your primary link gone down and it’s trying to find out backup link to the root bridge. e.g, Lets imagine Switch0 send its "probes"  switch1 and switch2 broadcast this probes  and also switche1 and 2 know there is switch 0 in the network, this "probes" gets back to the switch0, it’s know s there is loops in the network. When switch find out loops, its go for the election process.

In every single BPDU packets there is two major fields.
-Mac Address

The priority is value between 0 to 61440, the default is 32768. You can't set priority to 0 or 1 or 9, it has to set on increment of 4096 because priority field have 4 bits reserved, using 4 bits we can’t use 61440 values. By default every switch has same priority so every switch ties on priority. So every switch relay on its mac address. Who have lower mac address which is elected to root bridge, which breaks the ties between switches?  In diagram switch1 is lower than switch2 and switch 2 is lower than switch0. So the switch1 wins the election. Lower the MAC Address is older the switch, because manufacturer start to produce first switch with first mac address and go for higher and higher mac address. So the newer switches have higher mac address.

All switches know each other and same priority and mac address. And also know switch1 has the lowest MAC Address. Switch1 wins the root bridge election, it’s became the core switch of the network. Other switches of the network loss the election. Root Bridge never ever blocks the port; all its port considered being forwarding or designated port. Other switches on the networks find best way to get that root bridge. Switches calculate link cost to get Root Bridge, fast Ethernet 100M link have 19 costs. So it’s calculated which have lowest cost to reach root bridge. So switch2 and switch0 are directly connected port to Root Bridge became root port, the best way to get the root. Here is tip whenever you do show command in a switch and saw root port don't be fool that isn't Root Bridge. If the switch has a root port it can't be the root bridge because that is going out that port to reach Root Bridge.

Designated port or forwarding port is one per link so Root bridge have all designated port switch2 have one root port and one designated port one side block the link which is on the swirch0. You may think why switch0 block the port not switch2, which is because switch0 have higher mac address.

How STP major Best Path?

-Elect the Root
-Switch find lowest cost path to Root.

Link Bandwidth         STP cost
4Mbps                       250
10Mbps                    100
16Mbps                    62
45Mbps                    39
100Mbps                  19
155Mbps                  14
622Mbps                   6
1Gbps                       4
10Gbps                     2

You may think what if cost may tie?
In that case switch use lower Bridge ID. Bridge ID is priority plus Mac address. Switches broadcast its Bridge ID, whoever have lower Bridge ID preferred to be best path to reach to root bridge, other path may block.

If two switch connected with two crossover cable in that scenario lower port to break a tie. That means lower remain unblock, higher port block the redundant.


Popular posts from this blog

Unable to open kernel device . global vmx86 windows 7

Suddenly I encounter a weird problem with VMware 9 version. I install different OS for my education and testing purposed. Like MAC os, Ubuntu, CentOS, BT, WinXP, Win-server 2003. When I tried to run one of this OS a error message appear. unable to open kernel device "\\.Global\vmx86": The system cannot find the file specified. Did you reboot after installing VMware Workstation? Failed to initialize monitor device. Click ok you can see this window After googling I found one solution in developer forum but thread starter never use that method. So I tried it and here is my finding. Go to the directory of vmware installed  (In my case I run it as Administrator) C:\Program Files (x86)\VMware\VMware Workstation>   ( I've 32-bit apps on 64-bit OS, your may be different) Run this command vnetlib -- uninstall vmx86  reboot Go to the same directory and check net start command - this time it should say "service name  is invalid&quo

Simple Failover Mikrotik

Simple fail-over Mikrotik router configuration. Most of the user wants backup link (Fiber link with Wireless backup), in case fiber down wireless link auto up. No downtime for the user. Here is simple setting on Mikrotik for fail-over. I'm very great full to Anton to point out the mistake in src-address. It has been corrected now. ****default routes for new outgoing traffic.**** /ip route add dst-address= gateway=ISP-GW-ADDR-1 distance=1 check-gateway=ping add dst-address= gateway=ISP-GW-ADDR-2 distance=2 ++masquerade both WAN connections++ /ip firewall nat add chain=srcnat src-address= out-interface=WAN-1 action=masquerade add chain=srcnat src-address= out-interface=WAN-2 action=masquerade Thats it.

Mikrotik SXT 5nD r2 setup in bridge mode

How to connect two Mikrotik RouterBoard SXT 5nD r2 devices together in Bridge Mode Upgrading you SXT's to the Latest version of RouterOS Doing a Bandwidth Test between two RouterBoard SXT-5nD's Mikrotik routerboard default IP is You can connect with routerboard by WinBox through IP and MAC address. You need to download WinBox from mikrotik website. By default routerboard have Admin as username and blank password. If you want to connect with device through IP then don't forget to add same network address into your pc NIC, otherwise connection isn't established. Else you can connect through MAC so choose MAC address from Elipsis next to " connect " field. When you login, "RouterOS Default configuration" screen is popup. click okay. Do same for other device to login to routerOS If you followed the process then you already open both device. Now you can set a HostName for those devices. Click on the system button o