NEO Training Center | Học CCNA tốt nhất – STP
STP
Spanning Tree Protocol
#mk-edge-slider-5b04eee956504 { background-color: #000; }

STP ( Spanning- Tree Protocol)

  • STP was designed to prevent bridging loops in layer2 networks, typically created by redundant
  • The initial IEEE 1Q standard specified the transport of BPDUs over a native VLAN, with no support to differentiate between BPDUs from different VLANs.
  • Originally this implied a single spanning-tree instance for all VLANs and it was defined by the IEEE as the CST (Common Spanning-Tree) using the MAC address 0180.c200.0000.
  • Around the same timeframe Cisco came out with ISL trunking and their proprietary PvST(Per-VLAN Spanning-Tree).
  • Cisco later on adapted PvST to be tunneled over 1Q by sending SSTP BPDUs for each VLAN and called it PvST+.
  • The remainder of this book will refer to PvST+ as PvST as it has become known.

 

  • BPDU (Bridge Protocol Data Unit)

> BPDUs are the control frames distributed between switches carrying STP information.

> STP uses BPDUs to elect one root bridge and discover/propagate TCs (Topology Changes).

> BPDUs provide the information used to elect different port roles between switches and detect/avoid loops.

> In stable STP (802.1D) topology only the root bridge sends BPDUs while other bridges relay the root bridge BPDUs.

> The most recent BPDU received on each port is stored for up to the max-age timer.

> An inferior BPDU, contains information about the root bridge that is worse than the BPDU currently stored for the port it was received on.

> A superior BPDU, contains information about the root bridge that is better than the BPDU currently stored for the port it was received on.

> A superior BPDU received on a port, results in the previous BPDU being overwritten and the port promoted to root/designated port.

> With PvST BPDUs are generated per-VLAN.

> PvST BPDUs contains the VLAN-ID in a ‘PVID’ TLV field, the MAC address of the sending port and a destination multicast MAC of 0100.0ccc.cccd.


 

STP Operation :

– Root Bridge

> The root bridge is used as the authoritative starting point to calculate the loop free spanning-tree structure.

> All bridges should as a result only have one active link, called the root port, towards the single root bridge.

> The positioning of the root bridge is important in production networks to optimize traffic flows.

> All ports of a root bridge for a VLAN will be in designated forwarding state.

> The root bridge sends out BPDUs with a root path cost value of 0.

> The output of “show spanning-tree” on a root bridge will show:

>> ‘this bridge is root’.

>> The same priority and MAC address for both the Root ID and Bridge ID.

stp-root-bridge-election-4

– Electing a Root Bridge

> The STP root bridge is elected based on the bridge with the lowest BID (Bridge ID).

> The BID consists of:

>> Bridge Priority

>>> Priority (default = 32768) (configured in increments of 4096).

>>> Sys-id-ext = spanning-tree instance number.

>> MAC Address

>>> The system MAC address is used.

>>> The MAC address is the tie breaker when the comparative bridge priorities are equal.


 

 

– STP Port Roles

> Root Port

>> Is the elected upstream port closest to the root bridge.

>> Once the root bridge is elected, every bridge must determine one port it will use to reach the root bridge.

>> MAC addresses should only be learned on root or designated ports.

> Designated Port

>> Is an elected downstream port facing away from the root bridge.

>> All ports on the root bridge are designated ports.

>> A designated port is responsible for sending and receiving traffic on a segment where two or more non-root bridges connect to.

>> MAC addresses should only be learned on root or designated ports.

> Non-Designated/Alternate Port

>> Is a port that is neither root nor a designated port.

>> On Cisco catalyst switches these ports are seen as ‘ALTN’ with “show spanning-tree”.

>> If BPDUs are not received on a non-designated port, the port might erroneously become a designated port.

>> This is typically as a result of a cable fault or BPDU filter configured on one end of a link.

 

– Electing a Root Port

1st- Lowest Path cost ( Path cost = Sender’s Cost + Port Cost )

>> It is the port cost values added up of all the output ports towards the root bridge.

>> The default values are inversely based on interface bandwidth, i.e., an interface with higher bandwidth will have a lower cost.

>> Refer to IEEE in section 17.14 of the 802.1D-2004 standard for the current values.

>> The port cost can manually be changed with “spanning-tree cost”.

2nd- Lowest Sender’s BID:

>> Used to elect one bridge over another when two uplinks exist to different bridges.

3rd- Lowest Sender’s port ID:

>> Lowest port priority (0-255) (default = 128).

>> Lowest port number value assigned by IOS software, e.g., Fa0/5 might have a port number of 5 or 6 etc.

– Electing a Designated Port

1st- Lowest cumulative cost to the root bridge. 2nd- Lowest upstream BID

>> Used to elect one bridge over another when two uplinks exist to different bridges.

3rd- Lowest port ID:

>> Lowest port priority (0-255) (default = 128).

>> Lowest port number value assigned by IOS software, e.g., Fa0/5 might have a port number of 5 or 6 etc.


 

– STP Port States

> Disabled

>> Ports that are in a down state.

>> This state is not part of the normal STP progression for a port.

> Blocking

>> When a port initializes it be in the blocking state.

>> After the spanning-tree algorithm some might will be placed in the blocking state to prevent loops.

>> The port will receive BPDUs to learn about other bridges, but will not send BPDUs.

>> The port cannot send or receive data frames and will not record any MAC addresses.

>> Blocking delay = 20 sec. (This value cannot be changed).

> Listening

>> A port is moved from blocking state if the bridge thinks that the port can be selected as a root port or designated port.

>> The port is allowed to send and receive BPDUs so that it can actively participate in STP.

>> The port cannot send or receive data frames and may not record any MAC addresses.

>> Listening delay = 15 sec.

> Learning

>> After the listening delay, the port is allowed to move into the learning state.

>> The port is allowed to send and receive BPDUs.

>> The bridge can record MAC addresses and add them to the CAM table.

>> The port cannot send or receive data frames.

>> Learning delay = 15 sec.

> Forwarding

>> After the forward delay (listening and learning states) (default = 30 sec) the port transitions to the forwarding state.

>> The port now send and receive BPDUs, record MAC addresses and send and receive data frames.

– Important things to know about port states

> IEEE standard dictates that Listening and Learning timers values must be equal.

> Blocking state delay ONLY applies when a port first initializes, i.e., after a reboot, not when a port transitions to forwarding.

> When a port first comes up the collective delay is 50 sec. (20+15+15) of no data flow.

> When a port transitions to the forwarding state, the delay is only the listening and forwarding delay, e.g., unshutting a port.

> And when a port changes state the collective delay is only 30 sec. (15+15) of no data flow.

> Be careful how questions could be phrased with regard to the delay times.


– STP Timers

> Switches inherit the timers configured on the root bridge.

> Default timers and their purpose are:

>> Hello Time (2 sec.)                               – The time how often a root bridge sends BPDUs or the frequency when any bridge sends TCNs to the root bridge.

>> Max Age (20 sec.)                                – Age limit when outdated BPDUs are discarded.

>> Forward Delay (15 sec.)                        – The time spent by a port in each of the learning and listening states.


– STP TC (Topology Change)

> With 802.1D TCs are caused by:

>> A forwarding port changing state.

>> A blocked port that moved to the forwarding state.

> When a bridge detects a TC, a TCN (Topology Change Notification) is sent to the rootbridge.

> The root bridge sets the TC flag on the next set of BPDUs it sends out to notify all bridges of the TC.

> These BDPUs are relayed by the receiving bridges to all downstream bridges in the network.

> Bridges receiving a BPDU with TC bit set, will reduce their MAC address aging time to the forwarding time.

> Cleaning the MAC address table during topology changes is necessary, but results in unicast flooding to learn the flushed MAC addresses again.

> Excessive flooding could have a severe impact your network performance and stability

> Portfast ports do not generate TC events when the port goes up or down.

 

 


 – Portfast

> Originally Cisco proprietary.

> Is used on ports connected to hosts to bypass the forwarding delay, meaning a port immediately transitions to the forwarding state.

> Enabling portfast on a non-host port could create loops.

> Configured globally with “spanning-tree portfast default”.

> Interface configuration “spanning-tree portfast enable”.

– Uplinkfast

> Originally Cisco proprietary.

> Is an access-layer technology used to speed up convergence time when direct failure of the local root port occurs.

> When a root port fails, the next best alternate port is immediately transitioned to the root port and placed into the forwarding state.

> The CAM table is flooded (using dummy sourced multicasts) out of this new root port to expedite the MAC learning process of its upstream neighbors.

> Apply caution if the bridge has more than two uplinks, as it might become transit.

> As a built-in safeguard when enabled, the bridge priority value and all ports cost values are incremented.

> Configured globally with “spanning-tree uplinkfast”.

– Backbonefast

> Originally Cisco proprietary.

> Used to speed up convergence when an indirect failure occurs upstream in the network.

> Generates RLQ (Root Link Query) BPDUs to check if the bridge should expire the ‘MAX_AGE’ for its current root bridge BDPUs and begins considering other ports.

> Configured globally with “spanning-tree backbonefast”.

logo-den

 

Contact Us

Let's us listen to you

Not readable? Change text. captcha txt

Start typing and press Enter to search