O conjunto de documentação deste produto faz o possível para usar uma linguagem imparcial. Para os fins deste conjunto de documentação, a imparcialidade é definida como uma linguagem que não implica em discriminação baseada em idade, deficiência, gênero, identidade racial, identidade étnica, orientação sexual, status socioeconômico e interseccionalidade. Pode haver exceções na documentação devido à linguagem codificada nas interfaces de usuário do software do produto, linguagem usada com base na documentação de RFP ou linguagem usada por um produto de terceiros referenciado. Saiba mais sobre como a Cisco está usando a linguagem inclusiva.
A Cisco traduziu este documento com a ajuda de tecnologias de tradução automática e humana para oferecer conteúdo de suporte aos seus usuários no seu próprio idioma, independentemente da localização. Observe que mesmo a melhor tradução automática não será tão precisa quanto as realizadas por um tradutor profissional. A Cisco Systems, Inc. não se responsabiliza pela precisão destas traduções e recomenda que o documento original em inglês (link fornecido) seja sempre consultado.
Este documento descreve como usar o Spanning Tree Protocol (STP) para garantir que você não crie loops quando tiver caminhos redundantes na rede.
Não existem requisitos específicos para este documento.
As informações neste documento são baseadas nestas versões de software e hardware:
Cisco Catalyst 5500/5000 Switches
Um cabo de console que apropriado para o Supervisor Engine no switch
Seis Catalyst 5509 Switch
Os princípios de spanning tree que o documento apresenta são aplicáveis a quase todos os dispositivos que suportam o STP.
As informações neste documento foram criadas a partir de dispositivos em um ambiente de laboratório específico. Todos os dispositivos utilizados neste documento foram iniciados com uma configuração (padrão) inicial. Se a rede estiver ativa, certifique-se de que você entenda o impacto potencial de qualquer comando.
O Spanning Tree Protocol (STP) é um protocolo da camada 2 que é executado em pontes e em interruptores. A especificação para o STP é IEEE 802.1D. O propósito principal do STP é assegurar-se que você não crie laços quando existem caminhos redundantes em sua rede. Os loops estão inoperantes em uma rede.
As configurações neste documento aplicam-se a a Catalyst 2926G, 2948G, 2980G, 4500/4000, 5500/5000, e 6500/6000 Switches que executam o Catalyst OS (CatOS). Refira a estes originais para obter informações sobre da configuração do STP em outras plataformas do switch:
STP e MST (Switches Catalyst 6500/6000 com Cisco IOS®Software)
Configurar STP e MST (Switches Catalyst 4500/4000 que executam o Cisco IOS Software)
Este documento utiliza a seguinte configuração de rede:
Corridas STP nas pontes e nos interruptores que são 802.1D-compliant. Há uns sabores diferentes do STP, mas 802.1D é o mais popular e executado extensamente. Você executa o STP em pontes e em interruptores a fim de impedir laços na rede. Use o STP nas situações onde você quer links redundantes, mas não laços. Os links redundantes são tão importantes quanto backups no caso de uma falha na rede. Uma falha do seu preliminar ativa os links de backup de modo que os usuários possam continuar a usar a rede. Sem o STP nas bridges e nos switches, essa falha pode resultar em um loop. Se dois switches conectados executam tipos diferentes de STP, eles exigem controles diferentes para convergir. Quando diferentes variações são usadas nos switches, isso cria problemas de controle entre os estados Blocking e Forwarding. Conseqüentemente, recomenda-se usar os mesmos sabores do STP. Considere esta rede:
Nesta rede, um link redundante é planejado entre o Switch A e o switch B. Contudo, esta instalação cria a possibilidade de um Loop de Bridging. Por exemplo, uma transmissão ou um pacote de transmissão múltipla que transmite da estação M e sejam destinado para a estação N continua simplesmente a circular entre ambos os interruptores.
Contudo, quando o STP é executado em ambos os interruptores, a rede olha logicamente como esta:
Esta informação aplica-se à encenação no diagrama da rede:
O Switch 15 é o Switch backbone.
Os switches 12, 13, 14, 16, e 17 são os interruptores que anexam às estações de trabalho e aos PC.
A rede define estes VLAN:
1
200
201
202
203
204
O Domain Name do protocolo VLAN Trunk (VTP) é STD-Doc.
A fim de fornecer esta redundância do caminho desejado, assim como evitar uma condição de loop, o STP define uma árvore que meça todos os interruptores em uma rede extendida. O STP força determinados caminhos de dados redundantes em um estado (bloqueado) à espera e deixa outros trajetos em um estado de encaminhamento. Se um link no estado de encaminhamento se torna não disponível, o STP reconfigura a rede e redistribui trajetos de dados com a ativação do caminho em standby apropriado.
Com STP, a chave é para todos os interruptores na rede para eleger um bridge-raiz que se transforme no ponto focal na rede. Todas decisões restantes na rede, tal como que a porta a obstruir e qual mover para o modo de encaminhamento, são feitos da perspectiva da ponte raíz. Um ambiente comutado, que seja diferente de um ambiente da ponte, mais provavelmente trata de VLANs múltiplos. Quando você executa um bridge-raiz em uma rede de comutação, você refere geralmente o bridge-raiz como o switch-raiz. Cada VLAN deve ter seu próprio bridge-raiz porque cada VLAN é um domínio de transmissão separado. Todas as raizes para VLANs diferentes podem residir em um switch único ou em vários interruptores.
Observação: a seleção do switch raiz para uma VLAN específica é muito importante. Você pode escolher o switch raiz ou você pode deixar os switches decidirem, o que é arriscado. Se você não controla o processo de seleção de raiz, pode haver trajetos suboptimais em sua rede.
Todos os interruptores trocam a informação pelo uso na seleção do switch-raiz e pela configuração subseqüente da rede. O Bridge Protocol Data Units (BPDU) leva esta informação. Cada interruptor compara os parâmetros no BPDU que o interruptor envia a um vizinho com os parâmetros no BPDU que o interruptor recebe do vizinho.
No processo de seleção de raiz STP, menos é mais. Se o Switch A anuncia um ID raiz que seja um número inferior ao ID raiz que o switch B anuncia, a informação do Switch A é melhor. O switch B para a propaganda de seu ID raiz, e aceita o ID raiz do Switch A.
Consulte Recursos STP Opcionais para obter mais informações sobre alguns dos recursos STP opcionais, como:
PortFast
Protetor de raiz
Protetor de loop
Protetor de BPDU
Pré-requisitos
Antes que você configure o STP, selecione um interruptor para ser a raiz da medida - árvore. Este interruptor não precisa ser o interruptor mais poderoso, mas escolhe o interruptor mais centralizado na rede. Todo o fluxo de dados através da rede é da perspectiva deste interruptor. Também, escolha o interruptor menos perturbado na rede. Os switches de backbone servem frequentemente como a raiz de Medida de Árvore porque estes interruptores tipicamente não se conectam às estações final. Também, movimentos e mudanças dentro da rede são menos prováveis de afetar estes interruptores.
Depois que você decide no switch-raiz, ajuste as variáveis apropriadas para designar o interruptor como o switch-raiz. A única variável que você deve definir é a bridge priority . Se o interruptor tem uma prioridade de bridge que seja mais baixa do que todos os interruptores restantes, os outros interruptores selecionam automaticamente o interruptor como o switch-raiz.
Clientes (estações final) em portas de switch
Você também pode emitir o set spantree portfast comando, por porta. Quando você habilita a portfast variável em uma porta, a porta imediatamente alterna do modo de bloqueio para o modo de encaminhamento. A habilitação de portfast ajuda a evitar timeouts em clientes que usam o Novell Netware ou usam o DHCP para obter um endereço IP. No entanto, desative esse comando quando você tiver uma conexão switch a switch. Neste caso, o comando pode conduzir a um laço. O atraso de 30- a 60-segundos que ocorre durante a transição da obstrução ao modo de encaminhamento impedem uma condição de loop temporal na rede quando você conecta dois interruptores.
Deixe a maioria das outras variáveis STP em seus valores padrão.
Regras de operação
Esta seção lista regras para como o STP trabalha. Quando os interruptores vêm primeiramente acima, começam o processo de seleção do switch-raiz. Cada interruptor transmite um BPDU diretamente ao switch conectado sobre uma base por VLAN.
Enquanto o BPDU sai através da rede, cada interruptor compara o BPDU que o interruptor envia ao BPDU que o interruptor recebe dos vizinhos. Os interruptores concordam então com que interruptor é o switch-raiz. O interruptor com o mais baixo ID de ponte na rede ganha este processo de eleição.
Observação: lembre-se de que um switch raiz é identificado por VLAN. Após a identificação do switch-raiz, os interruptores aderem a estas regras.
-
Regra de STP 1 - Todas as portas do switch-raiz devem reagir do modo de encaminhamento.
Observação: em alguns casos de canto, que envolvem portas com autoloop, há uma exceção a essa regra.
Em seguida, cada interruptor determina o melhor caminho para chegar à raiz. Os interruptores determinam este trajeto por uma comparação da informação em todos os BPDU que os interruptores recebem em todas as portas. O switch usa a porta com a menor quantidade de informações na BPDU para chegar ao switch raiz; a porta com a menor quantidade de informações na BPDU é a porta raiz. Depois que um interruptor determina a porta raiz, o interruptor continua a ordenar 2.
-
Regra de STP 2 - A porta raiz deve ser ajustada ao modo de encaminhamento.
Além, os interruptores em cada segmento de LAN comunicam-se um com o outro para determinar qual interruptor é o melhor de se usar a fim mover dados desse segmento para a ponte-raiz. Esse Switch é chamado de Switch designado.
-
Regra de STP 3 - Em um único segmento de LAN, a porta do switch designado que conecta a esse segmento de LAN deve ser colocado no modo de encaminhamento.
-
Regra de STP 4 - Todas as portas restantes em todos os interruptores (VLAN-específicos) devem ser colocados no modo de bloqueio. A regra aplica-se somente às portas que conectam a outras pontes ou interruptores. O STP não afeta as portas que conectam às estações de trabalho ou aos PC. Estas portas permanecem encaminhadas.
Observação: a adição ou remoção de VLANs quando o STP é executado no modo spanning tree por VLAN (PVST / PVST+) dispara o recálculo de spanning tree para essa instância de VLAN e o tráfego é interrompido apenas para essa VLAN. As outras peças VLAN de um link de tronco podem encaminhar o tráfego normalmente. A adição ou a remoção de VLAN para um exemplo do Spanning Tree Múltipla (MST) existente dispara o recálculo para este exemplo e o tráfego é interrompido para todas as peças VLAN do examplo MST.
Observação: por padrão, o spanning tree é executado em todas as portas. Os recursos de Spanning Tree não podem ser desligados nos interruptores em uma base por porta. Embora não se recomende, você pode desligar o STP em uma base do por VLAN, ou globalmente no interruptor. Deve-se tomar extremo cuidado sempre que você desabilitar o spanning tree, pois isso cria loops de Camada 2 dentro da rede.
Step-by-Step Instructions
Conclua estes passos:
-
Execute o show version comando para exibir a versão do software que o switch executa.
Observação: todos os switches executam a mesma versão de software.
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)
Neste cenário, o interruptor 15 é a melhor escolha para o switch-raiz da rede para todos os VLAN porque o interruptor 15 é o switch de backbone.
-
Execute o set spantree root vlan_id comando para definir a prioridade do switch como 8192 para a VLAN ou VLANs que o vlan_id especifica.
Observação: a prioridade padrão para switches é 32768. Quando você ajusta a prioridade com este comando, você força a seleção do interruptor 15 como o switch-raiz porque o interruptor 15 tem a mais baixa prioridade.
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)
A versão mais curta do comando tem o mesmo efeito, pois este exemplo mostra:
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)
O set spantree priority comando fornece um terceiro método para especificar o switch raiz:
Switch-15> (enable)set spantree priority 8192 1
Spantree 1 bridge priority set to 8192.
Switch-15> (enable)
Observação: neste cenário, todos os switches foram iniciados com configurações limpas. Conseqüentemente, todos os interruptores ligados com uma prioridade de bridge de 32768. Se você não está certo que todos os interruptores em sua rede têm uma prioridade maior que 8192, ajuste a prioridade de seu bridge-raiz desejado para 1.
-
Execute o set spantree portfast mod_num/port_num enable comando para definir a configuração de PortFast nos Switches 12, 13, 14, 16 e 17.
Observação: defina essa configuração apenas em portas que se conectam a estações de trabalho ou PCs. Não permita PortFast em nenhuma porta que conectar a um outro interruptor.
-
A porta 2/1 conecta para comutar 13.
-
A porta 2/2 conecta para comutar 15.
-
A porta 2/3 conecta para comutar 16.
-
As portas 3/1 a 3/24 conectam aos PC.
-
As portas 4/1 a 4/24 conectam às estações de trabalho Unix.
Com essas informações como base, emita o set spantree portfastcomando nas portas 3/1 a 3/24 e nas portas 4/1 a 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)
-
Execute o show spantree vlan_idcomando para verificar se o Switch 15 é a raiz de todas as VLANs apropriadas.
Da saída deste comando, compare o MAC address do interruptor que é o switch-raiz ao MAC address do interruptor de que você emitiu o comando. Se os endereços combinam, o interruptor no qual você se encontra é o switch-raiz do VLAN. Uma porta de raiz que seja 1/0 igualmente indica que você está no switch-raiz. Este é o exemplo de saída de comando:
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
Esta saída mostra que o interruptor 15 é a raiz projetada no spanning tree para o VLAN1. O endereço MAC do switch raiz designado, 00-10-0d-b1-78-00, é o mesmo que o endereço MAC do ID de bridge do Switch 15,00-10-0d-b1-78-00. Um outro indicador que este interruptor é a raiz projetada é que a porta da raiz projetada é 1/0.
Nesta saída do Switch 12, o switch reconhece o Switch 15 como o Designated Rootpara a 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
Observação: a saída do comando show spantree vlan_id para os outros switches e VLANs também pode indicar que o Switch 15 é a raiz designada para todas as VLANs.
Verificar
Esta seção fornece informações que você pode usar para verificar se sua configuração está funcionando adequadamente.
-
show spantree vlan_id— Mostra o estado atual do spanning tree para esse ID de VLAN, da perspectiva do switch no qual você emite o comando.
-
show spantree summary— Fornece um resumo das portas de spanning tree conectadas por VLAN.
Troubleshooting
Esta seção fornece informações que podem ser usadas para o troubleshooting da sua configuração.
Os custos de caminho STP mudam automaticamente quando uma velocidade de porta/duplex é mudada
O STP calcula os custos de caminho baseados na velocidade de mídia (largura de banda) dos links entre os switches e os custos de porta de cada quadro de encaminhamento de porta. O spanning tree seleciona a raiz baseada nos custos de caminho. A porta com os mais baixos custos de caminho ao bridge-raiz torna-se a porta raiz. A porta raiz está sempre no estado de encaminhamento.
Se a velocidade/duplex da porta é alterada, o spanning tree recalcula os custos de caminho automaticamente. Uma mudança nos custos de caminho pode mudar a topologia do Spanning Tree.
Consulte a seção Calculate and Assign Port Costs de Configure Spanning Tree para obter mais informações sobre como calcular o custo da porta.
Comandos de solução de problemas
Nota:Consulte Informações Importantes sobre Comandos de Depuração antes de usar comandos debug.
-
show spantree vlan_id—Mostra o estado atual do spanning tree para esse ID de VLAN, da perspectiva do switch no qual você emite o comando.
-
show spantree summary—Fornece um resumo das portas de spanning tree conectadas por VLAN.
-
show spantree statistics—Mostra as informações estatísticas do spanning tree.
-
show spantree backbonefast—Exibe se o recurso BackboneFast Convergence de spanning tree está habilitado.
-
show spantree blockedports— Exibe apenas as portas bloqueadas.
-
show spantree portstate—Determina o estado atual do spanning tree de uma porta Token Ring dentro de uma spanning tree.
-
show spantree portvlancost—Mostra o custo do caminho para as VLANs em uma porta.
-
show spantree uplinkfast—mostra as configurações de uplinkfast.
Resumo de comandos
Sintaxe:
show version
Conforme utilizado neste documento:
show version
Sintaxe:
set spantree root [vlan_id]
Conforme utilizado neste documento:
set spantree root 1
set spantree root 1,200-204
Sintaxe:
set spantree priority [vlan_id]
Conforme utilizado neste documento:
set spantree priority 8192 1
Sintaxe:
set spantree portfast mod_num/port_num {enable | disable}
Conforme utilizado neste documento:
set spantree portfast 3/1-24 enable
Sintaxe:
show spantree [vlan_id]
Conforme utilizado neste documento:
show spantree
Informações Relacionadas
Revisão | Data de publicação | Comentários |
---|---|---|
3.0 |
08-May-2023 |
Recertificação |
2.0 |
07-Apr-2022 |
Removido um link quebrado. |
1.0 |
11-Dec-2019 |
Versão inicial |