網(wǎng)絡(luò)拓?fù)鋵?shí)例02:MSTP功能
組網(wǎng)圖形

MSTP簡(jiǎn)介
- 以太網(wǎng)交換網(wǎng)絡(luò)中為了進(jìn)行鏈路備份,提高網(wǎng)絡(luò)可靠性,通常會(huì)使用冗余鏈路。但是使用冗余鏈路會(huì)在交換網(wǎng)絡(luò)上產(chǎn)生環(huán)路,引發(fā)廣播風(fēng)暴以及MAC地址表不穩(wěn)定等故障現(xiàn)象,從而導(dǎo)致用戶通信質(zhì)量較差,甚至通信中斷。為解決交換網(wǎng)絡(luò)中的環(huán)路問(wèn)題,提出了生成樹(shù)協(xié)議STP(Spanning Tree Protocol)。STP(Spanning Tree Protocol)是用來(lái)解決網(wǎng)絡(luò)中環(huán)路問(wèn)題的協(xié)議。運(yùn)行該協(xié)議的設(shè)備通過(guò)彼此交互信息而發(fā)現(xiàn)網(wǎng)絡(luò)中的環(huán)路,并對(duì)某些端口進(jìn)行阻塞以消除環(huán)路。
- 與眾多協(xié)議的發(fā)展過(guò)程一樣,生成樹(shù)協(xié)議也是隨著網(wǎng)絡(luò)的發(fā)展而不斷更新的,從最初的IEEE 802.1D中定義的STP到IEEE 802.1W中定義的快速生成樹(shù)協(xié)議RSTP(Rapid Spanning Tree Protocol),再到最新的IEEE 802.1S中定義的多生成樹(shù)協(xié)議MSTP(Multiple Spanning Tree Protocol)。
- 生成樹(shù)協(xié)議中,MSTP兼容RSTP、STP,RSTP兼容STP。三種生成樹(shù)協(xié)議的比較如表1所示。
|
生成樹(shù)協(xié)議 |
特點(diǎn) |
應(yīng)用場(chǎng)景 |
|---|---|---|
|
STP |
|
無(wú)需區(qū)分用戶或業(yè)務(wù)流量,所有VLAN共享一棵生成樹(shù)。 |
|
RSTP(詳情見(jiàn)實(shí)例) |
|
|
|
MSTP |
|
需要區(qū)分用戶或業(yè)務(wù)流量,并實(shí)現(xiàn)負(fù)載分擔(dān)。不同的VLAN通過(guò)不同的生成樹(shù)轉(zhuǎn)發(fā)流量,每棵生成樹(shù)之間相互獨(dú)立。 |
組網(wǎng)需求
- 在一個(gè)復(fù)雜的網(wǎng)絡(luò)中,由于冗余備份的需要,網(wǎng)絡(luò)規(guī)劃者一般都傾向于在設(shè)備之間部署多條物理鏈路,其中一條作為主用鏈路,其他作為備份鏈路。這樣就難免會(huì)形成環(huán)路,若網(wǎng)絡(luò)中存在環(huán)路,可能會(huì)引起廣播風(fēng)暴和MAC表項(xiàng)被破壞。為此,可以在網(wǎng)絡(luò)中部署MSTP協(xié)議預(yù)防環(huán)路。MSTP可阻塞二層網(wǎng)絡(luò)中的冗余鏈路,將網(wǎng)絡(luò)修剪成樹(shù)狀,達(dá)到消除環(huán)路的目的。
- 如圖1所示,SwitchA、SwitchB、SwitchC和SwitchD都運(yùn)行MSTP。為實(shí)現(xiàn)VLAN2~VLAN10和VLAN11~VLAN20的流量負(fù)載分擔(dān),MSTP引入了多實(shí)例。MSTP可設(shè)置VLAN映射表,把VLAN和生成樹(shù)實(shí)例相關(guān)聯(lián)。
配置思路
- 在處于環(huán)形網(wǎng)絡(luò)中的交換設(shè)備上配置MSTP基本功能。
- 配置保護(hù)功能,實(shí)現(xiàn)對(duì)設(shè)備或鏈路的保護(hù)。例如:在各實(shí)例的根橋設(shè)備指定端口配置根保護(hù)功能。
- 配置設(shè)備的二層轉(zhuǎn)發(fā)功能。
說(shuō)明:
設(shè)備配置根保護(hù)功能后,如果根橋和備份根橋之間的鏈路down了,則配置根保護(hù)的端口狀態(tài)會(huì)因?yàn)楦Wo(hù)功能生效直接變成discarding狀態(tài)。
為了提高可靠性,建議根橋和備份根橋之間的鏈路綁定Eth-Trunk。
操作步驟
- 配置MSTP基本功能
a.配置SwitchA、SwitchB、SwitchC和SwitchD到域名為RG1的域內(nèi),創(chuàng)建實(shí)例MSTI1和實(shí)例MSTI2
# 配置實(shí)例1的根橋SwitchA的MST域。
1 <HUAWEI> system-view 2 [HUAWEI] sysname SwitchA 3 [SwitchA] stp region-configuration 4 [SwitchA-mst-region] region-name RG1 //配置域名為RG1。 5 [SwitchA-mst-region] instance 1 vlan 2 to 10 //將VLAN 2至VLAN 10映射到實(shí)例1上。 6 [SwitchA-mst-region] instance 2 vlan 11 to 20 //將VLAN 11至VLAN 20映射到實(shí)例2上。 7 [SwitchA-mst-region] active region-configuration //激活MST域的配置。 8 [SwitchA-mst-region] quit
# 配置實(shí)例2的根橋SwitchB的MST域。
1 <HUAWEI> system-view 2 [HUAWEI] sysname SwitchB 3 [SwitchB] stp region-configuration 4 [SwitchB-mst-region] region-name RG1 //配置域名為RG1。 5 [SwitchB-mst-region] instance 1 vlan 2 to 10 //將VLAN 2至VLAN 10映射到實(shí)例1上。 6 [SwitchB-mst-region] instance 2 vlan 11 to 20 //將VLAN 11至VLAN 20映射到實(shí)例2上。 7 [SwitchB-mst-region] active region-configuration //激活MST域的配置。 8 [SwitchB-mst-region] quit
# 配置接入交換機(jī)SwitchC的MST域。
1 <HUAWEI> system-view 2 [HUAWEI] sysname SwitchC 3 [SwitchC] stp region-configuration 4 [SwitchC-mst-region] region-name RG1 //配置域名為RG1。 5 [SwitchC-mst-region] instance 1 vlan 2 to 10 //將VLAN 2至VLAN 10映射到實(shí)例1上。 6 [SwitchC-mst-region] instance 2 vlan 11 to 20 //將VLAN 11至VLAN 20映射到實(shí)例2上。 7 [SwitchC-mst-region] active region-configuration //激活MST域的配置。 8 [SwitchC-mst-region] quit
# 配置接入交換機(jī)SwitchD的MST域。
1 <HUAWEI> system-view 2 [HUAWEI] sysname SwitchD 3 [SwitchD] stp region-configuration 4 [SwitchD-mst-region] region-name RG1 //配置域名為RG1。 5 [SwitchD-mst-region] instance 1 vlan 2 to 10 //將VLAN 2至VLAN 10映射到實(shí)例1上。 6 [SwitchD-mst-region] instance 2 vlan 11 to 20 //將VLAN 11至VLAN 20映射到實(shí)例2上。 7 [SwitchD-mst-region] active region-configuration //激活MST域的配置。 8 [SwitchD-mst-region] quit
b.在域RG1內(nèi),配置MSTI1與MSTI2的根橋與備份根橋
配置MSTI1的根橋與備份根橋
# 配置SwitchA為MSTI1的根橋。
1 [SwitchA] stp instance 1 root primary
# 配置SwitchB為MSTI1的備份根橋。
1 [SwitchB] stp instance 1 root secondary
配置MSTI2的根橋與備份根橋
# 配置SwitchB為MSTI2的根橋。
1 [SwitchB] stp instance 2 root primary
# 配置SwitchA為MSTI2的備份根橋。
1 [SwitchA] stp instance 2 root secondary
c.配置實(shí)例MSTI1和MSTI2中將要被阻塞端口的路徑開(kāi)銷值大于缺省值
說(shuō)明:
?端口路徑開(kāi)銷值取值范圍由路徑開(kāi)銷計(jì)算方法決定,這里選擇使用華為計(jì)算方法為例,配置實(shí)例MSTI1和MSTI2中將被阻塞端口的路徑開(kāi)銷值為20000。
?同一網(wǎng)絡(luò)內(nèi)所有交換設(shè)備的端口路徑開(kāi)銷應(yīng)使用相同的計(jì)算方法。
# 配置實(shí)例1的根橋SwitchA的端口路徑開(kāi)銷。
1 [SwitchA] stp pathcost-standard legacy
# 配置實(shí)例2的根橋SwitchB的端口路徑開(kāi)銷。
1 [SwitchB] stp pathcost-standard legacy
# 配置接入交換機(jī)SwitchC的端口路徑開(kāi)銷,將端口GE0/0/2在實(shí)例MSTI2中的路徑開(kāi)銷值配置為20000。
1 [SwitchC] stp pathcost-standard legacy 2 [SwitchC] interface gigabitethernet 0/0/2 3 [SwitchC-GigabitEthernet0/0/2] stp instance 2 cost 20000 4 [SwitchC-GigabitEthernet0/0/2] quit
# 配置接入交換機(jī)SwitchD的端口路徑開(kāi)銷,將端口GE0/0/2在實(shí)例MSTI1中的路徑開(kāi)銷值配置為20000。
1 [SwitchD] stp pathcost-standard legacy 2 [SwitchD] interface gigabitethernet 0/0/2 3 [SwitchD-GigabitEthernet0/0/2] stp instance 1 cost 20000 4 [SwitchD-GigabitEthernet0/0/2] quit
d.使能MSTP,實(shí)現(xiàn)破除環(huán)路
設(shè)備全局使能MSTP
# 在SwitchA/B/C/D上啟動(dòng)MSTP。
1 [SwitchA] stp enable 2 3 [SwitchB] stp enable 4 5 [SwitchC] stp enable 6 7 [SwitchD] stp enable
將與終端相連的端口設(shè)置為邊緣端口并使能端口的BPDU報(bào)文過(guò)濾功能
# 配置SwitchC端口GE0/0/1設(shè)置為邊緣端口并使能端口的BPDU報(bào)文過(guò)濾功能。
1 [SwitchC] interface gigabitethernet 0/0/1 2 [SwitchC-GigabitEthernet0/0/1] stp edged-port enable 3 [SwitchC-GigabitEthernet0/0/1] stp bpdu-filter enable 4 [SwitchC-GigabitEthernet0/0/1] quit
# 配置SwitchD端口GE0/0/1設(shè)置為邊緣端口并使能端口的BPDU報(bào)文過(guò)濾功能。
1 [SwitchD] interface gigabitethernet 0/0/1 2 [SwitchD-GigabitEthernet0/0/1] stp edged-port enable 3 [SwitchD-GigabitEthernet0/0/1] stp bpdu-filter enable 4 [SwitchD-GigabitEthernet0/0/1] quit
- 配置保護(hù)功能,如在各實(shí)例的根橋設(shè)備的指定端口配置根保護(hù)功能
# 在實(shí)例1根橋SwitchA端口GE0/0/1上啟動(dòng)根保護(hù)。
1 [SwitchA] interface gigabitethernet 0/0/1 2 [SwitchA-GigabitEthernet0/0/1] stp root-protection 3 [SwitchA-GigabitEthernet0/0/1] quit
# 在實(shí)例2根橋SwitchB端口GE0/0/1上啟動(dòng)根保護(hù)。
1 [SwitchB] interface gigabitethernet 0/0/1 2 [SwitchB-GigabitEthernet0/0/1] stp root-protection 3 [SwitchB-GigabitEthernet0/0/1] quit
- 配置處于環(huán)網(wǎng)中的設(shè)備的二層轉(zhuǎn)發(fā)功能
在交換設(shè)備SwitchA、SwitchB、SwitchC和SwitchD上創(chuàng)建VLAN2~20
1 [SwitchA] vlan batch 2 to 20 2 3 [SwitchB] vlan batch 2 to 20 4 5 [SwitchC] vlan batch 2 to 20 6 7 [SwitchD] vlan batch 2 to 20
將交換設(shè)備上接入環(huán)路中的端口加入VLAN
# 將實(shí)例1的根橋SwitchA端口GE0/0/1加入VLAN。
1 [SwitchA] interface gigabitethernet 0/0/1 2 [SwitchA-GigabitEthernet0/0/1] port link-type trunk 3 [SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 to 20 4 [SwitchA-GigabitEthernet0/0/1] quit
# 將實(shí)例1的根橋SwitchA端口Eth-Trunk1加入VLAN。
1 [SwitchA] interface Eth-Trunk 1 2 [SwitchA-Eth-Trunk1] trunkport gigabitethernet 0/0/2 3 [SwitchA-Eth-Trunk1] trunkport gigabitethernet 0/0/3 4 [SwitchA-Eth-Trunk1] port link-type trunk 5 [SwitchA-Eth-Trunk1] port trunk allow-pass vlan 2 to 20 6 [SwitchA-Eth-Trunk1] quit
# 將實(shí)例2的根橋SwitchB端口GE0/0/1加入VLAN。
1 [SwitchB] interface gigabitethernet 0/0/1 2 [SwitchB-GigabitEthernet0/0/1] port link-type trunk 3 [SwitchB-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 to 20 4 [SwitchB-GigabitEthernet0/0/1] quit
# 將實(shí)例2的根橋SwitchB端口Eth-Trunk1加入VLAN。
1 [SwitchB] interface Eth-Trunk 1 2 [SwitchB-Eth-Trunk1] trunkport gigabitethernet 0/0/2 3 [SwitchB-Eth-Trunk1] trunkport gigabitethernet 0/0/3 4 [SwitchB-Eth-Trunk1] port link-type trunk 5 [SwitchB-Eth-Trunk1] port trunk allow-pass vlan 2 to 20 6 [SwitchB-Eth-Trunk1] quit
# 將接入交換機(jī)SwitchC端口GE0/0/1加入VLAN。
1 [SwitchC] interface gigabitethernet 0/0/1 2 [SwitchC-GigabitEthernet0/0/1] port link-type access 3 [SwitchC-GigabitEthernet0/0/1] port default vlan 2 4 [SwitchC-GigabitEthernet0/0/1] quit
# 將接入交換機(jī)SwitchC端口GE0/0/2加入VLAN。
1 [SwitchC] interface gigabitethernet 0/0/2 2 [SwitchC-GigabitEthernet0/0/2] port link-type trunk 3 [SwitchC-GigabitEthernet0/0/2] port trunk allow-pass vlan 2 to 20 4 [SwitchC-GigabitEthernet0/0/2] quit
# 將接入交換機(jī)SwitchC端口GE0/0/3加入VLAN。
1 [SwitchC] interface gigabitethernet 0/0/3 2 [SwitchC-GigabitEthernet0/0/3] port link-type trunk 3 [SwitchC-GigabitEthernet0/0/3] port trunk allow-pass vlan 2 to 20 4 [SwitchC-GigabitEthernet0/0/3] quit
# 將接入交換機(jī)SwitchD端口GE0/0/1加入VLAN。
1 [SwitchD] interface gigabitethernet 0/0/1 2 [SwitchD-GigabitEthernet0/0/1] port link-type access 3 [SwitchD-GigabitEthernet0/0/1] port default vlan 11 4 [SwitchD-GigabitEthernet0/0/1] quit
# 將接入交換機(jī)SwitchD端口GE0/0/2加入VLAN。
1 [SwitchD] interface gigabitethernet 0/0/2 2 [SwitchD-GigabitEthernet0/0/2] port link-type trunk 3 [SwitchD-GigabitEthernet0/0/2] port trunk allow-pass vlan 2 to 20 4 [SwitchD-GigabitEthernet0/0/2] quit
# 將接入交換機(jī)SwitchD端口GE0/0/3加入VLAN。
1 [SwitchD] interface gigabitethernet 0/0/3 2 [SwitchD-GigabitEthernet0/0/3] port link-type trunk 3 [SwitchD-GigabitEthernet0/0/3] port trunk allow-pass vlan 2 to 20 4 [SwitchD-GigabitEthernet0/0/3] quit
- 驗(yàn)證配置結(jié)果
說(shuō)明:
本配置舉例以實(shí)例1和實(shí)例2為例,因此不用關(guān)注實(shí)例0中端口的狀態(tài)。
# 在實(shí)例1的根橋SwitchA上執(zhí)行display stp brief命令,查看端口狀態(tài)和端口的保護(hù)類型,結(jié)果如下:
1 [SwitchA] display stp brief 2 MSTID Port Role STP State Protection 3 0 GigabitEthernet0/0/1 DESI FORWARDING ROOT 4 0 Eth-Trunk1 DESI FORWARDING NONE 5 1 GigabitEthernet0/0/1 DESI FORWARDING ROOT 6 1 Eth-Trunk1 DESI FORWARDING NONE 7 2 GigabitEthernet0/0/1 DESI FORWARDING ROOT 8 2 Eth-Trunk1 ROOT FORWARDING NONE
在MSTI1中,由于SwitchA是根橋,SwitchA的端口Eth-Trunk1和GE0/0/1成為指定端口。在MSTI2中,SwitchA的端口GE0/0/1成為指定端口,端口Eth-Trunk1成為根端口。
# 在實(shí)例2的根橋SwitchB上執(zhí)行display stp brief命令,結(jié)果如下:
1 [SwitchB] display stp brief 2 MSTID Port Role STP State Protection 3 0 GigabitEthernet0/0/1 DESI FORWARDING ROOT 4 0 Eth-Trunk1 ROOT FORWARDING NONE 5 1 GigabitEthernet0/0/1 DESI FORWARDING ROOT 6 1 Eth-Trunk1 ROOT FORWARDING NONE 7 2 GigabitEthernet0/0/1 DESI FORWARDING ROOT 8 2 Eth-Trunk1 DESI FORWARDING NONE
在MSTI2中,由于SwitchB是根橋,端口GE0/0/1和Eth-Trunk1在MSTI2中成為指定端口。在MSTI1中,SwitchB的端口GE0/0/1成為指定端口,端口Eth-Trunk1成為根端口。
# 在接入交換機(jī)SwitchC上執(zhí)行display stp interface brief命令,結(jié)果如下:
1 [SwitchC] display stp interface gigabitethernet 0/0/3 brief 2 MSTID Port Role STP State Protection 3 0 GigabitEthernet0/0/3 ROOT FORWARDING NONE 4 1 GigabitEthernet0/0/3 ROOT FORWARDING NONE 5 2 GigabitEthernet0/0/3 ROOT FORWARDING NONE
1 [SwitchC] display stp interface gigabitethernet 0/0/2 brief 2 MSTID Port Role STP State Protection 3 0 GigabitEthernet0/0/2 DESI FORWARDING NONE 4 1 GigabitEthernet0/0/2 DESI FORWARDING NONE 5 2 GigabitEthernet0/0/2 ALTE DISCARDING NONE
SwitchC的端口GE0/0/3在MSTI1和MSTI2中為根端口。SwitchC的另一個(gè)端口GE0/0/2,在MSTI2中被阻塞,在MSTI1中被計(jì)算為指定端口。
# 在接入交換機(jī)SwitchD上執(zhí)行display stp interface brief命令,結(jié)果如下:
1 [SwitchD] display stp interface gigabitethernet 0/0/3 brief 2 MSTID Port Role STP State Protection 3 0 GigabitEthernet0/0/3 ROOT FORWARDING NONE 4 1 GigabitEthernet0/0/3 ROOT FORWARDING NONE 5 2 GigabitEthernet0/0/3 ROOT FORWARDING NONE
1 [SwitchD] display stp interface gigabitethernet 0/0/2 brief 2 MSTID Port Role STP State Protection 3 0 GigabitEthernet0/0/2 ALTE DISCARDING NONE 4 1 GigabitEthernet0/0/2 ALTE DISCARDING NONE 5 2 GigabitEthernet0/0/2 DESI FORWARDING NONE
SwitchD的端口GE0/0/3在MSTI1和MSTI2中為根端口。SwitchD的另一個(gè)端口GE0/0/2,在MSTI1中被阻塞,在MSTI2中被計(jì)算為指定端口。
出處:http://www.rzrgm.cn/zhangwencheng
版權(quán):本文版權(quán)歸作者和博客園共有,歡迎轉(zhuǎn)載,但未經(jīng)作者同意必須保留此段聲明,且在文章頁(yè)面明顯位置給出 原文鏈接
浙公網(wǎng)安備 33010602011771號(hào)