De documentatie van dit product is waar mogelijk geschreven met inclusief taalgebruik. Inclusief taalgebruik wordt in deze documentatie gedefinieerd als taal die geen discriminatie op basis van leeftijd, handicap, gender, etniciteit, seksuele oriëntatie, sociaaleconomische status of combinaties hiervan weerspiegelt. In deze documentatie kunnen uitzonderingen voorkomen vanwege bewoordingen die in de gebruikersinterfaces van de productsoftware zijn gecodeerd, die op het taalgebruik in de RFP-documentatie zijn gebaseerd of die worden gebruikt in een product van een externe partij waarnaar wordt verwezen. Lees meer over hoe Cisco gebruikmaakt van inclusief taalgebruik.
Cisco heeft dit document vertaald via een combinatie van machine- en menselijke technologie om onze gebruikers wereldwijd ondersteuningscontent te bieden in hun eigen taal. Houd er rekening mee dat zelfs de beste machinevertaling niet net zo nauwkeurig is als die van een professionele vertaler. Cisco Systems, Inc. is niet aansprakelijk voor de nauwkeurigheid van deze vertalingen en raadt aan altijd het oorspronkelijke Engelstalige document (link) te raadplegen.
Dit document beschrijft hoe u STP (Spanning Tree Protocol) kunt gebruiken om ervoor te zorgen dat u geen lusjes maakt wanneer u redundante paden in uw netwerk hebt.
Er zijn geen specifieke vereisten van toepassing op dit document.
De informatie in dit document is gebaseerd op de volgende software- en hardware-versies:
Cisco Catalyst 5500/5000 Switches
Een consolekabel die geschikt is voor de Supervisor Engine in de switch
Zes Catalyst 5509 switches
De overspannende - boomprincipes die het document voorstelt zijn van toepassing op bijna alle apparaten die STP steunen.
De informatie in dit document is gebaseerd op de apparaten in een specifieke laboratoriumomgeving. Alle apparaten die in dit document worden beschreven, hadden een opgeschoonde (standaard)configuratie. Als uw netwerk live is, moet u zorgen dat u de potentiële impact van elke opdracht begrijpt.
Spanning Tree Protocol (STP) is een Layer 2-protocol dat wordt uitgevoerd op bruggen en switches. De specificatie voor STP is IEEE 802.1D. Het belangrijkste doel van STP is ervoor te zorgen dat u geen lussen creëert wanneer er sprake is van redundante paden in uw netwerk. Lussen zijn dodelijk voor een netwerk.
De configuraties in dit document zijn van toepassing op Catalyst 2926G, 2948G, 2980G, 4500/4000, 5500/5000 en 6500/6000 switches met Catalyst OS (CatOS). Raadpleeg de volgende documenten voor informatie over de configuratie van STP op andere switchplatforms:
STP and MST (STP en MST) (Catalyst 6500/6000 switches met Cisco IOS®-software)
STP en MST configureren (Catalyst 4500/4000 Switches waarop Cisco IOS-software wordt uitgevoerd)
Het netwerk in dit document is als volgt opgebouwd:
STP wordt uitgevoerd op bruggen en switches die voldoen aan de 802.1D-norm. Er zijn verschillende STP-typen, maar 802.1D is het populairst en op grote schaal geïmplementeerd. U implementeert STP op bruggen en switches om lussen in het netwerk te voorkomen. Gebruik STP wanneer u redundante links wilt, maar geen lussen. Redundante links zijn net zo belangrijk als back-ups in het geval van een failover in een netwerk. Een storing van uw primaire apparaat activeert de back-uplinks, zodat gebruikers het netwerk kunnen blijven gebruiken. Zonder STP op de bruggen en switches kan een dergelijke storing resulteren in een lus. Als twee verbonden switches verschillende smaken van STP draaien, vereisen zij verschillende controles om samen te komen. Wanneer in de switches verschillende smaken worden gebruikt, ontstaan er problemen met de controle tussen blokkerende en doorsturen toestanden. Daarom wordt aanbevolen dezelfde STP-typen te gebruiken. Bekijk het volgende netwerk:
In dit netwerk is een redundante link gepland tussen Switch A en Switch B. Deze configuratie creëert echter de mogelijkheid van een bridging-lus. Een broadcast of multicast pakket dat bijvoorbeeld wordt verzonden vanaf station M naar station N blijft dan circuleren tussen beide switches.
Wanneer beide switches echter STP gebruiken, ziet het netwerk er logischerwijs als volgt uit:
Deze informatie is van toepassing op het scenario in het netwerkdiagram:
Switch 15 is de backbone switch.
Switch 12, 13, 14, 16 en 17 zijn verbonden met werkstations en pc’s.
Het netwerk definieert deze VLAN’s als volgt:
1
200
201
202
203
204
De VTP-domeinnaam (VLAN Trunking Protocol) is STD-Doc.
Om deze gewenste padredundantie te bieden en een lusvoorwaarde te voorkomen, definieert STP een Spanning Tree die alle switches in een uitgebreid netwerk omvat. STP zet bepaalde redundante datapaden gedwongen in stand-bystatus (geblokkeerd) en laat andere paden in doorstuurstatus staan. Als een link in de doorstuurstatus niet beschikbaar is, configureert STP het netwerk en leidt de datapaden om door het juiste stand-bypad te activeren.
Met STP moeten alle switches in het netwerk een root-brug kiezen, die het kernpunt in het netwerk wordt. Alle andere beslissingen in het netwerk, zoals welke poort moet worden geblokkeerd en welke poort in doorstuurmodus moet worden gezet, worden genomen vanuit het perspectief van deze root-brug. In een switched omgeving, die verschilt van een brugomgeving, is waarschijnlijk sprake van meerdere VLAN’s. Wanneer u een root-brug implementeert in een switchingnetwerk, verwijst u doorgaans naar de root-brug als de root-switch. Elk VLAN moet een eigen root-brug hebben omdat elk VLAN een afzonderlijk broadcastdomein is. De roots voor de verschillende VLAN’s kunnen zich allemaal op één switch of op verschillende switches bevinden.
Opmerking: de selectie van de root switch voor een bepaald VLAN is erg belangrijk. U kunt de root-switch kiezen of de switches laten beslissen (maar dat is riskant). Als u het selectieproces niet beheert, kan uw netwerk niet-optimale paden hebben.
Alle switches wisselen informatie uit die wordt gebruikt om de root-switch te bepalen en de daaropvolgende configuratie van het netwerk. Bridge Protocol Data Units (BPDU’s) bevatten deze informatie. Elke switch vergelijkt de parameters in de BPDU die de switch naar een naastliggende switch stuurt met de parameters in de BPDU die de switch ontvangt van de naastliggende switch.
In het selectieproces van de STP-root is lager beter. Als Switch A een root-id doorgeeft met een lager getal dan de root-id die Switch B doorgeeft, is de informatie van Switch A beter. Switch B stopt met het doorgeven van zijn root-id en accepteert de root-id van Switch A.
Raadpleeg Optional STP Features (Optionele STP-functies) voor meer informatie over enkele van de optionele STP-functies, zoals:
PortFast
Root Guard
Loop Guard
BPDU Guard
Voorwaarden
Voordat u STP configureert, selecteert u een switch als de root van de Spanning Tree. Deze switch hoeft niet de krachtigste switch te zijn, maar kies de meest gecentraliseerde switch op het netwerk. Alle datastromen op het netwerk verlopen vanuit het perspectief van deze switch. Kies ook de minst verstoorde switch in het netwerk. De backbone switches fungeren vaak als de root van de Spanning Tree omdat deze switches doorgaans geen verbinding maken met eindstations. Verplaatsingen en wijzigingen binnen het netwerk hebben ook minder invloed op deze switches.
Nadat u de root-switch heeft bepaald, stelt u de juiste variabelen in om de switch aan te wijzen als root-switch. De enige variabele die u moet instellen is de bridge priority . Als de switch een brugprioriteit heeft die lager is dan van alle andere switches, selecteren de andere switches automatisch de betreffende switch als root-switch.
Clients (eindstations) op switchpoorten
U kunt de set spantree portfast opdracht ook per poort uitgeven. Wanneer u de portfast variabele op een poort inschakelt, switch de poort onmiddellijk van blokkeringsmodus naar doorstuurmodus. Enablement van portfast helpt om te voorkomen dat uitval op clients die Novell Netware gebruiken of DHCP gebruiken om een IP-adres te verkrijgen. Gebruik deze opdracht echter niet als u een switch-naar-switch-verbinding hebt. In dat geval kan de opdracht resulteren in een lus. De vertraging van 30 tot 60 seconden die optreedt tijdens de overgang van blokkeringsmodus naar doorstuurmodus voorkomt een tijdgebonden lusvoorwaarde in het netwerk wanneer u twee switches aansluit.
Laat de meeste andere STP-variabelen op de standaardwaarden staan.
Werkingsregels
In deze sectie worden de werkingsregels van STP beschreven. Wanneer de switches voor het eerst worden ingeschakeld, wordt het selectieproces van de root-switch gestart. Elke switch stuurt per VLAN een BPDU naar de rechtstreeks verbonden switch.
Terwijl de BPDU het netwerk doorloopt, vergelijkt elke switch de BPDU die de switch stuurt met de BPDU die de switch ontvangt van de naastgelegen switches. De switches komen dan overeen welke switch de root-switch is. De switch met de laagste brug-id in het netwerk wint dit verkiezingsproces.
Opmerking: onthoud dat één root-switch per VLAN wordt geïdentificeerd. Na identificatie van de root-switch worden de volgende regels door de switches aangehouden.
-
STP-regel 1 – Alle poorten van de root-switch moeten in doorstuurmodus staan.
Opmerking: in sommige hoekgevallen, die betrekking hebben op poorten met een eigen lus, is er een uitzondering op deze regel.
Vervolgens bepaalt elke switch het beste pad naar de root-switch. Dit pad wordt bepaald door een vergelijking van de informatie in alle BPDU’s die de switches op alle poorten ontvangen. De switch gebruikt de poort met de minste hoeveelheid informatie in de BPDU om naar de root switch te gaan; de poort met de minste hoeveelheid informatie in de BPDU is de root poort. Nadat een switch de root-poort heeft bepaald, wordt verdergegaan met regel 2.
-
STP-regel 2 – De root-poort moet worden ingesteld op doorstuurmodus.
De switches in elk LAN-segment communiceren met elkaar om te bepalen welke switch het beste kan worden gebruikt om data van dat segment naar de root-brug te verplaatsen. Die switch is de aangewezen switch.
-
STP-regel 3 – In één LAN-segment moet de poort van de aangewezen switch die verbinding maakt met dat LAN-segment worden ingesteld op doorstuurmodus.
-
STP-regel 4 – Alle andere poorten van alle switches (VLAN-specifiek) moeten worden ingesteld op blokkeringsmodus. Deze regel geldt alleen voor poorten die verbinding maken met andere bruggen of switches. STP heeft geen invloed op poorten die verbinding maken met werkstations of pc’s. Die poorten blijven in doorstuurmodus staan.
Opmerking: de toevoeging of verwijdering van VLAN’s wanneer STP wordt uitgevoerd in de Spanning Tree (PVST / PVST+)-modus, leidt tot het opnieuw berekenen van Spanning Tree voor die VLAN-instantie en het verkeer wordt alleen voor dat VLAN onderbroken. De andere VLAN-onderdelen van een trunk-link@ kunnen verkeer normaal doorsturen. Wanneer VLAN’s voor een bestaande MST-instantie (Multiple Spanning Tree) worden toegevoegd of verwijderd, wordt herberekening van de Spanning Tree voor die instantie geactiveerd en wordt het verkeer voor alle VLAN-onderdelen van die MST-instantie verstoord.
Opmerking: standaard draait de overspanning op elke poort. De Spanning Tree-functie kan niet per poort worden uitgeschakeld op switches. Hoewel het niet wordt aanbevolen, kunt u STP uitschakelen per VLAN of globaal op de switch. De uiterste zorg moet worden genomen wanneer u het overspannen - boom onbruikbaar maakt omdat dit tot Layer 2 lijnen binnen het netwerk leidt.
Stapsgewijze instructies
Voer de volgende stappen uit:
-
Geef de show version opdracht uit om de softwareversie weer te geven die door de switch wordt uitgevoerd.
Opmerking: alle switches voeren dezelfde softwareversie uit.
Switch-15> (enable)show version
WS-C5505 Software, Version McpSW: 4.2(1) NmpSW: 4.2(1)
Copyright (c) 1995-1998 by Cisco Systems
NMP S/W compiled on Sep 8 1998, 10:30:21
MCP S/W compiled on Sep 08 1998, 10:26:29
System Bootstrap Version: 5.1(2)
Hardware Version: 1.0 Model: WS-C5505 Serial #: 066509927
Mod Port Model Serial # Versions
--- ---- ---------- --------- ----------------------------------------
1 0 WS-X5530 008676033 Hw : 2.3
Fw : 5.1(2)
Fw1: 4.4(1)
Sw : 4.2(1)
In dit scenario is Switch 15 de beste keuze als root-switch van het netwerk voor alle VLAN’s omdat deze de backbone switch is.
-
Geef de set spantree root vlan_id opdracht uit om de prioriteitstelling van de switch in te stellen op 8192 voor VLAN’s of VLAN’s die in het vlan_id formulier zijn gespecificeerd.
Opmerking: de standaardprioriteit voor switches is 32768. Wanneer u met deze opdracht de prioriteit instelt, dwingt u de selectie van Switch 15 als root-switch af omdat deze de laagste prioriteit heeft.
Switch-15> (enable)set spantree root 1
VLAN 1 bridge priority set to 8192.
VLAN 1 bridge max aging time set to 20.
VLAN 1 bridge hello time set to 2.
VLAN 1 bridge forward delay set to 15.
Switch is now the root switch for active VLAN 1.
Switch-15> (enable)
Switch-15> (enable)set spantree root 200
VLAN 200 bridge priority set to 8192.
VLAN 200 bridge max aging time set to 20.
VLAN 200 bridge hello time set to 2.
VLAN 200 bridge forward delay set to 15.
Switch is now the root switch for active VLAN 200.
Switch-15> (enable)
Switch-15> (enable)set spantree root 201
VLAN 201 bridge priority set to 8192.
VLAN 201 bridge max aging time set to 20.
VLAN 201 bridge hello time set to 2.
VLAN 201 bridge forward delay set to 15.
Switch is now the root switch for active VLAN 201.
Switch-15> (enable)
Switch-15> (enable)set spantree root 202
VLAN 202 bridge priority set to 8192.
VLAN 202 bridge max aging time set to 20.
VLAN 202 bridge hello time set to 2.
VLAN 202 bridge forward delay set to 15.
Switch is now the root switch for active VLAN 202.
Switch-15>
Switch-15> (enable)set spantree root 203
VLAN 203 bridge priority set to 8192.
VLAN 203 bridge max aging time set to 20.
VLAN 203 bridge hello time set to 2.
VLAN 203 bridge forward delay set to 15.
Switch is now the root switch for active VLAN 203.
Switch-15>
Switch-15> (enable)set spantree root 204
VLAN 204 bridge priority set to 8192.
VLAN 204 bridge max aging time set to 20.
VLAN 204 bridge hello time set to 2.
VLAN 204 bridge forward delay set to 15.
Switch is now the root switch for active VLAN 204.
Switch-15> (enable)
De kortere versie van de opdracht heeft hetzelfde effect, zoals in dit voorbeeld wordt getoond:
Switch-15> (enable)set spantree root 1,200-204
VLANs 1,200-204 bridge priority set to 8189.
VLANs 1,200-204 bridge max aging time set to 20.
VLANs 1,200-204 bridge hello time set to 2.
VLANs 1,200-204 bridge forward delay set to 15.
Switch is now the root switch for active VLANs 1,200-204.
Switch-15> (enable)
Het set spantree priority bevel verstrekt een derde methode om de wortel switch te specificeren:
Switch-15> (enable)set spantree priority 8192 1
Spantree 1 bridge priority set to 8192.
Switch-15> (enable)
Opmerking: in dit scenario zijn alle switches gestart met geklaarde configuraties. Daarom begonnen alle switches met de brugprioriteit 32768. Als u niet zeker weet of alle switches in uw netwerk een prioriteit hebben die groter is dan 8192, stelt u de prioriteit van uw gewenste root-brug in op 1.
-
Geef het set spantree portfast mod_num/port_num enable commando uit om de PortFast-instelling te configureren op de Switches 12, 13, 14, 16 en 17.
Opmerking: stel deze instelling alleen in op poorten die verbinding maken met werkstations of pc's. Schakel PortFast niet in op een poort die verbinding maakt met een andere switch.
-
Poort 2/1 maakt verbinding met Switch 13.
-
Poort 2/2 maakt verbinding met Switch 15.
-
Poort 2/3 maakt verbinding met Switch 16.
-
Poorten 3/1 tot en met 3/24 maken verbinding met pc’s.
-
Poorten 4/1 tot en met 4/24 maken verbinding met UNIX-werkstations.
Met deze informatie als basis, geef het set spantree portfastbevel op de poorten 3/1 tot en met 3/24 en op de poorten 4/1 tot en met 4/24:
Switch-12> (enable)set spantree portfast 3/1-24 enable
Warning: Spantree port fast start should
only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc.
to a fast start port can cause temporary spanning-tree loops. Use with caution. Spantree ports 3/1-24 fast start enabled.
Switch-12> (enable) Switch-12> (enable)set spantree portfast 4/1-24 enable Warning: Spantree port fast start should
only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc.
to a fast start port can cause temporary spanning-tree loops. Use with caution. Spantree ports 4/1-24 fast start enabled. Switch-12> (enable)
-
Geef het show spantree vlan_idbevel uit om te verifiëren dat Switch 15 de wortel van alle aangewezen VLANs is.
Vergelijk vanuit de output van deze opdracht het MAC-adres van de switch die de root-switch is met het MAC-adres van de switch vanaf waar u de opdracht heeft uitgevoerd. Als de adressen overeenkomen, is de switch waarop u de opdracht uitvoert de root-switch van het VLAN. Een root-poort 1/0 geeft ook aan dat u bij de root-switch bent. Dit is de output van de voorbeeldopdracht:
Switch-15> (enable)show spantree 1
VLAN 1
spanning-tree enabled
spanning-tree type ieee
Designated Root 00-10-0d-b1-78-00
!--- This is the MAC address of the root switch for VLAN 1.
Designated Root Priority 8192
Designated Root Cost 0
Designated Root Port 1/0
Root Max Age 20 sec Hello Time 2 sec Forward Delay 15 sec
Bridge ID MAC ADDR 00-10-0d-b1-78-00
Bridge ID Priority 8192
Bridge Max Age 20 sec Hello Time 2 sec Forward Delay 15 sec
Deze output toont aan dat Switch 15 de aangewezen root-switch is in de Spanning Tree voor VLAN 1. Het MAC-adres van de aangewezen root-switch, 00-10-0d-b1-78-00, is hetzelfde als het bridge-ID MAC-adres van Switch 15,00-10-0d-b1-78-00. Een andere indicatie dat deze switch de aangewezen root-switch is, is het feit dat de aangewezen root-poort 1/0 is.
In deze uitvoer van Switch 12 herkent de switch Switch 15 als de Designated Rootuitvoer van VLAN 1:
Switch-12> (enable)show spantree 1
VLAN 1
spanning-tree enabled
spanning-tree type IEEEDesignated Root 00-10-0d-b1-78-00
!--- This is the MAC address of the root switch for VLAN 1.
Designated Root Priority 8192
Designated Root Cost 19
Designated Root Port 2/3
Root Max Age 20 sec Hello Time 2 sec Forward Delay 15 sec
Bridge ID MAC ADDR 00-10-0d-b2-8c-00
Bridge ID Priority 32768
Bridge Max Age 20 sec Hello Time 2 sec Forward Delay 15 sec
Opmerking: de uitvoer van de opdracht show spantree vlan_id voor de andere switches en VLAN’s kan ook aangeven dat Switch 15 de aangewezen root is voor alle VLAN’s.
Verifiëren
Deze sectie bevat informatie over de manier waarop u kunt controleren of de configuratie goed werkt.
-
show spantree vlan_id— Toont de huidige status van de overspanningsstructuur voor deze VLAN-id vanuit het perspectief van de switch waarop u de opdracht geeft.
-
show spantree summary— Biedt een samenvatting van het verbonden overspannen - boompoorten door VLAN.
Problemen oplossen
Deze sectie bevat informatie waarmee u problemen met de configuratie kunt oplossen.
STP-padkosten worden automatisch gewijzigd wanneer poortsnelheid/duplex wordt gewijzigd
STP berekent de padkosten op basis van de mediasnelheid (bandbreedte) van de links tussen switches en de poortkosten van elk port forwarding-frame. Spanning Tree selecteert de root-poort op basis van de padkosten. De poort met de laagste padkosten voor de root-brug wordt de root-poort. De root-poort heeft altijd de doorstuurstatus.
Als snelheid/duplex van de poort wordt gewijzigd, berekent Spanning Tree de padkosten automatisch opnieuw. Een wijziging in de padkosten kan de Spanning Tree-topologie wijzigen.
Raadpleeg het gedeelte Poortkosten berekenen en toewijzen in het gedeelte Spanning Tree configureren voor meer informatie over het berekenen van poortkosten.
Opdrachten voor probleemoplossing
Opmerking: raadpleeg Belangrijke informatie over debug-opdrachten voordat u debug-opdrachten gebruikt.
-
show spantree vlan_id—Toont de huidige status van de overspanningsboom voor deze VLAN-id, vanuit het perspectief van de switch waarop u de opdracht geeft.
-
show spantree summary—Biedt een samenvatting van het verbonden overspannen - boompoorten door VLAN.
-
show spantree statistics—Toont het overspannen van boom statistische informatie.
-
show spantree backbonefast—Geeft aan of de Spanning Tree BackboneFast Convergence-functie is ingeschakeld.
-
show spantree blockedports—Hier worden alleen de geblokkeerde poorten weergegeven.
-
show spantree portstate—Bepaalt de huidige overspannen - boomstaat van een Token Ring haven binnen een overspannende boom.
-
show spantree portvlancost—Toont de padkosten voor de VLAN’s op een poort.
-
show spantree uplinkfast—Toont de instellingen van UplinkFast.
Overzicht van opdrachten
Syntaxis:
show version
Zoals gebruikt in dit document:
show version
Syntaxis:
set spantree root [vlan_id]
Zoals gebruikt in dit document:
set spantree root 1
set spantree root 1,200-204
Syntaxis:
set spantree priority [vlan_id]
Zoals gebruikt in dit document:
set spantree priority 8192 1
Syntaxis:
set spantree portfast mod_num/port_num {enable | disable}
Zoals gebruikt in dit document:
set spantree portfast 3/1-24 enable
Syntaxis:
show spantree [vlan_id]
Zoals gebruikt in dit document:
show spantree
Gerelateerde informatie
Revisie | Publicatiedatum | Opmerkingen |
---|---|---|
3.0 |
08-May-2023 |
Hercertificering |
2.0 |
07-Apr-2022 |
Een verbroken link verwijderd. |
1.0 |
11-Dec-2019 |
Eerste vrijgave |