VRRP與MSTP綜合組網配置舉例
Copyright © 2013杭州華三通信技術有限公司 版權所有,保留一切權利。 非經本公司書麵許可,任何單位和個人不得擅自摘抄、複製本文檔內容的部分或全部, 並不得以任何形式傳播。本文檔中的信息可能變動,恕不另行通知。 |
目 錄
VRRP用來為網關設備提供冗餘備份。如圖1-1所示,VRRP將可以承擔網關功能的一組設備加入到備份組中,形成一台虛擬路由器,局域網內的主機將此虛擬路由器設置為缺省網關。VRRP根據優先級從備份組中選舉出一台網關設備作為Master,負責轉發局域網內主機與外部通信的流量,其他網關設備作為Backup。當Master出現故障後,VRRP重新選舉新的Master,保證流量轉發不會中斷。
VRRP可以監視上行接口或鏈路的狀態。當路由器的上行接口或鏈路出現故障時,該路由器主動降低自己的優先級,使得備份組內其它路由器的優先級高於這個路由器,以避免這個路由器成為Master,導致流量轉發失敗。
MSTP是在STP的基礎上發展而來的,用於在局域網中消除數據鏈路層的物理環路。作為一種二層管理協議,MSTP通過選擇性地阻塞網絡中的冗餘鏈路來消除二層環路,將環路網絡結構修剪成無環路的樹型網絡結構,從而防止報文在環路網絡中不斷增生和無限循環,避免設備由於重複接收相同報文而造成報文處理能力的下降;同時,它還具備鏈路備份的功能。與STP相比,MSTP可以實現網絡拓撲的快速收斂,也能使不同VLAN的流量沿各自的路徑轉發,從而為冗餘鏈路提供了更好的負載分擔機製。
單獨使用VRRP為網關提供冗餘備份的組網方式如圖1-2所示:局域網內的主機通過二層交換機接入兩台網關設備Device A和Device B,Device A和Device B構成一台虛擬路由器,為網關提供冗餘備份,以提高網關設備的可靠性。這種組網方式雖然可以防止網關的單點故障,但是仍然存在以下問題:
· 不能防禦所有的鏈路故障。例如,鏈路a和鏈路c同時發生故障時,局域網內的主機將無法與外界通信。
· 鏈路a或鏈路b出現故障時,即使Master正常工作,也會導致Backup接收不到Master發送的VRRP通告報文,從而錯誤地認為Master出現故障,進行Master和Backup狀態切換。
圖1-3 VRRP與MSTP配合使用提高網絡可靠性
VRRP與MSTP配合使用的組網方式如圖1-3所示:在Device A和Device B之間增加心跳線(鏈路e)為下行鏈路提供冗餘備份,並使用MSTP技術阻塞網絡中的冗餘鏈路以消除二層環路。采用這種組網方式,不僅可以為網關設備提供冗餘備份,還可以為下行的二層鏈路提供冗餘備份,極大地提高了網絡的可靠性。VRRP與MSTP配合使用的組網方式具有以下優勢:
· 可以防禦多種鏈路故障。隻要上行鏈路(鏈路c和鏈路d)、下行鏈路(鏈路a和鏈路b)中各有一條可達鏈路,即可保證通信不會中斷。例如,Device A作為Master時,如果鏈路a和鏈路c同時出現故障,則通過鏈路b—鏈路e—鏈路d這條路徑轉發流量;如果鏈路a和鏈路d同時出現故障,則通過VRRP監視上行接口或鏈路功能降低Device A的優先級,使得Device B成為Master,流量通過鏈路b—鏈路c這條路徑轉發;如果鏈路a和鏈路e同時出現故障,則Device B接收不到Device A的通告報文,使得Device B成為Master,流量通過鏈路b—鏈路c這條路徑轉發。
· 通過在Device A和Device B之間增加心跳線,避免鏈路a或鏈路b出現故障、網關正常工作時錯誤地進行Master和Backup狀態切換。
在VRRP與MSTP配合使用的組網方式中,心跳線鏈路e通常為聚合鏈路,以提高可靠性。
本文檔不嚴格與具體軟、硬件版本對應,如果使用過程中與產品實際情況有差異,請參考相關產品手冊,或以設備實際情況為準。
本文檔中的配置均是在實驗室環境下進行的配置和驗證,配置前設備的所有參數均采用出廠時的缺省配置。如果您已經對設備進行了配置,為了保證配置效果,請確認現有配置和以下舉例中的配置不衝突。
· 局域網中采用VRRP技術進行網關設備的備份,提高網關的可靠性。當一台網關設備出現故障時,局域網內的主機仍然可以通過另一台網關設備訪問外部網絡。
· 在網關設備工作正常時,區域A用戶通過網關設備Switch A進行數據轉發;區域B用戶通過網關設備Switch B進行數據轉發,實現流量的負載分擔。
· 當網關設備的上行鏈路出現故障時,降低該網關設備的優先級,以避免該網關設備成為Master,導致流量轉發中斷。
· 局域網內進行二層鏈路的冗餘備份,保證網關設備下行鏈路故障時,流量轉發不會中斷。使用MSTP技術避免二層網絡中出現環路。
· 網關設備通過核心層的出口設備Switch E與Internet連接。
通常情況下,核心層會部署多台出口設備,以提高網絡的可靠性。為了簡化配置過程,本文僅以一台出口設備為例,說明出口設備的配置方法。多台出口設備時,配置方法與此類似。
圖1-4 VRRP與MSTP綜合配置組網圖
接口 | IP地址 | 設備 | 接口 | IP地址 | |
Switch A | Vlan-int101 | 10.1.1.2/24 | Switch B | Vlan-int101 | 10.1.1.3/24 |
| Vlan-int102 | 10.2.1.2/24 |
| Vlan-int102 | 10.2.1.3/24 |
| Vlan-int1000 | 100.0.0.2/24 |
| Vlan-int2000 | 200.0.0.2/24 |
| Virtual IP 1 | 10.1.1.1/24 |
| Virtual IP 1 | 10.1.1.1/24 |
| Virtual IP 2 | 10.2.1.1/24 |
| Virtual IP 2 | 10.2.1.1/24 |
Switch E | Vlan-int1000 | 100.0.0.1/24 |
|
|
|
| Vlan-int2000 | 200.0.0.1/24 |
|
|
|
| Vlan-int3000 | 30.0.0.1/24 |
|
|
|
實現上述組網需求,需要進行如下配置:
· Switch A、Switch B上分別創建兩個VRRP備份組。
· 配置Switch A在備份組1內具有更高的優先級,即正常情況下Switch A作為備份組1的Master設備;配置Switch B在備份組2內具有更高的優先級,即正常情況下Switch B作為備份組2的Master設備。
· 區域A內的主機將備份組1的虛擬IP地址設置為網關,區域B內的主機將備份組2的虛擬IP地址設置為網關。從而保證在網關設備工作正常時,區域A用戶通過網關設備Switch A進行數據轉發,區域B用戶通過網關設備Switch B進行數據轉發,實現流量的負載分擔。
· Switch A、Switch B上分別配置VRRP備份組監視上行接口,當上行接口出現故障時,降低路由器在備份組中的優先級。
· Switch A、Switch B和二層交換機之間啟用MSTP多實例,並在各實例中指定根橋和備份根橋。
· 在Switch A、Switch B和Switch E之間配置OSPF路由協議。Switch A和Switch B通過OSPF發布區域A和區域B所在網段的路由,以實現區域A與區域B內主機與外部網絡的三層互通。並在Switch A和Switch B上合理配置路由的Cost值,以便內網訪問外網、外網訪問內網的雙向流量通過同一台設備處理。
· Switch A和Switch B之間的鏈路采用聚合鏈路,以提高心跳線的可靠性。
# 配置端口Ethernet1/1屬於VLAN 1000、Ethernet1/3屬於VLAN 102、Ethernet1/4屬於VLAN 101。
<SwitchA> system-view
[SwitchA] vlan 1000
[SwitchA-vlan1000] port ethernet 1/1
[SwitchA-vlan1000] quit
[SwitchA] vlan 101
[SwitchA-vlan101] port ethernet 1/4
[SwitchA-vlan101] quit
[SwitchA] vlan 102
[SwitchA-vlan102] port ethernet 1/3
[SwitchA-vlan102] quit
# 創建二層聚合接口1。
[SwitchA] interface bridge-aggregation 1
[SwitchA-Bridge-Aggregation1] quit
# 分別將端口Ethernet1/2和Ethernet1/5加入到聚合組1中。
[SwitchA] interface ethernet 1/2
[SwitchA-Ethernet1/2] port link-aggregation group 1
[SwitchA-Ethernet1/2] quit
[SwitchA] interface ethernet 1/5
[SwitchA-Ethernet1/5] port link-aggregation group 1
[SwitchA-Ethernet1/5] quit
# 配置二層聚合接口1為Trunk端口,並允許VLAN 101和102的報文通過。
[SwitchA] interface bridge-aggregation 1
[SwitchA-Bridge-Aggregation1] port link-type trunk
[SwitchA-Bridge-Aggregation1] port trunk permit vlan 101 to 102
[SwitchA-Bridge-Aggregation1] undo port trunk permit vlan 1
[SwitchA-Bridge-Aggregation1] port trunk pvid vlan 101
[SwitchA-Bridge-Aggregation1] quit
# 配置上行接口IP地址。
[SwitchA] interface vlan-interface 1000
[SwitchA-Vlan-interface1000] ip address 100.0.0.2 24
[SwitchA-Vlan-interface1000] quit
# 創建Track項1,監視上行接口的物理狀態。
[SwitchA] track 1 interface vlan-interface 1000
# 創建VRRP備份組1,配置Switch A在備份組1中的優先級為110。
[SwitchA] interface vlan-interface 101
[SwitchA-Vlan-interface101] ip address 10.1.1.2 24
[SwitchA-Vlan-interface101] vrrp vrid 1 virtual-ip 10.1.1.1
[SwitchA-Vlan-interface101] vrrp vrid 1 priority 110
# 配置VRRP備份組1監視Track項1的狀態。當Track項狀態為Negative(即上行接口的物理狀態為down)時,Switch A在備份組1的優先級降低20,使得Switch B的優先級高於Switch A,Switch B成為Master。
[SwitchA-Vlan-interface101] vrrp vrid 1 track 1 reduced 20
[SwitchA-Vlan-interface101] quit
# 創建VRRP備份組2。
[SwitchA] interface vlan-interface 102
[SwitchA-Vlan-interface102] ip address 10.2.1.2 24
[SwitchA-Vlan-interface102] vrrp vrid 1 virtual-ip 10.2.1.1
[SwitchA–Vlan-interface102] quit
# 配置MSTP。
[SwitchA] stp region-configuration
[SwitchA-mst-region] region-name vrrp
[SwitchA-mst-region] instance 1 vlan 101
[SwitchA-mst-region] instance 2 vlan 102
[SwitchA-mst-region] active region-configuration
[SwitchA-mst-region] quit
[SwitchA] stp instance 1 root primary
[SwitchA] stp instance 2 root secondary
[SwitchA] stp enable
# 在上行接口上關閉STP功能。
[SwitchA] interface ethernet 1/1
[SwitchA-Ethernet1/1] undo stp enable
[SwitchA-Ethernet1/1] quit
# 配置OSPF發布網段路由。
[SwitchA] ospf
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 100.0.0.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] network 10.2.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] quit
[SwitchA-ospf-1] quit
# 配置接口Vlan-int102的路由Cost值為5,以便外網訪問區域B的報文優先通過Switch B轉發。
[SwitchA] interface vlan-interface 102
[SwitchA-Vlan-interface102] ospf cost 5
[SwitchA-Vlan-interface102] quit
# 配置端口Ethernet1/1屬於VLAN 2000、Ethernet1/3屬於VLAN 102、Ethernet1/4屬於VLAN 101。
<SwitchB> system-view
[SwitchB] vlan 2000
[SwitchB-vlan2000] port ethernet 1/1
[SwitchB-vlan2000] quit
[SwitchB] vlan 101
[SwitchB-vlan101] port ethernet 1/4
[SwitchB-vlan101] quit
[SwitchB] vlan 102
[SwitchB-vlan102] port ethernet 1/3
[SwitchB-vlan102] quit
# 創建二層聚合接口1。
[SwitchB] interface bridge-aggregation 1
[SwitchB-Bridge-Aggregation1] quit
# 分別將端口Ethernet1/2和Ethernet1/5加入到聚合組1中。
[SwitchB] interface ethernet 1/2
[SwitchB-Ethernet1/2] port link-aggregation group 1
[SwitchB-Ethernet1/2] quit
[SwitchB] interface ethernet 1/5
[SwitchB-Ethernet1/5] port link-aggregation group 1
[SwitchB-Ethernet1/5] quit
# 配置二層聚合接口1為Trunk端口,並允許VLAN 101和102的報文通過。
[SwitchB] interface bridge-aggregation 1
[SwitchB-Bridge-Aggregation1] port link-type trunk
[SwitchB-Bridge-Aggregation1] port trunk permit vlan 101 to 102
[SwitchB-Bridge-Aggregation1] undo port trunk permit vlan 1
[SwitchB-Bridge-Aggregation1] port trunk pvid vlan 101
[SwitchB-Bridge-Aggregation1] quit
# 配置上行接口IP地址。
[SwitchB] interface vlan-interface 2000
[SwitchB-Vlan-interface2000] ip address 200.0.0.2 24
[SwitchB-Vlan-interface2000] quit
# 創建Track項1,監視上行接口的物理狀態。
[SwitchB] track 1 interface vlan-interface 2000
# 創建VRRP備份組1。
[SwitchB] interface vlan-interface 101
[SwitchB-Vlan-interface101] ip address 10.1.1.3 24
[SwitchB-Vlan-interface101] vrrp vrid 1 virtual-ip 10.1.1.1
[SwitchB–Vlan-interface101] quit
# 創建VRRP備份組2,配置Switch B在備份組2中的優先級為110。
[SwitchB] interface vlan-interface 102
[SwitchB-Vlan-interface102] ip address 10.2.1.3 24
[SwitchB-Vlan-interface102] vrrp vrid 1 virtual-ip 10.2.1.1
[SwitchB-Vlan-interface102] vrrp vrid 1 priority 110
# 配置VRRP備份組2監視Track項1的狀態。當Track項狀態為Negative(即上行接口的物理狀態為down)時,Switch B在備份組2的優先級降低20,使得Switch A的優先級高於Switch B,Switch A成為Master。
[SwitchB-Vlan-interface102] vrrp vrid 1 track 1 reduced 20
[SwitchB-Vlan-interface102] quit
# 配置MSTP。
[SwitchB] stp region-configuration
[SwitchB-mst-region] region-name vrrp
[SwitchB-mst-region] instance 1 vlan 101
[SwitchB-mst-region] instance 2 vlan 102
[SwitchB-mst-region] active region-configuration
[SwitchB-mst-region] quit
[SwitchB] stp instance 2 root primary
[SwitchB] stp instance 1 root secondary
[SwitchB] stp enable
# 在上行接口上關閉STP功能。
[SwitchB] interface ethernet 1/1
[SwitchB-Ethernet1/1] undo stp enable
[SwitchB-Ethernet1/1] quit
# 配置OSPF發布網段路由。
[SwitchB] ospf
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 200.0.0.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] network 10.2.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
[SwitchB-ospf-1] quit
# 配置接口Vlan-int101的路由Cost值為5,以便外網訪問區域A的報文優先通過Switch A轉發。
[SwitchB] interface vlan-interface 101
[SwitchB-Vlan-interface102] ospf cost 5
[SwitchB-Vlan-interface102] quit
# 配置VLAN 101。
<SwitchC> system-view
[SwitchC] vlan 101
[SwitchC-vlan101] port ethernet 1/1 to ethernet 1/3
[SwitchC-vlan101] quit
# 配置MSTP。
[SwitchC] stp region-configuration
[SwitchC-mst-region] region-name vrrp
[SwitchC-mst-region] instance 1 vlan 101
[SwitchC-mst-region] instance 2 vlan 102
[SwitchC-mst-region] active region-configuration
[SwitchC-mst-region] quit
[SwitchC] stp enable
# 配置VLAN 102。
<SwitchD> system-view
[SwitchD] vlan 102
[SwitchD-vlan102] port ethernet 1/1 to ethernet 1/3
[SwitchD-vlan102] quit
# 配置MSTP。
[SwitchD] stp region-configuration
[SwitchD-mst-region] region-name vrrp
[SwitchD-mst-region] instance 1 vlan 101
[SwitchD-mst-region] instance 2 vlan 102
[SwitchD-mst-region] active region-configuration
[SwitchD-mst-region] quit
[SwitchD] stp enable
# 配置VLAN 1000。
<SwitchE> system-view
[SwitchE] vlan 1000
[SwitchE-vlan1000] port ethernet 1/1
[SwitchE-vlan1000] quit
# 配置接口Vlan-int1000的IP地址。
[SwitchE] interface vlan-interface 1000
[SwitchE-Vlan-interface1000] ip address 100.0.0.1 24
[SwitchE-Vlan-interface1000] quit
# 配置VLAN 2000。
[SwitchE] vlan 2000
[SwitchE-vlan2000] port ethernet 1/2
[SwitchE-vlan2000] quit
# 配置接口Vlan-int2000的IP地址。
[SwitchE] interface vlan-interface 2000
[SwitchE-Vlan-interface2000] ip address 200.0.0.1 24
[SwitchE-Vlan-interface2000] quit
# 配置VLAN 3000。
[SwitchE] vlan 3000
[SwitchE-vlan3000] port ethernet 1/3
[SwitchE-vlan3000] quit
# 配置接口Vlan-int3000的IP地址。
[SwitchE] interface vlan-interface 3000
[SwitchE-Vlan-interface3000] ip address 30.0.0.1 24
[SwitchE-Vlan-interface3000] quit
# 配置OSPF發布網段路由。
[SwitchE] ospf
[SwitchE-ospf-1] area 0
[SwitchE-ospf-1-area-0.0.0.0] network 100.0.0.0 0.0.0.255
[SwitchE-ospf-1-area-0.0.0.0] network 200.0.0.0 0.0.0.255
[SwitchE-ospf-1-area-0.0.0.0] network 30.0.0.0 0.0.0.255
[SwitchE-ospf-1-area-0.0.0.0] quit
[SwitchE-ospf-1] quit
配置區域A內主機的缺省網關為10.1.1.1,區域B內主機的缺省網關為10.2.1.1,具體配置過程略。
(1) 網關設備和鏈路均正常工作時,驗證局域網內主機是否可以與外部網絡通信
# 在Switch A和Switch B上查看VRRP備份組的信息。可以看到Switch A在備份組1中為Master,Switch B在備份組2中為Master,從而保證區域A的主機通過Switch A與外部通信,區域B的主機通過Switch B與外部通信。
<SwitchA> display vrrp
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 2
Interface VRID State Run Adver Auth Virtual
Pri Timer Type IP
---------------------------------------------------------------------
Vlan101 1 Master 110 1 None 10.1.1.1
Vlan102 1 Backup 100 1 None 10.2.1.1
<SwitchB> display vrrp
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 2
Interface VRID State Run Adver Auth Virtual
Pri Timer Type IP
---------------------------------------------------------------------
Vlan101 1 Backup 100 1 None 10.1.1.1
Vlan102 1 Master 110 1 None 10.2.1.1
# 在Switch C上查看生成樹狀態。可以看到端口Ethernet1/2為替換端口,不可以轉發流量,從而避免環路。
<SwitchC> display stp brief
MSTID Port Role STP State Protection
1 Ethernet1/1 ROOT FORWARDING NONE
1 Ethernet1/2 ALTE DISCARDING NONE
1 Ethernet1/3 DESI FORWARDING NONE
# 在Switch D上查看生成樹狀態。可以看到端口Ethernet1/1為替換端口,不可以轉發流量,從而避免環路。
<SwitchD> display stp brief
MSTID Port Role STP State Protection
2 Ethernet1/1 ALTE DISCARDING NONE
2 Ethernet1/2 ROOT FORWARDING NONE
2 Ethernet1/3 DESI FORWARDING NONE
# 在區域A和區域B的主機上ping 30.0.0.1,可以ping通。
C:\> ping 30.0.0.1
Pinging 30.0.0.1 with 32 bytes of data:
Reply from 30.0.0.1: bytes=32 time=19ms TTL=254
Reply from 30.0.0.1: bytes=32 time<1ms TTL=254
Reply from 30.0.0.1: bytes=32 time<1ms TTL=254
Reply from 30.0.0.1: bytes=32 time<1ms TTL=254
Ping statistics for 30.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 19ms, Average = 4ms
# 在Switch A、Switch B和Switch E上開啟ICMP超時報文發送功能。
<SwitchA> system-view
[SwitchA] ip ttl-expires enable
<SwitchB> system-view
[SwitchB] ip ttl-expires enable
<SwitchE> system-view
[SwitchE] ip ttl-expires enable
# 在區域A內IP地址為10.1.1.4的主機上查看到達30.0.0.1的報文所經過的路徑。可以看出,區域A內訪問外網的報文通過Switch A轉發。
C:\> tracert 30.0.0.1
Tracing route to 30.0.0.1 over a maximum of 30 hops
1 23 ms 1 ms 1 ms 10.1.1.2
2 <1 ms <1 ms <1 ms 30.0.0.1
Trace complete.
# 在區域B內IP地址為10.2.1.4的主機上查看到達30.0.0.1的報文所經過的路徑。可以看出,區域B內訪問外網的報文通過Switch B轉發。
C:\> tracert 30.0.0.1
Tracing route to 30.0.0.1 over a maximum of 30 hops
1 13 ms 1 ms 1 ms 10.2.1.3
2 <1 ms <1 ms <1 ms 30.0.0.1
Trace complete.
# 在Switch E上查看到達10.1.1.4(區域A內某主機的IP地址)的報文所經過的路徑。可以看出,外網訪問區域A內主機的報文通過Switch A轉發。
[SwitchE] tracert 10.1.1.4
traceroute to 10.1.1.4(10.1.1.4) 30 hops max,40 bytes packet, press CTRL_C to break
1 100.0.0.2 2 ms 1 ms 1 ms
2 10.1.1.4 <1 ms 1 ms 1 ms
# 在Switch E上查看到達10.2.1.4(區域B內某主機的IP地址)的報文所經過的路徑。可以看出,外網訪問區域B內主機的報文通過Switch B轉發。
[SwitchE] tracert 10.2.1.4
traceroute to 10.2.1.4(10.2.1.4) 30 hops max,40 bytes packet, press CTRL_C to break
1 200.0.0.2 1 ms 2 ms 1 ms
2 10.2.1.4 1 ms 1 ms 1 ms
(2) 一台網關設備出現故障後,驗證局域網內主機是否可以與外部網絡通信
# 保存當前配置後,重啟Switch A。
<SwitchA> save config.cfg
The current configuration will be saved to flash:/config.cfg. Continue? [Y/N]:y
flash:/config.cfg exists, overwrite? [Y/N]:y
Now saving current configuration to the device.
Saving configuration flash:/config.cfg. Please wait...
.........................
Configuration is saved to flash successfully.
<SwitchA> reboot
Start to check configuration with next startup configuration file, please wait.
........DONE!
This command will reboot the device. Continue? [Y/N]:y
# 在Switch B上查看VRRP備份組的信息。可以看到Switch B在備份組1和備份組2中均為Master,區域A和區域B的流量均通過Switch B轉發。
<SwitchB> display vrrp
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 2
Interface VRID State Run Adver Auth Virtual
Pri Timer Type IP
---------------------------------------------------------------------
Vlan101 1 Master 100 1 None 10.1.1.1
Vlan102 1 Master 110 1 None 10.2.1.1
# 在區域A和區域B的主機上ping 30.0.0.1,均可以ping通。(具體驗證過程略)
# 在區域A內IP地址為10.1.1.4的主機上查看到達30.0.0.1的報文所經過的路徑。可以看出,區域A內訪問外網的報文通過Switch B轉發。
C:\> tracert 30.0.0.1
Tracing route to 30.0.0.1 over a maximum of 30 hops
1 12 ms 1 ms 1 ms 10.1.1.3
2 <1 ms <1 ms <1 ms 30.0.0.1
Trace complete.
# 在區域B內IP地址為10.2.1.4的主機上查看到達30.0.0.1的報文所經過的路徑。可以看出,區域B內訪問外網的報文通過Switch B轉發。
C:\> tracert 30.0.0.1
Tracing route to 30.0.0.1 over a maximum of 30 hops
1 23 ms 1 ms 1 ms 10.2.1.3
2 <1 ms <1 ms <1 ms 30.0.0.1
Trace complete.
# 在Switch E上查看到達10.1.1.4(區域A內某主機的IP地址)的報文所經過的路徑。可以看出,外網訪問區域A內主機的報文通過Switch B轉發。
<SwitchE> tracert 10.1.1.4
traceroute to 10.1.1.4(10.1.1.4) 30 hops max,40 bytes packet, press CTRL_C to break
1 200.0.0.2 1 ms 1 ms 1 ms
2 10.1.1.4 1 ms 1 ms 1 ms
# 在Switch E上查看到達10.2.1.4(區域B內某主機的IP地址)的報文所經過的路徑。可以看出,外網訪問區域B內主機的報文通過Switch B轉發。
<SwitchE> tracert 10.2.1.4
traceroute to 10.2.1.4(10.2.1.4) 30 hops max,40 bytes packet, press CTRL_C to break
1 200.0.0.2 1 ms 2 ms 1 ms
2 10.2.1.4 1 ms 1 ms 1 ms
(3) 鏈路出現故障時,驗證局域網內主機是否可以與外部網絡通信
區域A和區域B的網絡是對稱的,此處僅以區域A為例,驗證鏈路出現故障時,局域網內主機是否可以與外部網絡通信。為了簡化描述,對區域A與外部網絡通信過程中涉及的鏈路進行命名,如圖1-5所示。
圖1-5 區域A與外部通信的網絡
· 鏈路a和鏈路c同時出現故障時,驗證局域網內主機是否可以與外部網絡通信
# 在Switch A上關閉接口Ethernet1/4。
<SwitchA> system-view
[SwitchA] interface ethernet 1/4
[SwitchA-Ethernet1/4] shutdown
[SwitchA-Ethernet1/4] quit
# 在Switch B上關閉接口Ethernet1/1。
<SwitchB> system-view
[SwitchB] interface ethernet 1/1
[SwitchB-Ethernet1/1] shutdown
[SwitchB-Ethernet1/1] quit
# 在Switch A和Switch B上查看VRRP備份組的信息。可以看到由於上行接口故障,Switch B在備份組2中的優先級降低為90。Switch A在備份組1和備份組2中均為Master,區域A和區域B的流量均通過Switch A轉發。
[SwitchA] display vrrp
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 2
Interface VRID State Run Adver Auth Virtual
Pri Timer Type IP
---------------------------------------------------------------------
Vlan101 1 Master 110 1 None 10.1.1.1
Vlan102 1 Master 100 1 None 10.2.1.1
[SwitchB] display vrrp
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 2
Interface VRID State Run Adver Auth Virtual
Pri Timer Type IP
---------------------------------------------------------------------
Vlan101 1 Backup 100 1 None 10.1.1.1
Vlan102 1 Backup 90 1 None 10.2.1.1
# 在Switch C上查看生成樹狀態。可以看到端口Ethernet1/2變為根端口,可以轉發流量。
<SwitchC> display stp brief
MSTID Port Role STP State Protection
1 Ethernet1/2 ROOT FORWARDING NONE
1 Ethernet1/3 DESI FORWARDING NONE
# 在區域A的主機上ping 30.0.0.1,可以ping通。(具體驗證過程略)
# 在區域A內IP地址為10.1.1.4的主機上查看到達30.0.0.1的報文所經過的路徑。可以看出,區域A內訪問外網的報文通過Switch A轉發。
C:\> tracert 30.0.0.1
Tracing route to 30.0.0.1 over a maximum of 30 hops
1 12 ms 1 ms 1 ms 10.1.1.2
2 <1 ms <1 ms <1 ms 30.0.0.1
Trace complete.
# 在Switch E上查看到達10.1.1.4(區域A內某主機的IP地址)的報文所經過的路徑。可以看出,外網訪問區域A內主機的報文通過Switch A轉發。
<SwitchE> tracert 10.1.1.4
traceroute to 10.1.1.4(10.1.1.4) 30 hops max,40 bytes packet, press CTRL_C to break
1 100.0.0.2 2 ms 2 ms 1 ms
2 10.1.1.4 1 ms 1 ms 1 ms
· 鏈路a和鏈路d同時出現故障時,驗證局域網內主機是否可以與外部網絡通信
# 在Switch A上關閉接口Ethernet1/1和Ethernet1/4。
<SwitchA> system-view
[SwitchA] interface ethernet 1/1
[SwitchA-Ethernet1/1] shutdown
[SwitchA-Ethernet1/1] quit
[SwitchA] interface ethernet 1/4
[SwitchA-Ethernet1/4] shutdown
[SwitchA-Ethernet1/4] quit
# 在Switch A和Switch B上查看VRRP備份組的信息。可以看到由於上行接口故障,Switch A在備份組1中的優先級降低為90。Switch B在備份組1和備份組2中均為Master,區域A和區域B的流量均通過Switch B轉發。
[SwitchA] display vrrp
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 2
Interface VRID State Run Adver Auth Virtual
Pri Timer Type IP
---------------------------------------------------------------------
Vlan101 1 Backup 90 1 None 10.1.1.1
Vlan102 1 Backup 100 1 None 10.2.1.1
[SwitchB] display vrrp
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 2
Interface VRID State Run Adver Auth Virtual
Pri Timer Type IP
---------------------------------------------------------------------
Vlan101 1 Master 100 1 None 10.1.1.1
Vlan102 1 Master 110 1 None 10.2.1.1
# 在Switch C上查看生成樹狀態。可以看到端口Ethernet1/2為根端口,可以轉發流量。
<SwitchC> display stp brief
MSTID Port Role STP State Protection
1 Ethernet1/2 ROOT FORWARDING NONE
1 Ethernet1/3 DESI FORWARDING NONE
# 在區域A的主機上ping 30.0.0.1,可以ping通。(具體驗證過程略)
# 在區域A內IP地址為10.1.1.4的主機上查看到達30.0.0.1的報文所經過的路徑。可以看出,區域A內訪問外網的報文通過Switch B轉發。
C:\> tracert 30.0.0.1
Tracing route to 30.0.0.1 over a maximum of 30 hops
1 12 ms 1 ms 1 ms 10.1.1.3
2 1 ms <1 ms <1 ms 30.0.0.1
Trace complete.
# 在Switch E上查看到達10.1.1.4(區域A內某主機的IP地址)的報文所經過的路徑。可以看出,外網訪問區域A內主機的報文通過Switch B轉發。
<SwitchE> tracert 10.1.1.4
traceroute to 10.1.1.4(10.1.1.4) 30 hops max,40 bytes packet, press CTRL_C to break
1 200.0.0.2 2 ms 1 ms 1 ms
2 10.1.1.4 <1 ms 1 ms 2 ms
· 鏈路a和鏈路e同時出現故障時,驗證局域網內主機是否可以與外部網絡通信
# 在Switch A上關閉接口Ethernet1/4和二層聚合接口1。
<SwitchA> system-view
[SwitchA] interface ethernet 1/4
[SwitchA-Ethernet1/4] shutdown
[SwitchA-Ethernet1/4] quit
[SwitchA] interface bridge-aggregation 1
[SwitchA-Bridge-Aggregation1] shutdown
[SwitchA-Bridge-Aggregation1] quit
# 在Switch B上查看VRRP備份組的信息。可以看到Switch B在備份組1和備份組2中均為Master,區域A和區域B的流量均通過Switch B轉發。
[SwitchB] display vrrp
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 2
Interface VRID State Run Adver Auth Virtual
Pri Timer Type IP
---------------------------------------------------------------------
Vlan101 1 Master 100 1 None 10.1.1.1
Vlan102 1 Master 110 1 None 10.2.1.1
# 在區域A的主機上ping 30.0.0.1,可以ping通。(具體驗證過程略)
# 在區域A內IP地址為10.1.1.4的主機上查看到達30.0.0.1的報文所經過的路徑。可以看出,區域A內訪問外網的報文通過Switch B轉發。
C:\> tracert 30.0.0.1
Tracing route to 30.0.0.1 over a maximum of 30 hops
1 12 ms 1 ms 1 ms 10.1.1.3
2 <1 ms <1 ms <1 ms 30.0.0.1
Trace complete.
# 在Switch E上查看到達10.1.1.4(區域A內某主機的IP地址)的報文所經過的路徑。可以看出,外網訪問區域A內主機的報文通過Switch B轉發。
<SwitchE> tracert 10.1.1.4
traceroute to 10.1.1.4(10.1.1.4) 30 hops max,40 bytes packet, press CTRL_C to break
1 200.0.0.2 2 ms 2 ms 2 ms
2 10.1.1.4 1 ms 1 ms <1 ms
· 鏈路d和鏈路e同時出現故障時,驗證局域網內主機是否可以與外部網絡通信
# 在Switch A上關閉接口Ethernet1/1和二層聚合接口1。
<SwitchA> system-view
[SwitchA] interface ethernet 1/1
[SwitchA-Ethernet1/1] shutdown
[SwitchA-Ethernet1/1] quit
[SwitchA] interface bridge-aggregation 1
[SwitchA-Bridge-Aggregation1] shutdown
[SwitchA-Bridge-Aggregation1] quit
# 在Switch A和Switch B上查看VRRP備份組的信息。可以看到由於上行接口故障,Switch A在備份組1中的優先級降低為90。Switch B在備份組1和備份組2中均為Master,區域A和區域B的流量均通過Switch B轉發。
[SwitchA] display vrrp
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 2
Interface VRID State Run Adver Auth Virtual
Pri Timer Type IP
---------------------------------------------------------------------
Vlan101 1 Backup 90 1 None 10.1.1.1
Vlan102 1 Backup 100 1 None 10.2.1.1
[SwitchB] display vrrp
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 2
Interface VRID State Run Adver Auth Virtual
Pri Timer Type IP
---------------------------------------------------------------------
Vlan101 1 Master 100 1 None 10.1.1.1
Vlan102 1 Master 110 1 None 10.2.1.1
# 在Switch C上查看生成樹狀態。可以看到端口Ethernet1/2為指定端口,可以轉發流量。
<SwitchC> display stp brief
MSTID Port Role STP State Protection
1 Ethernet1/1 ROOT FORWARDING NONE
1 Ethernet1/2 DESI FORWARDING NONE
1 Ethernet1/3 DESI FORWARDING NONE
# 在區域A的主機上ping 30.0.0.1,可以ping通。(具體驗證過程略)
# 在區域A內IP地址為10.1.1.4的主機上查看到達30.0.0.1的報文所經過的路徑。可以看出,區域A內訪問外網的報文通過Switch B轉發。
C:\> tracert 30.0.0.1
Tracing route to 30.0.0.1 over a maximum of 30 hops
1 12 ms 1 ms 8 ms 10.1.1.3
2 1 ms <1 ms <1 ms 30.0.0.1
Trace complete.
# 在Switch E上查看到達10.1.1.4(區域A內某主機的IP地址)的報文所經過的路徑。可以看出,外網訪問區域A內主機的報文通過Switch B轉發。
<SwitchE> tracert 10.1.1.4
traceroute to 10.1.1.4(10.1.1.4) 30 hops max,40 bytes packet, press CTRL_C to break
1 200.0.0.2 2 ms 2 ms 2 ms
2 10.1.1.4 1 ms 1 ms <1 ms
· 設備A:
#
vlan 101 to 102
#
vlan 1000
#
stp region-configuration
region-name vrrp
instance 1 vlan 101
instance 2 vlan 102
active region-configuration
#
stp instance 1 root primary
stp instance 2 root secondary
stp enable
#
interface Bridge-Aggregation1
port link-type trunk
undo port trunk permit vlan 1
port trunk permit vlan 101 to 102
port trunk pvid vlan 101
#
interface Vlan-interface101
ip address 10.1.1.2 255.255.255.0
vrrp vrid 1 virtual-ip 10.1.1.1
vrrp vrid 1 priority 110
vrrp vrid 1 track 1 reduced 20
#
interface Vlan-interface102
ip address 10.2.1.2 255.255.255.0
ospf cost 5
vrrp vrid 1 virtual-ip 10.2.1.1
#
interface Vlan-interface1000
ip address 100.0.0.2 255.255.255.0
#
interface Ethernet1/1
port link-mode bridge
port access vlan 1000
stp disable
#
interface Ethernet1/2
port link-mode bridge
port link-type trunk
undo port trunk permit vlan 1
port trunk permit vlan 101 to 102
port trunk pvid vlan 101
port link-aggregation group 1
#
interface Ethernet1/3
port link-mode bridge
port access vlan 102
#
interface Ethernet1/4
port link-mode bridge
port access vlan 101
#
interface Ethernet1/5
port link-mode bridge
port link-type trunk
undo port trunk permit vlan 1
port trunk permit vlan 101 to 102
port trunk pvid vlan 101
port link-aggregation group 1
#
ospf 1
area 0.0.0.0
network 100.0.0.0 0.0.0.255
network 10.1.1.0 0.0.0.255
network 10.2.1.0 0.0.0.255
#
track 1 interface Vlan-interface1000
#
· 設備B :
#
vlan 101 to 102
#
vlan 2000
#
stp region-configuration
region-name vrrp
instance 1 vlan 101
instance 2 vlan 102
active region-configuration
#
stp instance 1 root secondary
stp instance 2 root primary
stp enable
#
interface Bridge-Aggregation1
port link-type trunk
undo port trunk permit vlan 1
port trunk permit vlan 101 to 102
port trunk pvid vlan 101
#
interface Vlan-interface101
ip address 10.1.1.3 255.255.255.0
ospf cost 5
vrrp vrid 1 virtual-ip 10.1.1.1
#
interface Vlan-interface102
ip address 10.2.1.3 255.255.255.0
vrrp vrid 1 virtual-ip 10.2.1.1
vrrp vrid 1 priority 110
vrrp vrid 1 track 1 reduced 20
#
interface Vlan-interface2000
ip address 200.0.0.2 255.255.255.0
#
interface Ethernet1/1
port link-mode bridge
port access vlan 2000
stp disable
#
interface Ethernet1/2
port link-mode bridge
port link-type trunk
undo port trunk permit vlan 1
port trunk permit vlan 101 to 102
port trunk pvid vlan 101
port link-aggregation group 1
#
interface Ethernet1/3
port link-mode bridge
port access vlan 102
#
interface Ethernet1/4
port link-mode bridge
port access vlan 101
#
interface Ethernet1/5
port link-mode bridge
port link-type trunk
undo port trunk permit vlan 1
port trunk permit vlan 101 to 102
port trunk pvid vlan 101
port link-aggregation group 1
#
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.2.1.0 0.0.0.255
network 200.0.0.0 0.0.0.255
#
track 1 interface Vlan-interface2000
#
· 設備C:
#
vlan 101
#
stp region-configuration
region-name vrrp
instance 1 vlan 101
instance 2 vlan 102
active region-configuration
#
stp enable
#
interface Ethernet1/1
port link-mode bridge
port access vlan 101
#
interface Ethernet1/2
port link-mode bridge
port access vlan 101
#
interface Ethernet1/3
port link-mode bridge
port access vlan 101
#
· 設備D:
#
vlan 102
#
stp region-configuration
region-name vrrp
instance 1 vlan 101
instance 2 vlan 102
active region-configuration
#
stp enable
#
interface Ethernet1/1
port link-mode bridge
port access vlan 102
#
interface Ethernet1/2
port link-mode bridge
port access vlan 102
#
interface Ethernet1/3
port link-mode bridge
port access vlan 102
#
· 設備E:
#
vlan 1000
#
vlan 2000
#
vlan 3000
#
interface Vlan-interface1000
ip address 100.0.0.1 255.255.255.0
#
interface Vlan-interface2000
ip address 200.0.0.1 255.255.255.0
#
interface Vlan-interface3000
ip address 30.0.0.1 255.255.255.0
#
interface Ethernet1/1
port link-mode bridge
port access vlan 1000
#
interface Ethernet1/2
port link-mode bridge
port access vlan 2000
#
interface Ethernet1/3
port link-mode bridge
port access vlan 3000
#
ospf 1
area 0.0.0.0
network 100.0.0.0 0.0.0.255
network 200.0.0.0 0.0.0.255
network 30.0.0.0 0.0.0.255
#
· RFC 3768:Virtual Router Redundancy Protocol (VRRP)
· IEEE 802.1s:Virtual Bridged Local Area Networks—Amendment 3: Multiple Spanning Trees