141 lines
5.9 KiB
Markdown
141 lines
5.9 KiB
Markdown
---
|
|
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)
|