組網圖形網絡
MSTP+VRRP組合簡介ui
組網需求spa
配置思路orm
操做步驟blog
配置MSTP基本功能ip
a.配置SwitchA、SwitchB、SwitchC到域名爲RG1的域內,建立實例MSTI1和實例MSTI2路由
# 配置SwitchA的MST域。部署
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] stp region-configuration //進入MST域視圖。 [SwitchA-mst-region] region-name RG1 //配置域名爲RG1。 [SwitchA-mst-region] instance 1 vlan 2 //將VLAN 2映射到實例1上。 [SwitchA-mst-region] instance 2 vlan 3 //將VLAN 3映射到實例2上。 [SwitchA-mst-region] active region-configuration //激活MST域的配置。 [SwitchA-mst-region] quit
# 配置SwitchB的MST域。cmd
<HUAWEI> system-view [HUAWEI] sysname SwitchB [SwitchB] stp region-configuration //進入MST域視圖。 [SwitchB-mst-region] region-name RG1 //配置域名爲RG1。 [SwitchB-mst-region] instance 1 vlan 2 //將VLAN 2映射到實例1上。 [SwitchB-mst-region] instance 2 vlan 3 //將VLAN 3映射到實例2上。 [SwitchB-mst-region] active region-configuration //激活MST域的配置。 [SwitchB-mst-region] quit
# 配置SwitchC的MST域。域名
<HUAWEI> system-view [HUAWEI] sysname SwitchC [SwitchC] stp region-configuration //進入MST域視圖。 [SwitchC-mst-region] region-name RG1 //配置域名爲RG1。 [SwitchC-mst-region] instance 1 vlan 2 //將VLAN 2映射到實例1上。 [SwitchC-mst-region] instance 2 vlan 3 //將VLAN 3映射到實例2上。 [SwitchC-mst-region] active region-configuration //激活MST域的配置。 [SwitchC-mst-region] quit
b.在域RG1內,配置MSTI1與MSTI2的根橋與備份根橋
配置MSTI1的根橋與備份根橋
# 配置SwitchA爲MSTI1的根橋。
[SwitchA] stp instance 1 root primary
# 配置SwitchB爲MSTI1的備份根橋。
[SwitchB] stp instance 1 root secondary
配置MSTI2的根橋與備份根橋
# 配置SwitchB爲MSTI2的根橋。
[SwitchB] stp instance 2 root primary
# 配置SwitchA爲MSTI2的備份根橋。
[SwitchA] stp instance 2 root secondary
c.配置實例MSTI1和MSTI2中將要被阻塞端口的路徑開銷值大於缺省值
# 配置SwitchA的端口路徑開銷。
[SwitchA] stp pathcost-standard legacy
# 配置SwitchB的端口路徑開銷。
[SwitchB] stp pathcost-standard legacy
# 配置SwitchC的端口路徑開銷計算方法爲華爲計算方法,將端口GE1/0/1在實例MSTI2中的路徑開銷值配置爲20000,將端口GE1/0/4在實例MSTI1中的路徑開銷值配置爲20000。
[SwitchC] stp pathcost-standard legacy [SwitchC] interface gigabitethernet 1/0/1 [SwitchC-GigabitEthernet1/0/1] stp instance 2 cost 20000 [SwitchC-GigabitEthernet1/0/1] quit [SwitchC] interface gigabitethernet 1/0/4 [SwitchC-GigabitEthernet1/0/4] stp instance 1 cost 20000 [SwitchC-GigabitEthernet1/0/4] quit
d.使能MSTP,實現破除環路
設備全局使能MSTP
# 在SwitchA/B/C上啓動MSTP。
[SwitchA] stp enable [SwitchB] stp enable [SwitchC] stp enable
將與Host相連的端口配置爲邊緣端口並配置BPDU過濾
[SwitchC] interface gigabitethernet 1/0/2 [SwitchC-GigabitEthernet1/0/2] stp disable [SwitchC-GigabitEthernet1/0/2] stp edged-port enable [SwitchC-GigabitEthernet1/0/2] stp bpdu-filter enable [SwitchC-GigabitEthernet1/0/2] quit [SwitchC] interface gigabitethernet 1/0/3 [SwitchC-GigabitEthernet1/0/3] stp edged-port enable [SwitchC-GigabitEthernet1/0/3] stp bpdu-filter enable [SwitchC-GigabitEthernet1/0/3] quit
將與Router相連的端口配置爲邊緣端口並配置BPDU過濾
# 配置SwitchA端口。
[SwitchA] interface gigabitethernet 1/0/3 [SwitchA-GigabitEthernet1/0/3] stp edged-port enable [SwitchA-GigabitEthernet1/0/3] stp bpdu-filter enable [SwitchA-GigabitEthernet1/0/3] quit
# 配置SwitchB端口。
[SwitchB] interface gigabitethernet 1/0/3 [SwitchB-GigabitEthernet1/0/3] stp edged-port enable [SwitchB-GigabitEthernet1/0/3] stp bpdu-filter enable [SwitchB-GigabitEthernet1/0/3] quit
# 在SwitchA端口GE1/0/1上啓動根保護。
[SwitchA] interface gigabitethernet 1/0/1 [SwitchA-GigabitEthernet1/0/1] stp root-protection [SwitchA-GigabitEthernet1/0/1] quit
# 在SwitchB端口GE1/0/1上啓動根保護。
[SwitchB] interface gigabitethernet 1/0/1 [SwitchB-GigabitEthernet1/0/1] stp root-protection [SwitchB-GigabitEthernet1/0/1] quit
在交換設備SwitchA、SwitchB、SwitchC上建立VLAN2~3
# 在SwitchA/B/C上建立VLAN2~3。
[SwitchA] vlan batch 2 to 3 [SwitchB] vlan batch 2 to 3 [SwitchC] vlan batch 2 to 3
將交換設備上接入環路中的端口加入VLAN
# 將SwitchA端口GE1/0/1加入VLAN。
[SwitchA] interface gigabitethernet 1/0/1 [SwitchA-GigabitEthernet1/0/1] port link-type trunk [SwitchA-GigabitEthernet1/0/1] port trunk allow-pass vlan 2 to 3 [SwitchA-GigabitEthernet1/0/1] quit
# 將SwitchA端口GE1/0/2加入VLAN。
[SwitchA] interface gigabitethernet 1/0/2 [SwitchA-GigabitEthernet1/0/2] port link-type trunk [SwitchA-GigabitEthernet1/0/2] port trunk allow-pass vlan 2 to 3 [SwitchA-GigabitEthernet1/0/2] quit
# 將SwitchB端口GE1/0/1加入VLAN。
[SwitchB] interface gigabitethernet 1/0/1 [SwitchB-GigabitEthernet1/0/1] port link-type trunk [SwitchB-GigabitEthernet1/0/1] port trunk allow-pass vlan 2 to 3 [SwitchB-GigabitEthernet1/0/1] quit
# 將SwitchB端口GE1/0/2加入VLAN。
[SwitchB] interface gigabitethernet 1/0/2 [SwitchB-GigabitEthernet1/0/2] port link-type trunk [SwitchB-GigabitEthernet1/0/2] port trunk allow-pass vlan 2 to 3 [SwitchB-GigabitEthernet1/0/2] quit
# 將SwitchC端口GE1/0/1加入VLAN。
[SwitchC] interface gigabitethernet 1/0/1 [SwitchC-GigabitEthernet1/0/1] port link-type trunk [SwitchC-GigabitEthernet1/0/1] port trunk allow-pass vlan 2 to 3 [SwitchC-GigabitEthernet1/0/1] quit
# 將SwitchC端口GE1/0/2加入VLAN。
[SwitchC] interface gigabitethernet 1/0/2 [SwitchC-GigabitEthernet1/0/2] port link-type access [SwitchC-GigabitEthernet1/0/2] port default vlan 2 [SwitchC-GigabitEthernet1/0/2] quit
# 將SwitchC端口GE1/0/3加入VLAN。
[SwitchC] interface gigabitethernet 1/0/3 [SwitchC-GigabitEthernet1/0/3] port link-type access [SwitchC-GigabitEthernet1/0/3] port default vlan 3 [SwitchC-GigabitEthernet1/0/3] quit
# 將SwitchC端口GE1/0/4加入VLAN。
[SwitchC] interface gigabitethernet 1/0/4 [SwitchC-GigabitEthernet1/0/4] port link-type trunk [SwitchC-GigabitEthernet1/0/4] port trunk allow-pass vlan 2 to 3 [SwitchC-GigabitEthernet1/0/4] quit
# 在SwitchA上執行display stp brief命令,查看端口狀態和端口的保護類型,結果以下:
[SwitchA] display stp brief MSTID Port Role STP State Protection 0 GigabitEthernet1/0/1 DESI FORWARDING ROOT 0 GigabitEthernet1/0/2 DESI FORWARDING NONE 1 GigabitEthernet1/0/1 DESI FORWARDING ROOT 1 GigabitEthernet1/0/2 DESI FORWARDING NONE 2 GigabitEthernet1/0/1 DESI FORWARDING ROOT 2 GigabitEthernet1/0/2 ROOT FORWARDING NONE
在MSTI1中,因爲SwitchA是根橋,SwitchA的端口GE1/0/2和GE1/0/1成爲指定端口。在MSTI2中,SwitchA的端口GE1/0/1成爲指定端口,端口GE1/0/2成爲根端口。
# 在SwitchB上執行display stp brief命令,結果以下:
[SwitchB] display stp brief MSTID Port Role STP State Protection 0 GigabitEthernet1/0/1 DESI FORWARDING ROOT 0 GigabitEthernet1/0/2 ROOT FORWARDING NONE 1 GigabitEthernet1/0/1 DESI FORWARDING ROOT 1 GigabitEthernet1/0/2 ROOT FORWARDING NONE 2 GigabitEthernet1/0/1 DESI FORWARDING ROOT 2 GigabitEthernet1/0/2 DESI FORWARDING NONE
在MSTI2中,因爲SwitchB是根橋,端口GE1/0/1和GE1/0/2在MSTI2中成爲指定端口。在MSTI1中,SwitchB的端口GE1/0/1成爲指定端口,端口GE1/0/2成爲根端口。
# 在SwitchC上執行display stp interface brief命令,結果以下:
[SwitchC] display stp interface gigabitethernet 1/0/1 brief MSTID Port Role STP State Protection 0 GigabitEthernet1/0/1 ROOT FORWARDING NONE 1 GigabitEthernet1/0/1 ROOT FORWARDING NONE 2 GigabitEthernet1/0/1 ALTE DISCARDING NONE
[SwitchC] display stp interface gigabitethernet 1/0/4 brief MSTID Port Role STP State Protection 0 GigabitEthernet1/0/4 ALTE DISCARDING NONE 1 GigabitEthernet1/0/4 ALTE DISCARDING NONE 2 GigabitEthernet1/0/4 ROOT FORWARDING NONE
SwitchC的端口GE1/0/1在MSTI1中爲根端口,在MSTI2中被阻塞。SwitchC的另外一個端口GE1/0/4,在MSTI1中被阻塞,在MSTI2中爲根端口。
# 配置設備各端口的IP地址,以SwitchA爲例。SwitchB的配置與SwitchA相似,再也不贅述。
[SwitchA] vlan batch 4 [SwitchA] interface gigabitethernet 1/0/3 [SwitchA-GigabitEthernet1/0/3] port link-type trunk [SwitchA-GigabitEthernet1/0/3] port trunk allow-pass vlan 4 [SwitchA-GigabitEthernet1/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
# 在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 //建立組號爲1的VRRP備份組併爲備份組指定虛擬IP地址10.1.2.100。 [SwitchA-Vlanif2] vrrp vrid 1 priority 120 //配置VRRP備份組1的優先級爲120。 [SwitchA-Vlanif2] vrrp vrid 1 preempt-mode timer delay 20 //配置VRRP備份組1搶佔延時爲20秒。 [SwitchA-Vlanif2] quit
[SwitchB] interface vlanif 2 [SwitchB-Vlanif2] vrrp vrid 1 virtual-ip 10.1.2.100 //建立組號爲1的VRRP備份組併爲備份組指定虛擬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 //建立組號爲2的VRRP備份組併爲備份組指定虛擬IP地址10.1.3.100。 [SwitchB-Vlanif3] vrrp vrid 2 priority 120 //配置VRRP備份組1的優先級爲120。 [SwitchB-Vlanif3] vrrp vrid 2 preempt-mode timer delay 20 //配置VRRP備份組2搶佔延時爲20秒。 [SwitchB-Vlanif3] quit
[SwitchA] interface vlanif 3 [SwitchA-Vlanif3] vrrp vrid 2 virtual-ip 10.1.3.100 //建立組號爲2的VRRP備份組併爲備份組指定虛擬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 : 2018-05-11 11:39:18 Last change time : 2018-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 : 2018-05-11 11:40:18 Last change time : 2018-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 : 2018-05-11 11:39:18 Last change time : 2018-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 : 2018-05-11 11:40:18 Last change time : 2018-05-26 11:48:58