一 为什么要用到STP协议
在开启STP协议后 计算机之间互通
关闭生成树协议后 不能实现互通 为啥 逻辑环路
开通了STP 全部互通
PC>ping 192.168.1.3
Ping 192.168.1.3: 32 data bytes, Press Ctrl_C to break
From 192.168.1.3: bytes=32 seq=1 ttl=128 time=47 ms
From 192.168.1.3: bytes=32 seq=2 ttl=128 time=63 ms
From 192.168.1.3: bytes=32 seq=3 ttl=128 time=47 ms
From 192.168.1.3: bytes=32 seq=4 ttl=128 time=47 ms
From 192.168.1.3: bytes=32 seq=5 ttl=128 time=47 ms
--- 192.168.1.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 47/50/63 ms
PC>ping 192.168.1.2
Ping 192.168.1.2: 32 data bytes, Press Ctrl_C to break
From 192.168.1.2: bytes=32 seq=1 ttl=128 time=47 ms
From 192.168.1.2: bytes=32 seq=2 ttl=128 time=47 ms
From 192.168.1.2: bytes=32 seq=3 ttl=128 time=78 ms
From 192.168.1.2: bytes=32 seq=4 ttl=128 time=62 ms
From 192.168.1.2: bytes=32 seq=5 ttl=128 time=47 ms
--- 192.168.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 47/56/78 ms
PC>ping 192.168.1.1
Ping 192.168.1.1: 32 data bytes, Press Ctrl_C to break
From 192.168.1.1: bytes=32 seq=1 ttl=128 time<1 ms
From 192.168.1.1: bytes=32 seq=2 ttl=128 time<1 ms
From 192.168.1.1: bytes=32 seq=3 ttl=128 time<1 ms
From 192.168.1.1: bytes=32 seq=4 ttl=128 time<1 ms
From 192.168.1.1: bytes=32 seq=5 ttl=128 time<1 ms
--- 192.168.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 0/0/0 ms
华为 STP
1 STP 端口角色
- MSTID: 多生成树实例标识符(Multi-Spanning Tree Instance Identifier),用于区分不同的生成树实例。
- Port: 端口名称,这里是交换机上的物理端口。
- Role: 端口在生成树中的角色,可以是设计者(DESI)、根(ROOT)、备用(ALTERNATE)等。
- STP State: 生成树协议(Spanning Tree Protocol, STP)的状态,常见的状态有
- 阻塞(BLOCKING)、监听(LISTENING)、学习(LEARNING)、转发(FORWARDING)。
- Protection: 端口的保护机制,例如无(NONE)、环路保护(LOOP GUARD)等。
2 STP状态
<SW1>display stp brief
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/2 DESI(指定端口) FORWARDING NONE
0 GigabitEthernet0/0/3 ROOT (根端口) FORWARDING NONE
<SW1>
3 根网桥
树形的网络结构必须有树根,于是STP引入了根桥的概念。根桥在全网中有且只有一个,其他设备则称为叶子节点。根桥会根据网络拓扑的变化而改变,因此根桥并不是固定的。
在网络初始化过程中,所有设备都视自己为根桥,生成各自的配置BPDU并周期性地向外发送;但当网络拓扑稳定以后,只有根桥设备才会向外发送配置BPDU,其他设备则对其进行转发
- CIST Global Info: 这是Common and Internal Spanning Tree(公共和内部生成树)的全局信息。
- Mode STP: 表示当前使用的STP模式是标准STP,而不是RSTP(快速生成树协议)或MSTP(多生成树协议)。
- CIST Bridge: 显示了CIST(Common and Internal Spanning Tree)的桥接标识符,这是一个唯一的标识符,用于在网络中识别桥接设备。
- Config Times 和 Active Times: 分别显示了配置时间和激活时间的参数,包括Hello时间(2秒)、最大年龄(20秒)、转发延迟(15秒)和最大跳数(20)。
- CIST Root/ERPC 和 CIST RegRoot/IRPC: 显示了CIST的根桥接和区域根桥接的标识符以及它们的路径成本。
- CIST RootPortId: 根端口的标识符,这里显示为0.0,通常这是保留给根端口的。
- BPDU-Protection: 显示了BPDU(Bridge Protocol Data Unit,桥接协议数据单元)保护的状态,这里显示为禁用。
- TC or TCN received: 显示了接收到的拓扑变化通知(TC)或拓扑变化通知确认(TCN)的数量,这里是20。
- TC count per hello: 每个Hello包中的拓扑变化计数,这里为0。
- STP Converge Mode: 显示了STP的收敛模式,这里是正常模式。
- Time since last TC: 自上次接收到TC以来的时间,这里是12分钟1秒。
- Number of TC: 接收到的TC总数,这里是9。
- Last TC occurred: 显示了最后一次TC发生的时间和端口,这里是在GigabitEthernet0/0/1端口。
<SW3>display stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge :32768.4c1f-cc21-1576
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.4c1f-cc21-1576 / 0
CIST RegRoot/IRPC :32768.4c1f-cc21-1576 / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :20
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:12m:1s
Number of TC :9
Last TC occurred :GigabitEthernet0/0/1<SW1>display stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge :32768.4c1f-cc25-761b
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.4c1f-cc21-1576 / 20000
CIST RegRoot/IRPC :32768.4c1f-cc25-761b / 0
CIST RootPortId :128.3
BPDU-Protection :Disabled
TC or TCN received :34
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:21m:8s
Number of TC :9
Last TC occurred :GigabitEthernet0/0/3<SW2>display stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge :32768.4c1f-ccd5-1167
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.4c1f-cc21-1576 / 20000
CIST RegRoot/IRPC :32768.4c1f-ccd5-1167 / 0
CIST RootPortId :128.3
BPDU-Protection :Disabled
TC or TCN received :58
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:22m:12s
Number of TC :7
Last TC occurred :GigabitEthernet0/0/3
华三 STP
维护手册
操作 | 命令 |
显示生成树的状态和统计信息 | (独立运行模式) display stp [ instance instance-list | vlan vlan-id-list ] [ interface interface-list | slot slot-number ] [ brief ] (IRF模式) display stp [ instance instance-list | vlan vlan-id-list ] [ interface interface-list | chassis chassis-number slot slot-number ] [ brief ] |
显示生成树端口角色计算的历史信息 | (独立运行模式) display stp [ instance instance-list | vlan vlan-id-list ] history [ slot slot-number ] (IRF模式) display stp [ instance instance-list | vlan vlan-id-list ] history [ chassis chassis-number slot slot-number ] |
显示生成树所有端口收发的TC或TCN报文数 | (独立运行模式) display stp [ instance instance-list | vlan vlan-id-list ] tc [ slot slot-number ] (IRF模式) display stp [ instance instance-list | vlan vlan-id-list ] tc [ chassis chassis-number slot slot-number ] |
显示被生成树保护功能阻塞的端口历史信息 | display stp abnormal-port |
显示端口上的BPDU统计信息 | display stp bpdu-statistics [ interface interface-type interface-number [ instance instance-list ] ] |
显示被生成树保护功能down掉的端口信息 | display stp down-port |
显示已开启VLAN Ignore功能的VLAN列表 | display stp ignored-vlan |
显示被环路检测锁定的VLAN列表 | (暂不支持)display stp protected-vlan |
显示生效的MST域配置信息 | display stp region-configuration |
显示所有生成树的根桥信息 | display stp root |
清除生成树的统计信息 | reset stp [ interface interface-list ] |