声明:本实验用真机完成,终端采用了路由器和PC。
华为交换测试版本:
[SW2] dis version
Huawei Versatile Routing Platform Software
VRP (R) software, Version 5.160 (S5700 V200R009C00SPC500)
Copyright (C) 2000-2016 HUAWEI TECH CO., LTD
Quidway S5700-52P-LI-AC Routing Switch uptime is 0 week, 0 day, 0 hour, 1 minute

LS52T52S 0(Master) : uptime is 0 week, 0 day, 0 hour, 0 minute
256M bytes DDR Memory
64M bytes FLASH
Pcb Version : VER.B
Basic BootROM Version : 0001.0015 Compiled at 禗姚拠Q9:-`+A閯
€(
CPLD Version : 0109
Software Version : VRP (R) Software, Version 5.160 (V200R009C00SPC500)
[SW2] dis version
Huawei Versatile Routing Platform Software
VRP (R) software, Version 5.160 (S5700 V200R009C00SPC500)
Copyright (C) 2000-2016 HUAWEI TECH CO., LTD
Quidway S5700-52P-LI-AC Routing Switch uptime is 0 week, 0 day, 0 hour, 1 minute

LS52T52S 0(Master) : uptime is 0 week, 0 day, 0 hour, 0 minute
256M bytes DDR Memory
64M bytes FLASH
Pcb Version : VER.B
Basic BootROM Version : 0001.0015 Compiled at 禗姚拠Q9:-`+A閯
€(
CPLD Version : 0109
Software Version : VRP (R) Software, Version 5.160 (V200R009C00SPC500)

1.实验拓扑

R1(config)#do sh lldp nei
Capability codes:
(R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device
(W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other

Device ID Local Intf Hold-time Capability Port ID
SW2 Gi0/1 120 B GigabitEthernet0/0/2
即:
R1(g0/1)-----SW2(G0/0/2)
R1后面实验换成一台PC。

2.STP模式下交换机接口UP/DOWN是否产生TC或者TCN

[SW2]stp mode stp //STP模式
[SW2-GigabitEthernet0/0/2]stp edged-port enable //开启STP模式下的边缘端口
[SW2]dis stp interface g0/0/2 //在两端接口开启的情况下验证该接口的STP状态
-------[CIST Global Info][Mode STP]-------
CIST Bridge :32768.f84a-bfeb-4a0f
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.f84a-bfeb-4a0f / 0 (This bridge is the root)
CIST RegRoot/IRPC :32768.f84a-bfeb-4a0f / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :0
TC count per hello :0

STP Converge Mode :Normal
Share region-configuration :Enabled
Time since last TC :0 days 0h:0m:59s
Number of TC :1
Last TC occurred :GigabitEthernet0/0/2
----[Port2(GigabitEthernet0/0/2)][FORWARDING]----
Port Protocol :Enabled
Port Role :Designated Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=20000
Designated Bridge/Port :32768.f84a-bfeb-4a0f / 128.2
Port Edged :Config=enabled / Active=enabled
Point-to-point :Config=auto / Active=true
Transit Limit :6 packets/s
Protection Type :None
Port STP Mode :STP
Port Protocol Type :Config=auto / Active=dot1s
BPDU Encapsulation :Config=stp / Active=stp
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20
TC or TCN send :17
TC or TCN received :0

BPDU Sent :48
TCN: 0, Config: 48, RST: 0, MST: 0
BPDU Received :0
TCN: 0, Config: 0, RST: 0, MST: 0
Last forwarding time: 2018/03/24 16:57:09 UTC-05:13

在路由器上:
R1(config)#int g0/1
R1(config-if)#shu
R1(config-if)#shutdown //关闭路由器上连接交换机的接口,来模拟终端关机
验证STP接口的状态
[SW2]dis stp interface g0/0/2
-------[CIST Global Info][Mode STP]-------
CIST Bridge :32768.f84a-bfeb-4a0f
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.f84a-bfeb-4a0f / 0 (This bridge is the root)
CIST RegRoot/IRPC :32768.f84a-bfeb-4a0f / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :0
TC count per hello :0
STP Converge Mode :Normal
Share region-configuration :Enabled
Time since last TC :0 days 0h:4m:24s
Number of TC :1
Last TC occurred :GigabitEthernet0/0/2
----[Port2(GigabitEthernet0/0/2)][DOWN]----
Port Protocol :Enabled
Port Role :Disabled Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=200000000
Designated Bridge/Port :32768.f84a-bfeb-4a0f / 128.2
Port Edged :Config=enabled / Active=enabled
Point-to-point :Config=auto / Active=false
Transit Limit :6 packets/s
Protection Type :None
Port STP Mode :STP
Port Protocol Type :Config=auto / Active=dot1s
BPDU Encapsulation :Config=stp / Active=stp
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20
TC or TCN send :0 //由于接口关闭,没有发送TC或者TCN
TC or TCN received :0 //由于接口关闭,自然也收不到TC或者TCN
BPDU Sent :0
TCN: 0, Config: 0, RST: 0, MST: 0
BPDU Received :0
TCN: 0, Config: 0, RST: 0, MST: 0
再次开启路由器的接口

R1(config-if)#int g0/1
R1(config-if)#no shu
[SW2]dis stp interface g0/0/2
-------[CIST Global Info][Mode STP]-------
CIST Bridge :32768.f84a-bfeb-4a0f
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.f84a-bfeb-4a0f / 0 (This bridge is the root)
CIST RegRoot/IRPC :32768.f84a-bfeb-4a0f / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :0
TC count per hello :0
STP Converge Mode :Normal
Share region-configuration :Enabled
Time since last TC :0 days 0h:16m:52s
Number of TC :1
Last TC occurred :GigabitEthernet0/0/2
----[Port2(GigabitEthernet0/0/2)][FORWARDING]----
Port Protocol :Enabled
Port Role :Designated Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=20000
Designated Bridge/Port :32768.f84a-bfeb-4a0f / 128.2
Port Edged :Config=enabled / Active=enabled
Point-to-point :Config=auto / Active=true
Transit Limit :6 packets/s
Protection Type :None
Port STP Mode :STP
Port Protocol Type :Config=auto / Active=dot1s
BPDU Encapsulation :Config=stp / Active=stp
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20
TC or TCN send :0
TC or TCN received :0
//在STP模式下开启连接交换机的接口或者关闭接口没有产生TC或者TCN
BPDU Sent :204
TCN: 0, Config: 204, RST: 0, MST: 0
BPDU Received :0
TCN: 0, Config: 0, RST: 0, MST: 0
Last forwarding time: 2018/03/24 17:07:15 UTC-05:13
拔掉路由器连接SW的接口,连接到PC上,此时的STP:
[SW2]dis stp interface g0/0/2
-------[CIST Global Info][Mode STP]-------
CIST Bridge :32768.f84a-bfeb-4a0f
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.f84a-bfeb-4a0f / 0 (This bridge is the root)
CIST RegRoot/IRPC :32768.f84a-bfeb-4a0f / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :0
TC count per hello :0
STP Converge Mode :Normal
Share region-configuration :Enabled
Time since last TC :0 days 0h:19m:55s
Number of TC :1
Last TC occurred :GigabitEthernet0/0/2
----[Port2(GigabitEthernet0/0/2)][DOWN]----
Port Protocol :Enabled
Port Role :Disabled Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=200000000
Designated Bridge/Port :32768.f84a-bfeb-4a0f / 128.2
Port Edged :Config=enabled / Active=enabled
Point-to-point :Config=auto / Active=false
Transit Limit :6 packets/s
Protection Type :None
Port STP Mode :STP
Port Protocol Type :Config=auto / Active=dot1s
BPDU Encapsulation :Config=stp / Active=stp
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20
TC or TCN send :0
TC or TCN received :0
//拔掉路由器上连接SW的接口依旧没有TC或者TCN
BPDU Sent :0
TCN: 0, Config: 0, RST: 0, MST: 0
BPDU Received :0
TCN: 0, Config: 0, RST: 0, MST: 0
把交换机接口连接到一台开启的PC上:
[SW2]dis stp interface g0/0/2
-------[CIST Global Info][Mode STP]-------
CIST Bridge :32768.f84a-bfeb-4a0f
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.f84a-bfeb-4a0f / 0 (This bridge is the root)
CIST RegRoot/IRPC :32768.f84a-bfeb-4a0f / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :0
TC count per hello :0
STP Converge Mode :Normal
Share region-configuration :Enabled
Time since last TC :0 days 0h:23m:42s
Number of TC :1
Last TC occurred :GigabitEthernet0/0/2
----[Port2(GigabitEthernet0/0/2)][FORWARDING]----
Port Protocol :Enabled
Port Role :Designated Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=20000
Designated Bridge/Port :32768.f84a-bfeb-4a0f / 128.2
Port Edged :Config=enabled / Active=enabled
Point-to-point :Config=auto / Active=true
Transit Limit :6 packets/s
Protection Type :None
Port STP Mode :STP
Port Protocol Type :Config=auto / Active=dot1s
BPDU Encapsulation :Config=stp / Active=stp
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20
TC or TCN send :0
TC or TCN received :0

BPDU Sent :36
TCN: 0, Config: 36, RST: 0, MST: 0
BPDU Received :0
TCN: 0, Config: 0, RST: 0, MST: 0
Last forwarding time: 2018/03/24 17:19:43 UTC-05:13
拔掉PC的接口:
[SW2]dis stp interface g0/0/2
Mar 24 2018 17:22:24-05:13 SW2 %%01IFPDT/4/IF_STATE(l)[39]:Interface GigabitEthernet0/0/2 has turned into UP state.
Mar 24 2018 17:22:24-05:13 SW2 %%01IFNET/4/IF_STATE(l)[40]:Interface Vlanif1 has turned into UP state.
-------[CIST Global Info][Mode STP]-------
CIST Bridge :32768.f84a-bfeb-4a0f
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Mar 24 2018 17:22:24-05:13 SW2 %%01IFNET/4/LINK_STATE(l)[41]:The line protocol IP on the interface Vlanif1 has entered the UP state.
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.f84a-bfeb-4a0f / 0 (This bridge is the root)
CIST RegRoot/IRPC :32768.f84a-bfeb-4a0f / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :0
TC count per hello :0
STP Converge Mode :Normal
Share region-configuration :Enabled
Time since last TC :0 days 0h:25m:15s
Number of TC :1
Last TC occurred :GigabitEthernet0/0/2
----[Port2(GigabitEthernet0/0/2)][FORWARDING]----
Port Protocol :Enabled
Port Role :Designated Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=20000
Designated Bridge/Port :32768.f84a-bfeb-4a0f / 128.2
Port Edged :Config=enabled / Active=enabled
Point-to-point :Config=auto / Active=true
Transit Limit :6 packets/s
Protection Type :None
Port STP Mode :STP
Port Protocol Type :Config=auto / Active=dot1s
BPDU Encapsulation :Config=stp / Active=stp
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20
TC or TCN send :0
TC or TCN received :0 //依旧没有TC或者TCN
BPDU Sent :2
TCN: 0, Config: 2, RST: 0, MST: 0
BPDU Received :0
TCN: 0, Config: 0, RST: 0, MST: 0
Last forwarding time: 2018/03/24 17:22:24 UTC-05:13

3.RSTP模式下华为交换机接口UP/DOWN是否产生TC或者TCN

[SW2]stp mode rstp
Info: This operation may take a few seconds. Please wait for a moment...done.

    [SW2]dis stp interface g0/0/2

-------[CIST Global Info][Mode RSTP]-------
CIST Bridge :32768.f84a-bfeb-4a0f
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.f84a-bfeb-4a0f / 0 (This bridge is the root)
CIST RegRoot/IRPC :32768.f84a-bfeb-4a0f / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :0
TC count per hello :0
STP Converge Mode :Normal
Share region-configuration :Enabled
Time since last TC :0 days 0h:32m:57s
Number of TC :1
Last TC occurred :GigabitEthernet0/0/2
----[Port2(GigabitEthernet0/0/2)][FORWARDING]----
Port Protocol :Enabled
Port Role :Designated Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=20000
Designated Bridge/Port :32768.f84a-bfeb-4a0f / 128.2
Port Edged :Config=enabled / Active=enabled
Point-to-point :Config=auto / Active=true
Transit Limit :6 packets/s
Protection Type :None
Port STP Mode :RSTP
Port Protocol Type :Config=auto / Active=dot1s
BPDU Encapsulation :Config=stp / Active=stp
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20
TC or TCN send :0
TC or TCN received :0
BPDU Sent :235
TCN: 0, Config: 46, RST: 189, MST: 0
BPDU Received :0
TCN: 0, Config: 0, RST: 0, MST: 0
Last forwarding time: 2018/03/24 17:22:24 UTC-05:13
拔掉接口:
[SW2]dis stp interface g0/0/2
-------[CIST Global Info][Mode RSTP]-------
CIST Bridge :32768.f84a-bfeb-4a0f
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.f84a-bfeb-4a0f / 0 (This bridge is the root)
CIST RegRoot/IRPC :32768.f84a-bfeb-4a0f / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :0
TC count per hello :0
STP Converge Mode :Normal
Share region-configuration :Enabled
Time since last TC :0 days 0h:33m:41s
Number of TC :1
Last TC occurred :GigabitEthernet0/0/2
----[Port2(GigabitEthernet0/0/2)][DOWN]----
Port Protocol :Enabled
Port Role :Disabled Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=200000000
Designated Bridge/Port :32768.f84a-bfeb-4a0f / 128.2
Port Edged :Config=enabled / Active=enabled
Point-to-point :Config=auto / Active=false
Transit Limit :6 packets/s
Protection Type :None
Port STP Mode :RSTP
Port Protocol Type :Config=auto / Active=dot1s
BPDU Encapsulation :Config=stp / Active=stp
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20
TC or TCN send :0
TC or TCN received :0
BPDU Sent :0
TCN: 0, Config: 0, RST: 0, MST: 0
BPDU Received :0
TCN: 0, Config: 0, RST: 0, MST: 0
插上PC连接交换机的接口:
[SW2]dis stp interface g0/0/2
-------[CIST Global Info][Mode RSTP]-------
CIST Bridge :32768.f84a-bfeb-4a0f
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.f84a-bfeb-4a0f / 0 (This bridge is the root)
CIST RegRoot/IRPC :32768.f84a-bfeb-4a0f / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :0
TC count per hello :0
STP Converge Mode :Normal
Share region-configuration :Enabled
Time since last TC :0 days 0h:34m:23s
Number of TC :1
Last TC occurred :GigabitEthernet0/0/2
----[Port2(GigabitEthernet0/0/2)][FORWARDING]----
Port Protocol :Enabled
Port Role :Designated Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=20000
Designated Bridge/Port :32768.f84a-bfeb-4a0f / 128.2
Port Edged :Config=enabled / Active=enabled
Point-to-point :Config=auto / Active=true
Transit Limit :6 packets/s
Protection Type :None
Port STP Mode :RSTP
Port Protocol Type :Config=auto / Active=dot1s
BPDU Encapsulation :Config=stp / Active=stp
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20
TC or TCN send :0
TC or TCN received :0
BPDU Sent :3
TCN: 0, Config: 0, RST: 3, MST: 0
BPDU Received :0
TCN: 0, Config: 0, RST: 0, MST: 0
Last forwarding time: 2018/03/24 17:31:30 UTC-05:13
以上实验表明华为交换机上无论是STP还是RSTP模式在接口UP/DOWN时都没有产生TC或者TCN BPDU