Jeremy’s IT Lab lecture video:
Day 21 - Spanning Tree Protocol (STP) (2)
Commands
Commands List
Spanning Tree Show Commands
6. Spanning Tree
Link to original
- show spanning-tree
-->Shows general STP status and information- show spanning-tree vlan vlan-id
-->Shows spanning-tree information for a specific VLAN- show spanning-tree detail
-->Shows detailed STP information- show spanning-tree summary
-->Shows a summary of the current STP configurationSpanning Tree Interface Commands
Spanning Tree
1. General
- spanning-tree mode mode {mst
/pvst/rapid-pvst} (Versions)2. Spanning Tree Portfast / BPDU Guard
- spanning-tree portfast
-->Enables portfast on the current interface.- spanning-tree portfast default
-->Enables Portfast on all access ports by default.- spanning-tree bpduguard enable
-->Enables BPDU Guard on the current interface.- spanning-tree portfast bpduguard default
-->Enables BPDU Guard on all Portfast-enabled interfaces by default.3. Spanning Tree VLAN Related
- spanning-tree vlan vlan-id root primary
-->Sets the STP bridge priority to 24576 (Or 4096 lower than the current lowest STP priority.)- spanning-tree vlan vlan-id root secondary
-->Sets the STP bridge priority to 28672- spanning-tree vlan vlan-id cost number
-->Changes the interface’s STP root cost- spanning-tree vlan vlan-id port-priority number
-->Changes the interface’s port priority4. Spanning Tree Link Type
Link to original
- spanning-tree link-type type { point-to-point
/shared }
Classic Spanning Tree Information
The protocol version identifier for classic STP is 0
Spanning Tree Port States
Classic Spanning Tree has 5 different port states, being:
- Blocking / Stable
- Listening / Transitional
- Learning / Transitional
- Forwarding / Stable
- Disabled
A forwarding interface can move directly into a blocking,
However, a blocking cannot move directly into a forwarding state. It must go through the listening and learning states first.
| STP Port State | Send/Receive BPDUs | Frame Forwarding (Regular Traffic) | MAC Address Learning | Stable/Transitional |
|---|---|---|---|---|
| Blocking | NO/YES | NO | NO | Stable |
| Listening | YES/YES | NO | NO | Transitional |
| Learning | YES/YES | NO | YES | Transitional |
| Forwarding | YES/YES | YES | YES | Stable |
| Disabled | NO/NO | NO | NO | Stable |
Spanning Tree Timers
There are 3 different spanning tree timers, being:
- Hello / 2 seconds
- Forward delay / 15 seconds
- Max age / 20 seconds (10 multiplied by hello timer)
| STP Timer | Purpose | Duration |
|---|---|---|
| Hello | How often the root bridge sends Hello BPDUs | 2 sec |
| Forward Delay | How long the switch will stay in the Listening and Learning states (each state is 15 seconds = total 30 seconds) | 15 sec |
| Max Age | How long an interface will wait after ceasing to receive Hello BPDUs to change the STP topology | 20 sec (10*hello) |
BPDU forwarding
Switches do not forward the BPDUs out of their root ports and non-designated ports, only their designated ports.
Spanning Tree Optional Features (STP Toolkit)
- Portfast
- Portfast allows a port to move immediately into the forwarding state, bypassing listening and learning. This is used for switchports which are connected to end hosts, as they do not pose a risk to causing loops in the network.
- Portfast will only work on access ports.
- BPDU Guard
- BPDU Guard makes it so when an interface with BPDU Guard enabled receives a BPDU from another switch, the interface will be shut down to prevent a loop from forming.
- Root Guard
- If you enable root guard on an interface, even if it receives a superior BPDU (lower bridge ID) on that interface, the switch will not accept the new switch as the root bridge. The interface will be disabled.
- Loop Guard
- If you enable loop guard on an interface, even if the interface stops receiving BPDUs, it will not start forwarding. The interface will be disabled.
Spanning Tree Primary and Secondary Root Bridges
There are two commands to easily change the bridge priority of a switch, they are:
- spanning-tree vlan vlan-id root primary
- The command sets the STP priority to 24576.
- If another switch already has a priority lower than 24576, it sets this switch’s priority to 4096 less than the other switch’s priority.
- spanning-tree vlan vlan-id root secondary
- The command sets the STP priority to 28672.
Spanning Tree Port Settings
There are two commands you need to know for spanning tree port settings, they are:
- spanning-tree vlan vlan-id cost number
- Changes an interface’s root cost, therefore overriding the default STP port costs.
- spanning-tree vlan vlan-id port-priority number
- Changes an interface’s port priority, therefore overriding the default STP port priority of 128.
Jeremy’s IT Lab előadásvideó:
21. Nap - Spanning Tree Protocol (STP) (2)
Parancsok
Parancslista
Spanning Tree Show Parancsok
6. Spanning Tree
Eredeti hivatkozása
- show spanning-tree
-->Megjeleníti az általános STP állapotot és információkat- show spanning-tree vlan vlan-id
-->Megjeleníti egy adott VLAN spanning-tree információit- show spanning-tree detail
-->Részletes STP információkat jelenít meg- show spanning-tree summary
-->Összefoglalót jelenít meg az aktuális STP konfigurációrólSpanning Tree Interfész Parancsok
Spanning Tree
1. Általános
- spanning-tree mode mode {mst
/pvst/rapid-pvst} (Verziók)2. Spanning Tree Portfast / BPDU Guard
- spanning-tree portfast
-->Engedélyezi a portfastot az aktuális interfészen.- spanning-tree portfast default
-->Alapértelmezés szerint engedélyezi a Portfastot minden access porton.- spanning-tree bpduguard enable
-->Engedélyezi a BPDU Guardot az aktuális interfészen.- spanning-tree portfast bpduguard default
-->Alapértelmezés szerint engedélyezi a BPDU Guardot minden Portfast-engedélyezett interfészen.3. Spanning Tree VLAN-hoz kapcsolódó parancsok
- spanning-tree vlan vlan-id root primary
-->Az STP bridge priority értékét 24576-ra állítja (Vagy 4096-tal alacsonyabbra a jelenlegi legalacsonyabb STP priority-nél.)- spanning-tree vlan vlan-id root secondary
-->Az STP bridge priority értékét 28672-re állítja- spanning-tree vlan vlan-id cost number
-->Módosítja az interfész STP root cost értékét- spanning-tree vlan vlan-id port-priority number
-->Módosítja az interfész port priority értékét4. Spanning Tree Link Típus
Eredeti hivatkozása
- spanning-tree link-type type { point-to-point
/shared }
Klasszikus Spanning Tree Információk
A klasszikus STP protokoll verzióazonosítója (protocol version identifier) 0
Spanning Tree Port Állapotok
A Klasszikus Spanning Tree 5 különböző port állapottal rendelkezik:
- Blocking / Stabil (Stable)
- Listening / Átmeneti (Transitional)
- Learning / Átmeneti (Transitional)
- Forwarding / Stabil (Stable)
- Disabled
Egy forwarding interfész közvetlenül átléphet blocking állapotba,
Azonban a blocking állapotból nem lehet közvetlenül forwarding állapotba lépni. Először kötelezően végig kell mennie a listening és learning állapotokon.
| STP Port Állapot | BPDU-k küldése/fogadása | Frame Továbbítás (Normál adatforgalom) | MAC Address Tanulás | Stabil/Átmeneti |
|---|---|---|---|---|
| Blocking | NEM/IGEN | NEM | NEM | Stabil |
| Listening | IGEN/IGEN | NEM | NEM | Átmeneti |
| Learning | IGEN/IGEN | NEM | IGEN | Átmeneti |
| Forwarding | IGEN/IGEN | IGEN | IGEN | Stabil |
| Disabled | NEM/NEM | NEM | NEM | Stabil |
Spanning Tree Időzítők (Timers)
3 különböző spanning tree időzítő létezik:
- Hello / 2 másodperc
- Forward delay / 15 másodperc
- Max age / 20 másodperc (a hello időzítő 10-szerese)
| STP Időzítő | Cél / Szerep | Időtartam |
|---|---|---|
| Hello | Milyen gyakran küld a root bridge Hello BPDU-kat | 2 mp |
| Forward Delay | Mennyi ideig marad a switch a Listening és Learning állapotokban (mindegyik állapot 15 másodperc = összesen 30 másodperc) | 15 mp |
| Max Age | Mennyi ideig vár egy interfész a Hello BPDU-k fogadásának megszűnése után az STP topológia módosításával | 20 mp (10*hello) |
BPDU továbbítás
A switchek nem továbbítják a BPDU-kat a root és non-designated portjaikon, kizárólag a designated portjaikon.
Spanning Tree Opcionális Funkciók (STP Toolkit)
- Portfast
- A Portfast lehetővé teszi, hogy egy port azonnal forwarding állapotba kerüljön, kihagyva a listening és learning fázisokat. Ezt végberendezésekhez (end hosts) csatlakozó switchportokon használják, mivel ezek nem jelentenek hurokképződési (loop) kockázatot a hálózatban.
- A Portfast kizárólag access portokon működik.
- BPDU Guard
- A BPDU Guard gondoskodik róla, hogy ha egy BPDU Guard engedélyezett interfész BPDU-t kap egy másik switchtől, az interfész azonnal leálljon (shutdown), megelőzve a hurok kialakulását.
- Root Guard
- Ha engedélyezzük a root guardot egy interfészen, még ha fölényesebb (superior) BPDU-t is kap (alacsonyabb bridge ID-val) az adott porton, a switch nem fogadja el az új switchet root bridge-ként. Az interfész letiltásra (disabled) kerül.
- Loop Guard
- Ha engedélyezzük a loop guardot egy interfészen, még ha az interfész nem is kap többé BPDU-kat, nem kezd el automatikusan forgalmat továbbítani (forwarding). Az interfész letiltásra (disabled) kerül.
Spanning Tree Elsődleges és Másodlagos Root Bridge-ek
Két parancs létezik egy switch bridge priority értékének egyszerű megváltoztatására:
- spanning-tree vlan vlan-id root primary
- A parancs az STP priority-t 24576-ra állítja.
- Ha egy másik switch prioritása már 24576-nál alacsonyabb, akkor a switch prioritását 4096-tal a másik switch prioritása alá állítja.
- spanning-tree vlan vlan-id root secondary
- A parancs az STP priority-t 28672-re állítja.
Spanning Tree Port Beállítások
Két parancsot kell ismerni a spanning tree portbeállításokhoz:
- spanning-tree vlan vlan-id cost number
- Módosítja egy interfész root cost értékét, felülbírálva az alapértelmezett STP portköltségeket.
- spanning-tree vlan vlan-id port-priority number
- Módosítja egy interfész port priority értékét, felülbírálva az alapértelmezett 128-as STP port priority értéket.