User Tools

Site Tools


networking:stp

This is an old revision of the document!


STP

Algorithm

How it works:

  1. Each switch generates an ID for itself (PBDU ID)
    1. BPDU ID has two parts - priority:System-Mac
  2. Each switch sends BPDUs out of all its ports (as multicast)
  3. After BPDUs are exchanged, Root switch is elected
    1. Root is having the smallest priority, and if equal - smallest System-Mac
    2. Only Root switch keeps sending BPDUs
    3. On the Root switch all ports are Designated
  4. All non-Root switches will elect a Root port - port closest to the Root switch
    1. Root port is having the smallest Cost to the Root switch (cost is based on the speed)
    2. If there are parallel links, port with the smallest number wins
  5. On all non-Root switches, elect Designated port and define Blocked ports
    1. Designated port is the port closest (cost-wise) to the Root
    2. If cost is the same - the port on the switch with lowest System-MAC becomes a Designated port

Port States

  1. Disabled
  2. Listening - switch sends and receives BPDUs. It lasts 15 seconds and it's where Root is elected
  3. Learning - switch is building MAC address table. Also lasts 15 seconds
  4. Forwarding
    1. Root Port
    2. Designated Port

During Failure

Root port sends BPDUs every 2 seconds. If non-root switch stops receiving BPDUs over Root port for 20 seconds, it starts the Listening and Learning process on the Blocked port. Failover time is 50 seconds.

RSTP

RST improves convergence time. Instead of having a Blocked port and spending too much time in Listening and Learning, we have Alternate port. Basically it's a second best port if Root port fails. When Root port fails, switch waits max time out (20 seconds) and starts forwarding traffic over the new Root port

PORT-FAST

When port flaps, switch sends TCN (topology change notification) message, which forces all switches to re-calculate the root switch. This is not very efficient when port towards the client flaps. In order to mitigate that, customer facing port is configured with spanning-tree portfast. This port will be always on (forwarding).

BPDU Guard

We should not receive BPDUs on the customer facing ports. There is a feature which sets the port to err-disabled state if switch receives a BPDU on that port.

networking/stp.1764777262.txt.gz · Last modified: by v1ctor