Nexus-vPC和STP BPDU
1、为了交互vPC拓扑,STP机制被修改适应到vPC peer环境。
2、对于vPC ports,只有主角色运行STP,换句话说,vPC下的STP由主角色设备控制。
3、只有Primary设备在DP(指定端口)上生成并发送BPDU,不管STP的Root是否在这个设备上。
4、vPC备用角色设备代理任何收到的STP的BPDU消息给主角色设备,备用角色设备只收BPDU并转给主用设备,不主动发BPDU报文。
STP的使用:
1、正常情况下,VPC peer与接入设备之间逻辑上是点到点的,所以不存在STP环路,STP的作用是在VPC失效的时候防止环路;
2、在VPC初始化时进行环路保护;
3、非VPC的连接设备;
4、当添加和删除VPC时,进行环路管理;
5、STP需要保持激活状态,但并不会控制VPC成员端口的状态;
6、逻辑的接口也应该激活STP;
Spanning-Tree推荐:
1、配置聚合的vPC Peer为Primary STP Root和Secondary STP Root
2、使用vPC peer-switch技术,peer-switch主要把2端设备生成树的优先级做成一致,2台设备都会认为自己是根,都会发送bpdu。当主设备失效的时候,备设备会一直发送bpdu。不会有中断过程。
当active恢复的时候,备设备的角色因为没有变化,也不会有影响。
需要用相同的mac地址(用vpc的system mac地址替代本地mac)作为根的mac地址,可以通过show vpc role 看到,这样才能保证传输的bpdu是一样的。
3、调整让vPC Primary成为STP的Primary Root,HSRP的Active Router和PIM的DR
4、桥接确保(bridge Assurance)技术默认在vPC peer link上被激活,bridge Assurance的接口会双向接收和发送BPDU,保持keepalive
5、关闭vPC上激活Loop Guard
6、接入交换机连接主机的端口配置port type edge或者port type edge trunk(连接虚拟服务器的物理主机)来快速收敛;
7、全局或在面向主机的端口配置budu guard,全局和在面向主机的端口配置效果是一样的,因为bpdu guard只在具备typeedge特性的端口生效,而这样的端口正是面向主机的端口;
8、汇聚交换机在连接接入层设备的接口配置root guard;
9、确保二层域中的所有交换机都运行Rapid-PVST或者MST(默认IOS是non-rapid PVST+),这样就避免了慢速STP收敛;
10、保证STP的root在汇聚层;
11、所有VLAN都要运行STP协议,包括运行VPC的VLAN;
下面就一个案例来说明stp和vpc运作过程;
SW1-SP-01配置:
vlan 1,1256,1300-1331,1561-1562
spanning-tree mode mst
spanning-tree pathcost method long
spanning-tree mst 1 priority 4096
spanning-tree mst configuration
name MST1
revision 1
instance 1 vlan 1-4094
vrf context PKL
vpc domain 1
peer-switch
role priority 4096
peer-keepalive destination 55.0.0.2 source 55.0.0.1 vrf PKL
auto-recovery
ip arp synchronize
interface port-channel100
description TO_SW2-SP-02
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
spanning-tree port type network
vpc peer-link
interface Ethernet1/33
description TO_SW2-SP-02_E1/33
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
channel-group 100 mode active
no shutdown
interface Ethernet1/34
description TO_SW2-SP-02_E1/34
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
channel-group 100 mode active
no shutdown
interface port-channel201
description TO_SW-BL
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
spanning-tree port type normal
spanning-tree guard root
vpc 201
interface Ethernet1/31
description TO_SW1-BL-01_E1/49
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
channel-group 201 mode active
no shutdown
interface Ethernet1/32
description TO_SW2-BL-02_E1/49
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
channel-group 201 mode active
no shutdown
SW1-SP-01# show vpc role
vPC Role status
----------------------------------------------------
vPC role : primary, operational secondary
Dual Active Detection Status : 0
vPC system-mac : 00:23:04:ee:be:01
vPC system-priority : 32667
vPC local system-mac : 70:0f:6a:15:14:67
vPC local role-priority : 4096
vPC local config role-priority : 4096
vPC peer system-mac : 70:0f:6a:15:13:2f
vPC peer role-priority : 8192
vPC peer config role-priority : 8192
DD-2FN1A08-VIDEO-SP-01#
SW1-SP-01# show spanning-tree brief
MST0000
Spanning tree enabled protocol mstp
Root ID Priority 32768
Address 0023.04ee.be01
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32768 (priority 32768 sys-id-ext 0)
Address 0023.04ee.be01
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Po100 Desg FWD 250 128.4195 (vPC peer-link) Network P2p
Po101 Desg FWD 200 128.4196 (vPC) P2p
Po102 Desg FWD 200 128.4197 (vPC) P2p
Po103 Desg FWD 200 128.4198 (vPC) P2p
Po104 Desg FWD 200 128.4199 (vPC) P2p
Po201 Desg FWD 200 128.4296 (vPC) P2p
MST0001
Spanning tree enabled protocol mstp
Root ID Priority 4097
Address 0023.04ee.be01
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 4097 (priority 4096 sys-id-ext 1)
Address 0023.04ee.be01
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Po100 Desg FWD 250 128.4195 (vPC peer-link) Network P2p
Po101 Desg FWD 200 128.4196 (vPC) P2p
Po102 Desg FWD 200 128.4197 (vPC) P2p
Po103 Desg FWD 200 128.4198 (vPC) P2p
Po104 Desg FWD 200 128.4199 (vPC) P2p
Po201 Desg FWD 200 128.4296 (vPC) P2p
SW2-SP-02配置如下:
vlan 1,1256,1300-1331,1561-1562
spanning-tree pathcost method long
spanning-tree mst 1 priority 4096
spanning-tree mst configuration
name MST1
revision 1
instance 1 vlan 1-4094
vrf context PKL
vpc domain 1
peer-switch
role priority 8192
peer-keepalive destination 55.0.0.1 source 55.0.0.2 vrf PKL
auto-recovery
ip arp synchronize
interface port-channel100
description TO_SW1-SP-01
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
spanning-tree port type network
vpc peer-link
interface Ethernet1/33
description TO_SW1-SP-01_E1/33
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
channel-group 100 mode active
no shutdown
interface Ethernet1/34
description TO_SW1-SP-01_E1/34
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
channel-group 100 mode active
no shutdown
interface port-channel201
description TO_SW-BL
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
spanning-tree port type normal
spanning-tree guard root
vpc 201
interface Ethernet1/31
description TO_SW1-BL-01_E1/51
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
channel-group 201 mode active
no shutdown
interface Ethernet1/32
description TO_SW2-BL-02_E1/51
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
channel-group 201 mode active
no shutdown
SW2-SP-02# show spanning-tree brief
MST0000
Spanning tree enabled protocol mstp
Root ID Priority 32768
Address 0023.04ee.be01
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32768 (priority 32768 sys-id-ext 0)
Address 0023.04ee.be01
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Po100 Root FWD 250 128.4195 (vPC peer-link) Network P2p
Po101 Desg FWD 200 128.4196 (vPC) P2p
Po102 Desg FWD 200 128.4197 (vPC) P2p
Po103 Desg FWD 200 128.4198 (vPC) P2p
Po104 Desg FWD 200 128.4199 (vPC) P2p
Po201 Desg FWD 200 128.4296 (vPC) P2p
MST0001
Spanning tree enabled protocol mstp
Root ID Priority 4097
Address 0023.04ee.be01
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 4097 (priority 4096 sys-id-ext 1)
Address 0023.04ee.be01
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Po100 Root FWD 250 128.4195 (vPC peer-link) Network P2p
Po101 Desg FWD 200 128.4196 (vPC) P2p
Po102 Desg FWD 200 128.4197 (vPC) P2p
Po103 Desg FWD 200 128.4198 (vPC) P2p
Po104 Desg FWD 200 128.4199 (vPC) P2p
Po201 Desg FWD 200 128.4296 (vPC) P2p
SW1-TOR-01配置如下:
vlan 1,1256,1300-1331,1561-1562
spanning-tree mode mst
spanning-tree pathcost method long
spanning-tree mst configuration
name MST1
revision 1
instance 1 vlan 1-4094
vrf context PKL
vpc domain 101
peer-switch
role priority 4096
peer-keepalive destination 55.0.0.2 source 55.0.0.1 vrf PKL
auto-recovery
ip arp synchronize
interface port-channel100
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
spanning-tree port type network
vpc peer-link
interface port-channel101
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
spanning-tree port type normal
vpc 101
interface Ethernet1/49
description TO_SW1-SP-01_E1/1
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
channel-group 101 mode active
no shutdown
interface Ethernet1/51
description TO_SW2-SP-02_E1/1
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
channel-group 101 mode active
no shutdown
interface Ethernet1/53
description TO_SW2-TOR-02_E1/53
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
channel-group 100 mode active
no shutdown
interface Ethernet1/54
description TO_SW2-TOR-02_E1/54
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
channel-group 100 mode active
no shutdown
SW1-TOR-01# show spanning-tree root
Root Hello Max Fwd
MST Instance Root ID Cost Time Age Dly Root Port
---------------- -------------------- ------ ----- --- --- ----------------
MST0000 32768 0023.04ee.be01 0 2 20 15 port-channel101
MST0001 4097 0023.04ee.be01 200 2 20 15 port-channel101
SW1-TOR-01# show spanning-tree active
MST0000
Spanning tree enabled protocol mstp
Root ID Priority 32768
Address 0023.04ee.be01
Cost 0
Port 4196 (port-channel101)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32768 (priority 32768 sys-id-ext 0)
Address 0023.04ee.be65
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Po100 Desg FWD 250 128.4195 (vPC peer-link) Network P2p
Po101 Root FWD 200 128.4196 (vPC) P2p
MST0001
Spanning tree enabled protocol mstp
Root ID Priority 4097
Address 0023.04ee.be01
Cost 200
Port 4196 (port-channel101)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0023.04ee.be65
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Po100 Desg FWD 250 128.4195 (vPC peer-link) Network P2p
Po101 Root FWD 200 128.4196 (vPC) P2p
SW2-TOR-02配置如下:
vlan 1,1256,1300-1331,1561-1562
spanning-tree mode mst
spanning-tree pathcost method long
spanning-tree mst configuration
name MST1
revision 1
instance 1 vlan 1-4094
vrf context PKL
vpc domain 101
peer-switch
role priority 8192
peer-keepalive destination 55.0.0.1 source 55.0.0.2 vrf PKL
auto-recovery
ip arp synchronize
interface port-channel100
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
spanning-tree port type network
vpc peer-link
interface port-channel101
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
spanning-tree port type normal
vpc 101
interface Ethernet1/49
description TO_SW1-SP-01_E1/2
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
channel-group 101 mode active
no shutdown
interface Ethernet1/51
description TO_SW2-SP-02_E1/2
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
channel-group 101 mode active
no shutdown
interface Ethernet1/53
description TO_SW1-TOR-01_E1/53
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
channel-group 100 mode active
no shutdown
interface Ethernet1/54
description TO_SW1-TOR-01_E1/54
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331,1561-1562
channel-group 100 mode active
no shutdown
SW2-TOR-02# show spanning-tree active
MST0000
Spanning tree enabled protocol mstp
Root ID Priority 32768
Address 0023.04ee.be01
Cost 0
Port 4195 (port-channel100)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32768 (priority 32768 sys-id-ext 0)
Address 0023.04ee.be65
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Po100 Root FWD 250 128.4195 (vPC peer-link) Network P2p
Po101 Root FWD 200 128.4196 (vPC) P2p
MST0001
Spanning tree enabled protocol mstp
Root ID Priority 4097
Address 0023.04ee.be01
Cost 450
Port 4195 (port-channel100)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0023.04ee.be65
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Po100 Root FWD 250 128.4195 (vPC peer-link) Network P2p
Po101 Root FWD 200 128.4196 (vPC) P2p
SW2-TOR-02#
SW1-BL-01配置如下:
spanning-tree mode mst
vlan 1,910-911,1256,1300-1331
spanning-tree mst 1 priority 8192
spanning-tree mst configuration
name MST1
revision 1
instance 1 vlan 1-4094
vrf context PKL
vpc domain 201
peer-switch
role priority 4096
peer-keepalive destination 55.0.0.2 source 55.0.0.1 vrf PKL
peer-gateway
auto-recovery
ip arp synchronize
interface port-channel201
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331
spanning-tree port type normal
vpc 201
interface Ethernet1/49
description TO_SW1-SP-01_E1/31
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331
channel-group 201 mode active
no shutdown
interface Ethernet1/51
description TO_SW2-SP-02_E1/31
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331
channel-group 201 mode active
no shutdown
SW1-BL-01# show spanning-tree
MST0000
Spanning tree enabled protocol mstp
Root ID Priority 32768
Address 0023.04ee.be01
Cost 0
Port 4296 (port-channel201)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32768 (priority 32768 sys-id-ext 0)
Address 0023.04ee.bec9
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Po11 Desg FWD 200 128.4106 (vPC) P2p
Po12 Desg FWD 200 128.4107 (vPC) P2p
Po21 Desg FWD 200 128.4116 (vPC) P2p
Po22 Desg FWD 200 128.4117 (vPC) P2p
Po100 Desg FWD 250 128.4195 (vPC peer-link) Network P2p
Po201 Root FWD 200 128.4296 (vPC) P2p
MST0001
Spanning tree enabled protocol mstp
Root ID Priority 4097
Address 0023.04ee.be01
Cost 200
Port 4296 (port-channel201)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 8193 (priority 8192 sys-id-ext 1)
Address 0023.04ee.bec9
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Po11 Desg FWD 200 128.4106 (vPC) P2p
Po12 Desg FWD 200 128.4107 (vPC) P2p
Po21 Desg FWD 200 128.4116 (vPC) P2p
Po22 Desg FWD 200 128.4117 (vPC) P2p
Po100 Desg FWD 250 128.4195 (vPC peer-link) Network P2p
Po201 Root FWD 200 128.4296 (vPC) P2p
SW2-BL-02配置如下:
spanning-tree mode mst
vlan 1,910-911,1256,1300-1331
spanning-tree mst 1 priority 8192
spanning-tree mst configuration
name MST1
revision 1
instance 1 vlan 1-4094
vrf context PKL
vpc domain 201
peer-switch
role priority 8192
peer-keepalive destination 55.0.0.1 source 55.0.0.2 vrf PKL
peer-gateway
auto-recovery
ip arp synchronize
interface Ethernet1/49
description TO_SW1-SP-01_E1/32
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331
channel-group 201 mode active
no shutdown
interface Ethernet1/51
description TO_SW2-SP-02_E1/32
switchport
switchport mode trunk
switchport trunk allowed vlan 1,1256,1300-1331
channel-group 201 mode active
no shutdown
SW2-BL-02# show spanning-tree
MST0000
Spanning tree enabled protocol mstp
Root ID Priority 32768
Address 0023.04ee.be01
Cost 0
Port 4195 (port-channel100)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32768 (priority 32768 sys-id-ext 0)
Address 0023.04ee.bec9
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Po11 Desg FWD 200 128.4106 (vPC) P2p
Po12 Desg FWD 200 128.4107 (vPC) P2p
Po21 Desg FWD 200 128.4116 (vPC) P2p
Po22 Desg FWD 200 128.4117 (vPC) P2p
Po100 Root FWD 250 128.4195 (vPC peer-link) Network P2p
Po201 Root FWD 200 128.4296 (vPC) P2p
MST0001
Spanning tree enabled protocol mstp
Root ID Priority 4097
Address 0023.04ee.be01
Cost 450
Port 4195 (port-channel100)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 8193 (priority 8192 sys-id-ext 1)
Address 0023.04ee.bec9
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Po11 Desg FWD 200 128.4106 (vPC) P2p
Po12 Desg FWD 200 128.4107 (vPC) P2p
Po21 Desg FWD 200 128.4116 (vPC) P2p
Po22 Desg FWD 200 128.4117 (vPC) P2p
Po100 Root FWD 250 128.4195 (vPC peer-link) Network P2p
Po201 Root FWD 200 128.4296 (vPC) P2p