From 6c2b3ce35776073f75f11376b8fd03332bf59dc9 Mon Sep 17 00:00:00 2001 From: shango-wk Date: Wed, 20 May 2026 12:42:07 +0200 Subject: [PATCH] update Spanning Tree --- 00. Jeremy's IT LAB CCNA course.md | 1 + 20. Protocole Spanning Tree (part1).md | 140 +++++++++++++++++++++++++ 21. Protocole Spanning Tree (part2).md | 111 ++++++++++++++++++++ 3 files changed, 252 insertions(+) create mode 100644 20. Protocole Spanning Tree (part1).md create mode 100644 21. Protocole Spanning Tree (part2).md diff --git a/00. Jeremy's IT LAB CCNA course.md b/00. Jeremy's IT LAB CCNA course.md index 8143d80..4b730b3 100644 --- a/00. Jeremy's IT LAB CCNA course.md +++ b/00. Jeremy's IT LAB CCNA course.md @@ -29,3 +29,4 @@ tags: [[VLAN (Part 2)]] [[VLAN (Part 3)]] [[DTP - VTP]] +[[Protocole Spanning Tree]] diff --git a/20. Protocole Spanning Tree (part1).md b/20. Protocole Spanning Tree (part1).md new file mode 100644 index 0000000..4395d2f --- /dev/null +++ b/20. Protocole Spanning Tree (part1).md @@ -0,0 +1,140 @@ +--- +id: 20. Protocole Spanning Tree +aliases: [] +tags: [] +--- + +# Protocole Spanning Tree + +## Networks Redundancy + +- Redundandy is an essential part of network design. +- Modern networks are expected to run 24/7/365 +- if one network component fails, you must ensure that other components will take over +with little or no downtime +- As much as possible, you must implement redundancy at every possible point in the network + + note: Most PCs only have a single network interface card [[NIC]], so they can only be plugged + into a single switch. However, important servers typically have multiple NICs, so they can be + plugged into multiple switches for redundancy + +The [[Ethernet header]] doesn't have a [[TTL]] field. These broadcast frames will loop around +the network indefinitely, if enough of these looped broadcasts accumulate in the network, the +network will be too congested for legitimate traffic to use the network. This is called +[[Broadcast Storm]] + +Network congestion isn't the only problem. each time a frame arrives on a switchport, the switch +uses the source [[MAC]] address field to learn the MAC address and update its MAC address table. +When a frames with the same source MAC address repeatedly arrive on different interfaces, +the switch is continously updating the interface in its MAC address table. this is known as +[[MAC Address Flapping]] + +## Spanning Tree protocol + +- Classic Spanning Tree Protocol is **IEEE 802.1D** +- Switches from all vendors run STP by default. +- STP prevents Layer 2 loops by placing redundant ports in a blocking state, essentially disabling +the interface. +- These interfaces act as backups that can enter a forwarding state if an active (=currently forwarding) +interface fails +- Interfaces in a frowarding state behave normally. They send and receive all normal traffic. +- Interfaces in a blocking state only send or receive STP messages (called **[[BPDU]]s**) +Bridge Protocol Data Units + + note: Spanning Tree Protocol still use the term [[Bridge]]. However, when we use the term + bridge, we really mean [[Switch]]. Bridges are not used in modern networks. + +- By selecting which ports are forwarding and which ports are blocking, STP creates a single path to/from +each point in the network. This prevents Layer 2 loops. +- There us a set process that STP uses to determine which ports should be forwartding and which should +be blocking +- STP-enanbled switches send/receive Hello BPDUs out of all interfaces, the default timer is +2 seconds (the switch will send a Hello BPDU out of every interface, once every 2 secong) +- If a switch receives a Hello BPDUs on an interface, it knows that interface is connected to another +switch (routers, PCs, etc. do not use STP, so they do not send Hello BPDUs) + +- Switches use one field in the STP BPDU, the Bridge ID field, to elect a root bridge for the network +- The switch with the lowest Bridge ID becomes the root bridge. +- ALL ports on the root bridge are put in a forwarding state,and other switches in the topology +must have a path to reach the root bridge + ++---------------------------------+ +| Bridge ID | +|------------------+--------------| +| Bridge Priority | Mac address | +| 16 bits | 48 bits | ++---------------------------------+ + +The default bridge priority is 32768 on all switches, so by default the MAC address is used +as the tie-breaker (lowest MAC address becomes the root bridge) + +**The Bridge Priority is compared first. if they tie, the MAC address is then compared** + +Howerver the Bride ID have been updated + ++---------------------------------+ +| Bridge ID | +|------------------+--------------| +| Bridge Priority | Mac address | +| 16 bits | 48 bits | ++---------------------------------+ + | ++----------------------------+ +| Bridge | Extended System ID| +|Priority| (VLAN ID) | +| 4bits | 12 bits | ++----------------------------+ + +Cisco switches use a version of STP called PVST (per-VLAN Spanning Tree). +PVST runs a separate STP instance in each VLAN, so in each VLAN different interfaces +can be forwarding/blocking + +in the default VLAN of 1, the default bridge priority is actually 32769 (32768 + 1) + +The STP bridge priority can only be changed in units of 4096 + +All interface on the root bridge are **designated ports**. designated ports are in a forwarding state + +Whe a switch is powered on, it assumes it is the root bridge. +it will only give up its position if it receives a superior BPDU (lower bridge ID) + +Once the topology has converged and all switches agree on the root bridge, only the root bridge sends BPDUs +Other switches in the network will forward these BPDUs, but will not generate their own original BPDUs + +### STP Cost + +| Speed | STP Cost | +| -------------- | --------------- | +| 10Mbps | 100 | +| 100Mbps | 19 | +| 100Gbps | 4 | +| 10Gbps | 2 | + +The ports connected to another switch's root port MUST be designated. Because the root port is the switch's path to the root bridge +another switch must not block it + +### Port ID + +STP Port ID = port priority (default 128) + port number + +Every collision domain has a single STP designated port + +### Steps + +1) The switch with the lowest bridge ID is elected as the root bridge. All ports on the root bridge are designated ports (forwarding state). +2) Each remaining switch will select ONE of its interfaces to be its root port. The interface with the lowest root cost will +be the root port. Root ports are also in a forwarding state +Root port selection: + - lowest root cost + - lowest neighbor bridge ID + - lowest neighbor port ID +3) Each remaining collision domain will select ONE interface to be a designated port (forwarding state). THe other port in the +collision domain will be non-designated (blocking) +Designated port selection: + - Interface on switch wih lowest root cost + - Interface on switch wih lowest bridge ID + +## Review + +- Redundancy in networks +- STP (Spanning Tree Protocol) diff --git a/21. Protocole Spanning Tree (part2).md b/21. Protocole Spanning Tree (part2).md new file mode 100644 index 0000000..90ff6fe --- /dev/null +++ b/21. Protocole Spanning Tree (part2).md @@ -0,0 +1,111 @@ +--- +id: 1778913634-WEMK +aliases: + - Protocole Spanning Tree (part2) +tags: [] +--- + +# Protocole Spanning Tree (part2) + +## Spanning Tree Port State + +| STP Port State | Stable/Transitional | +| -------------- | --------------- | +| Blocking | Statble | +| Listening | Transitional | +| Learning | Transitional | +| Forwarding | Stable | +| Disabled | Stable | + +- Root/Designated ports remain stab;e in Forwarding state. +- Non-designated ports remain stabl in a Blocking state. +- Listening and Learning are transitional states which are passed through when an interface is +activated, or when a *Blocking* port must transition to a Forwarding state due to a change in the +network topology + +### Blocking state + +- Non designated ports are in a Blocking state +- Interfaces in a Blocking state are effectively disabed to prevent loops. +- Interfaces in a Blocking stae do not send/receive regular naetwork traffic. +- Interfaces in a Blocking state receive STP BPDUs. +- Interfaces in a Blocing state do NOT forward STP BPDUs. +- Interfaces in a Blocking state do NOT learn [[MAC]] addresses. + +### Listening state + +- After the Blocking state interfaces with the Designated or Root role enter Listening state. +- Only Designated or Root ports enter the Listening state (Non-designated ports are always Blocking) +- The Listening state is 15 seconds long by default. This is determined by the *orward delay* timer. +- An interface in the listening state ONLY forwards/receives STP BPDUs. +- An interface in the Listening state does NOT send/receive regular traffic +- An interface in the Listening state does NOT Learn MAC addresses from regular traffic that +arrives on the interface + +### Learning state + +- After the Listeing state, a Designated or ROOT port will enter Learning state. +- The Learning state is 15 seconds long by default. This is determined by the Forward delay +timer ( the same timer is used for both the Listening and Learning states). +- An interface in the Learning state ONLY sends/receives STP BPDUs. +- An interface in the Learning state learns MAC addresses from regular traffic that arrives on +the interface. + +### Forwarding state + +- Root and designated ports are in a Forwarding state. +- A port in the Forwarding state operate as normal +- A port in the Forwarding state sends/receives BPDUs. +- A port in the Forwarding state sends/receives normal traffic. +- A port in the Forwarding state learns MAC addresses. + +### summary + + +| STP Port State |Send/Receive BPDUs | Frame forwarding | Mac address learning| Stable/Transitional | +| -------------- |----|----|----| --------------- | +| Blocking | No/Yes| NO | NO | Statble | +| Listening | Yes/Yes| NO | NO | Transitional | +| Learning | Yes/Yes| NO | Yes | Transitional | +| Forwarding | Yes/Yes| Yes | Yes | Stable | +| Disabled | NO/NO| NO | NO | Stable | + + + note: Switches do not forward the BPDUs out of their root ports and non-designated ports, + only their designated ports + +## STP timers + +### Hello + +How often the root bridge sends hello BPDUs +duration: 2 sec + +### Forward delay + +How long the switch will stay in the Listening and Learning states (each stae is 15 seconds += total 30 seconds) +duration: 15sec + +### Max Age + +How long an interface will wait after ceasing to receive Hello BDPUs to change the STP topology +duration: 20 sec (10*hello) + +- If another BPDU i received before the max age timer counts down to 0, the time will reset to 20 +seconds and no changes will ocur. + +- If another BPDU is not received the max age timer counts down to 0 and the switch will +reevaluate its STP choices, including root bridge, and local root, designated, and non-designated ports + +- if a non-designated port is selected to become a designated or root port, it will transition +from the blocking state to the listening state (15 seconds), learning state (15 seconds), +and then finally the forwarding state. So it can take a total of 50 seconds for a blocking +interface to transition to forwarding + +## Review + +- STP state/timers +- STP BPDU +- STP optional features +- STP configuration