配置思路
采用以下思路配置:
1.在處於環形網絡中的交換設備上配置MSTP基本功能,包括:
a.配置MST域並創建多實例,配置VLAN2映射到MSTI1,VLAN3映射到MSTI2,實現流量的負載分擔。
b.在MST域內,配置各實例的根橋與備份根橋。
c.配置各實例中某端口的路徑開銷值,實現將該端口阻塞。
d.使能MSTP,實現破除環路,包括:
•設備全局使能MSTP。
•除與終端設備相連的端口外,其他端口使能MSTP。
說明:
與終端相連的端口不用參與MSTP計算,建議將其設置為邊緣端口。
2.配置保護功能,實現對設備或鏈路的保護。例如:在各實例的根橋設備指定端口配置根保護功能。
3.配置設備的二層轉發功能。
4.配置各設備端口IP地址及路由協議,使各設備間網絡層連通。
說明:
本例中SwitchA和SwitchB需要支持VRRP和OSPF,有關VRRP和OSPF的支持形態,請參見相關章節。
5.在SwitchA和SwitchB上創建VRRP備份組1和VRRP備份組2,在備份組1中,配置SwitchA為Master設備,SwitchB為Backup設備;
在備份組2中,配置SwitchB為Master設備,SwitchA為Backup設備,實現流量的負載均衡。
______________________
1,
1.在處於環形網絡中的交換設備上配置MSTP基本功能,包括:
a.配置MST域並創建多實例,配置VLAN2映射到MSTI1,VLAN3映射到MSTI2,實現流量的負載分擔。
[SwitchA] [SwitchB] [SwitchC]
[SwitchA] stp region-configuration
[SwitchA-mst-region] region-name RG1
[SwitchA-mst-region] instance 1 vlan 2
[SwitchA-mst-region] instance 2 vlan 3
[SwitchA-mst-region] active region-configuration
[SwitchA-mst-region] quit
b.在MST域內,配置各實例的根橋與備份根橋。
c.配置各實例中某端口的路徑開銷值,實現將該端口阻塞。
d.使能MSTP,實現破除環路,包括:
•設備全局使能MSTP。
•除與終端設備相連的端口外,其他端口使能MSTP。
說明:
與終端相連的端口不用參與MSTP計算,建議將其設置為邊緣端口。
c.配置實例MSTI1和MSTI2中將要被阻塞端口的路徑開銷值大於缺省值
說明:
•端口路徑開銷值取值范圍由路徑開銷計算方法決定,這里選擇使用華為計算方法為例,配置實例MSTI1和MSTI2中將被阻塞端口的路徑開銷值為20000。
•同一網絡內所有交換設備的端口路徑開銷應使用相同的計算方法。
# 配置SwitchA的端口路徑開銷計算方法為華為計算方法。
[SwitchA] stp pathcost-standard legacy# 配置SwitchB的端口路徑開銷計算方法為華為計算方法。
[SwitchB] stp pathcost-standard legacy# 配置SwitchC的端口路徑開銷計算方法為華為計算方法,將端口GE0/0/1在實例MSTI2中的路徑開銷值配置為20000,將端口GE0/0/4在實例MSTI1中的路徑開銷值配置為20000。
[SwitchC] stp pathcost-standard legacy
[SwitchC] interface gigabitethernet 0/0/1
[SwitchC-GigabitEthernet0/0/1] stp instance 2 cost 20000 #讓 instance 2的vlan3 走 0/0/4端口
[SwitchC-GigabitEthernet0/0/1] quit
[SwitchC] interface gigabitethernet 0/0/4
[SwitchC-GigabitEthernet0/0/4] stp instance 1 cost 20000 #讓 instance1 的vlan2 走 0/0/1端口
[SwitchC-GigabitEthernet0/0/4] quit
-
使能MSTP,實現破除環路
-
設備全局使能MSTP
# 在SwitchA上啟動MSTP。
[SwitchA] stp enable
# 在SwitchB上啟動MSTP。
[SwitchB] stp enable
# 在SwitchC上啟動MSTP。
[SwitchC] stp enable
-
-
-
-
將與Host相連的端口設置為邊緣端口
# 配置SwitchC端口GE0/0/2和GE0/0/3為邊緣端口。
[SwitchC] interface gigabitethernet 0/0/2 [SwitchC-GigabitEthernet0/0/2] stp edged-port enable [SwitchC-GigabitEthernet0/0/2] quit [SwitchC] interface gigabitethernet 0/0/3 [SwitchC-GigabitEthernet0/0/3] stp edged-port enable [SwitchC-GigabitEthernet0/0/3] quit
(可選)配置SwitchC的BPDU保護功能。
[SwitchC] stp bpdu-protection
-
將與Router相連的端口設置為邊緣端口
# 配置SwitchA端口GE0/0/3為邊緣端口。
[SwitchA] interface gigabitethernet 0/0/3 [SwitchA-GigabitEthernet0/0/3] stp edged-port enable [SwitchA-GigabitEthernet0/0/3] quit
(可選)配置SwitchA的BPDU保護功能。
[SwitchA] stp bpdu-protection
# 配置SwitchB端口GE0/0/3為邊緣端口。
[SwitchB] interface gigabitethernet 0/0/3 [SwitchB-GigabitEthernet0/0/3] stp edged-port enable [SwitchB-GigabitEthernet0/0/3] quit
(可選)配置SwitchB的BPDU保護功能。
[SwitchB] stp bpdu-protection
說明:
如果與邊緣端口相連的是使能了STP功能的網絡設備,配置BPDU保護功能后,如果邊緣端口收到BPDU報文,邊緣端口將會被shutdown,邊緣端口屬性不變。
-
-
- 配置保護功能,如在各實例的根橋設備的指定端口配置根保護功能
# 在SwitchA端口GE0/0/1上啟動根保護。
[SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] stp root-protection [SwitchA-GigabitEthernet0/0/1] quit
# 在SwitchB端口GE0/0/1上啟動根保護。
[SwitchB] interface gigabitethernet 0/0/1 [SwitchB-GigabitEthernet0/0/1] stp root-protection [SwitchB-GigabitEthernet0/0/1] quit
- 配置處於環網中的設備的二層轉發功能
-
在交換設備SwitchA、SwitchB、SwitchC上創建VLAN2~3
# 在SwitchA上創建VLAN2~3。
[SwitchA] vlan batch 2 to 3
# 在SwitchB上創建VLAN2~3。
[SwitchB] vlan batch 2 to 3
# 在SwitchC上創建VLAN2~3。
[SwitchC] vlan batch 2 to 3
-
將交換設備上接入環路中的端口加入VLAN
# 將SwitchA端口GE0/0/1加入VLAN。
[SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] port link-type trunk [SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 to 3 [SwitchA-GigabitEthernet0/0/1] quit
# 將SwitchA端口GE0/0/2加入VLAN。
[SwitchA] interface gigabitethernet 0/0/2 [SwitchA-GigabitEthernet0/0/2] port link-type trunk [SwitchA-GigabitEthernet0/0/2] port trunk allow-pass vlan 2 to 3 [SwitchA-GigabitEthernet0/0/2] quit
# 將SwitchB端口GE0/0/1加入VLAN。
[SwitchB] interface gigabitethernet 0/0/1 [SwitchB-GigabitEthernet0/0/1] port link-type trunk [SwitchB-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 to 3 [SwitchB-GigabitEthernet0/0/1] quit
# 將SwitchB端口GE0/0/2加入VLAN。
[SwitchB] interface gigabitethernet 0/0/2 [SwitchB-GigabitEthernet0/0/2] port link-type trunk [SwitchB-GigabitEthernet0/0/2] port trunk allow-pass vlan 2 to 3 [SwitchB-GigabitEthernet0/0/2] quit
# 將SwitchC端口GE0/0/1加入VLAN。
[SwitchC] interface gigabitethernet 0/0/1 [SwitchC-GigabitEthernet0/0/1] port link-type trunk [SwitchC-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 to 3 [SwitchC-GigabitEthernet0/0/1] quit
# 將SwitchC端口GE0/0/2加入VLAN。
[SwitchC] interface gigabitethernet 0/0/2 [SwitchC-GigabitEthernet0/0/2] port link-type access [SwitchC-GigabitEthernet0/0/2] port default vlan 2 [SwitchC-GigabitEthernet0/0/2] quit
# 將SwitchC端口GE0/0/3加入VLAN。
[SwitchC] interface gigabitethernet 0/0/3 [SwitchC-GigabitEthernet0/0/3] port link-type access [SwitchC-GigabitEthernet0/0/3] port default vlan 3 [SwitchC-GigabitEthernet0/0/3] quit
# 將SwitchC端口GE0/0/4加入VLAN。
[SwitchC] interface gigabitethernet 0/0/4 [SwitchC-GigabitEthernet0/0/4] port link-type trunk [SwitchC-GigabitEthernet0/0/4] port trunk allow-pass vlan 2 to 3 [SwitchC-GigabitEthernet0/0/4] quit
-
- 驗證配置結果
經過以上配置,在網絡計算穩定后,執行以下操作,驗證配置結果。
說明:
本配置舉例以實例1和實例2為例,因此不用關注實例0中端口的狀態。
# 在SwitchA上執行display stp brief命令,查看端口狀態和端口的保護類型,結果如下:
[SwitchA] display stp brief MSTID Port Role STP State Protection 0 GigabitEthernet0/0/1DESI FORWARDING ROOT 0 GigabitEthernet0/0/2DESI FORWARDING NONE 1 GigabitEthernet0/0/1 DESI FORWARDING ROOT 1 GigabitEthernet0/0/2 DESI FORWARDING NONE 2 GigabitEthernet0/0/1 DESI FORWARDING ROOT 2 GigabitEthernet0/0/2 ROOT FORWARDING NONE
在MSTI1中,由於SwitchA是根橋,SwitchA的端口GE0/0/2和GE0/0/1成為指定端口。在MSTI2中,SwitchA的端口GE0/0/1成為指定端口,端口GE0/0/2成為根端口。
# 在SwitchB上執行display stp brief命令,結果如下:
[SwitchB] display stp brief MSTID Port Role STP State Protection 0 GigabitEthernet0/0/1DESI FORWARDING ROOT 0 GigabitEthernet0/0/2ROOT FORWARDING NONE 1 GigabitEthernet0/0/1 DESI FORWARDING ROOT 1 GigabitEthernet0/0/2 ROOT FORWARDING NONE 2 GigabitEthernet0/0/1 DESI FORWARDING ROOT 2 GigabitEthernet0/0/2 DESI FORWARDING NONE
在MSTI2中,由於SwitchB是根橋,端口GE0/0/1和GE0/0/2在MSTI2中成為指定端口。在MSTI1中,SwitchB的端口GE0/0/1成為指定端口,端口GE0/0/2成為根端口。
# 在SwitchC上執行display stp interface brief命令,結果如下:
[SwitchC] display stp interface gigabitethernet 0/0/1 brief MSTID Port Role STP State Protection 0 GigabitEthernet0/0/1ROOT FORWARDING NONE 1 GigabitEthernet0/0/1 ROOT FORWARDING NONE 2 GigabitEthernet0/0/1 ALTE DISCARDING NONE
[SwitchC] display stp interface gigabitethernet 0/0/4 brief MSTID Port Role STP State Protection 0 GigabitEthernet0/0/4ALTE DISCARDING NONE 1 GigabitEthernet0/0/4 ALTE DISCARDING NONE 2 GigabitEthernet0/0/4 ROOT FORWARDING NONE
SwitchC的端口GE0/0/1在MSTI1中為根端口,在MSTI2中被阻塞。SwitchC的另一個端口GE0/0/4,在MSTI1中被阻塞,在MSTI2中為根端口。
- 配置設備間的網絡互連
# 配置設備各端口的IP地址,以SwitchA為例。SwitchB的配置與SwitchA類似,詳見配置文件。
[SwitchA] vlan batch 4 [SwitchA] interface gigabitethernet 0/0/3 [SwitchA-GigabitEthernet0/0/3] port link-type trunk [SwitchA-GigabitEthernet0/0/3] port trunk allow-pass vlan 4 [SwitchA-GigabitEthernet0/0/3] quit [SwitchA] interface vlanif 2 [SwitchA-Vlanif2] ip address 10.1.2.102 24 [SwitchA-Vlanif2] quit [SwitchA] interface vlanif 3 [SwitchA-Vlanif3] ip address 10.1.3.102 24 [SwitchA-Vlanif3] quit [SwitchA] interface vlanif 4 [SwitchA-Vlanif4] ip address 10.1.4.102 24 [SwitchA-Vlanif4] quit
# 配置SwitchA、SwitchB和路由器間采用OSPF協議進行互連。以SwitchA為例,SwitchB的配置與SwitchA類似,詳見配置文件。
[SwitchA] ospf 1 [SwitchA-ospf-1] area 0 [SwitchA-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255 [SwitchA-ospf-1-area-0.0.0.0] network 10.1.3.0 0.0.0.255 [SwitchA-ospf-1-area-0.0.0.0] network 10.1.4.0 0.0.0.255 [SwitchA-ospf-1-area-0.0.0.0] quit [SwitchA-ospf-1] quit
- 配置VRRP備份組
# 在SwitchA和SwitchB上創建VRRP備份組1,配置SwitchA的優先級為120,搶占延時為20秒,作為Master設備;SwitchB的優先級為缺省值,作為Backup設備。
[SwitchA] interface vlanif 2 [SwitchA-Vlanif2] vrrp vrid 1 virtual-ip 10.1.2.100 [SwitchA-Vlanif2] vrrp vrid 1 priority 120 [SwitchA-Vlanif2] vrrp vrid 1 preempt-mode timer delay 20 [SwitchA-Vlanif2] quit
[SwitchB] interface vlanif 2 [SwitchB-Vlanif2] vrrp vrid 1 virtual-ip 10.1.2.100 [SwitchB-Vlanif2] quit
# 在SwitchA和SwitchB上創建VRRP備份組2,配置SwitchB的優先級為120,搶占延時為20秒,作為Master設備;SwitchA的優先級為缺省值,作為Backup設備。
[SwitchB] interface vlanif 3 [SwitchB-Vlanif3] vrrp vrid 2 virtual-ip 10.1.3.100 [SwitchB-Vlanif3] vrrp vrid 2 priority 120 [SwitchB-Vlanif3] vrrp vrid 2 preempt-mode timer delay 20 [SwitchB-Vlanif3] quit
[SwitchA] interface vlanif 3 [SwitchA-Vlanif3] vrrp vrid 2 virtual-ip 10.1.3.100 [SwitchA-Vlanif3] quit
# 配置主機HostA的缺省網關為備份組1的虛擬IP地址10.1.2.100,配置主機HostB的缺省網關為備份組2的虛擬IP地址10.1.3.100。
- 驗證配置結果
# 完成上述配置后,在SwitchA上執行display vrrp命令,可以看到SwitchA在備份組1中作為Master設備,在備份組2中作為Backup設備。
[SwitchA] display vrrp Vlanif2 | Virtual Router 1 State : Master Virtual IP : 10.1.2.100 Master IP : 10.1.2.102 PriorityRun : 120 PriorityConfig : 120 MasterPriority : 120 Preempt : YES Delay Time : 20 s TimerRun : 1 s TimerConfig : 1 s Auth type : NONE Virtual MAC : 0000-5e00-0101 Check TTL : YES Config type : normal-vrrp Backup-forward : disabled Create time :2012-05-11 11:39:18 Last change time :2012-05-26 11:38:58 Vlanif3 | Virtual Router 2 State : Backup Virtual IP : 10.1.3.100 Master IP : 10.1.3.103 PriorityRun : 100 PriorityConfig : 100 MasterPriority : 120 Preempt : YES Delay Time : 0 s TimerRun : 1 s TimerConfig : 1 s Auth type : NONE Virtual MAC : 0000-5e00-0102 Check TTL : YES Config type : normal-vrrp Backup-forward : disabled Create time :2012-05-11 11:40:18 Last change time :2012-05-26 11:48:58
# 在SwitchB上執行display vrrp命令,可以看到SwitchB在備份組1中作為Backup設備,在備份組2中作為Master設備。
[SwitchB] display vrrp Vlanif2 | Virtual Router 1 State : Backup Virtual IP : 10.1.2.100 Master IP : 10.1.2.102 PriorityRun : 100 PriorityConfig : 100 MasterPriority : 120 Preempt : YES Delay Time : 0 s TimerRun : 1 s TimerConfig : 1 s Auth type : NONE Virtual MAC : 0000-5e00-0101 Check TTL : YES Config type : normal-vrrp Backup-forward : disabled Create time :2012-05-11 11:39:18 Last change time :2012-05-26 11:38:58 Vlanif3 | Virtual Router 2 State : Master Virtual IP : 10.1.3.100 Master IP : 10.1.3.103 PriorityRun : 120 PriorityConfig : 120 MasterPriority : 120 Preempt : YES Delay Time : 20 s TimerRun : 1 s TimerConfig : 1 s Auth type : NONE Virtual MAC : 0000-5e00-0102 Check TTL : YES Config type : normal-vrrp Backup-forward : disabled Create time :2012-05-11 11:40:18 Last change time :2012-05-26 11:48:58
配置文件
-
SwitchA的配置文件
# sysname SwitchA # vlan batch 2 to 4 # stp instance 1 root primary stp instance 2 root secondary stp bpdu-protection stp pathcost-standard legacy # stp region-configuration region-name RG1 instance 1 vlan 2 instance 2 vlan 3 active region-configuration # interface Vlanif2 ip address 10.1.2.102 255.255.255.0 vrrp vrid 1 virtual-ip 10.1.2.100 vrrp vrid 1 priority 120 vrrp vrid 1 preempt-mode timer delay 20 # interface Vlanif3 ip address 10.1.3.102 255.255.255.0 vrrp vrid 2 virtual-ip 10.1.3.100 # interface Vlanif4 ip address 10.1.4.102 255.255.255.0 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 2 to 3 stp root-protection # interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 2 to 3 # interface GigabitEthernet0/0/3 port link-type trunk port trunk allow-pass vlan 4 stp edged-port enable # ospf 1 area 0.0.0.0 network 10.1.2.0 0.0.0.255 network 10.1.3.0 0.0.0.255 network 10.1.4.0 0.0.0.255 # return
-
SwitchB的配置文件
# sysname SwitchB # vlan batch 2 to 3 5 # stp instance 1 root secondary stp instance 2 root primary stp bpdu-protection stp pathcost-standard legacy # stp region-configuration region-name RG1 instance 1 vlan 2 instance 2 vlan 3 active region-configuration # interface Vlanif2 ip address 10.1.2.103 255.255.255.0 vrrp vrid 1 virtual-ip 10.1.2.100 # interface Vlanif3 ip address 10.1.3.103 255.255.255.0 vrrp vrid 2 virtual-ip 10.1.3.100 vrrp vrid 2 priority 120 vrrp vrid 2 preempt-mode timer delay 20 # interface Vlanif5 ip address 10.1.5.103 255.255.255.0 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 2 to 3 stp root-protection # interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 2 to 3 # interface GigabitEthernet0/0/3 port link-type trunk port trunk allow-pass vlan 5 stp edged-port enable # ospf 1 area 0.0.0.0 network 10.1.2.0 0.0.0.255 network 10.1.3.0 0.0.0.255 network 10.1.5.0 0.0.0.255 # return
-
SwitchC的配置文件
# sysname SwitchC # vlan batch 2 to 3 # stp bpdu-protection stp pathcost-standard legacy # stp region-configuration region-name RG1 instance 1 vlan 2 instance 2 vlan 3 active region-configuration # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 2 to 3 stp instance 2 cost 20000 # interface GigabitEthernet0/0/2 port link-type access port default vlan 2 stp edged-port enable # interface GigabitEthernet0/0/3 port link-type access port default vlan 3 stp edged-port enable # interface GigabitEthernet0/0/4 port link-type trunk port trunk allow-pass vlan 2 to 3 stp instance 1 cost 20000 # return
-