華為交換機MSTP+VRRP配置實例說明文檔
-
拓撲圖
-
IP地址規划表
設備名稱 |
設備接口 |
對端設備 |
對端接口 |
VLAN |
VLAN /接口地址 |
備注 |
SW0 |
GE0/0/23 |
SW2 |
GE0/0/23 |
VLAN200 |
10.0.1.1/24 |
|
GE0/0/24 |
SW1 |
GE0/0/24 |
VLAN100 |
10.0.0.1/24 |
||
SW1 |
GE0/0/24 |
SW0 |
GE0/0/24 |
VLAN100 |
10.0.0.2/24 |
|
GE0/0/11 GE0/0/12 |
SW1 |
GE0/0/11 GE0/0/12 |
VLAN 10:192.168.0.253/24 VLAN 20:192.168.1.253/24 Vir - ip: 192.168.0.254/24 Vir - ip: 192.168.1.254/24 |
鏈路聚合 Eth-trunk1 |
||
GE0/0/13 |
SW4 |
Eth0/0/13 |
||||
GE0/0/1 |
SW3 |
GE0/0/1 |
||||
SW2 |
GE0/0/23 |
SW0 |
GE0/0/23 |
VLAN200 |
10.0.1.2/24 |
|
GE0/0/11 GE0/0/12 |
SW1 |
GE0/0/11 GE0/0/12 |
VLAN 10:192.168.0.253/24 VLAN 20:192.168.1.253/24 Vir - ip: 192.168.0.254/24 Vir - ip: 192.168.1.254/24 |
鏈路聚合 Eth-trunk1 |
||
GE0/0/14 |
SW3 |
Eth0/0/14 |
||||
GE0/0/1 |
SW4 |
GE0/0/1 |
||||
SW3 |
GE0/0/1 |
SW1 |
GE0/0/1 |
|||
Eth0/0/14 |
SW3 |
GE0/0/14 |
||||
Eth0/0/1 |
CLENT1 |
Eth0/0/1 |
||||
SW4 |
GE0/0/1 |
SW2 |
GE0/0/1 |
|||
Eth0/0/13 |
SW1 |
GE0/0/13 |
||||
Eth0/0/1 |
CLENT2 |
Eth0/0/1 |
||||
CLENT1 |
Eth0/0/1 |
SW3 |
Eth0/0/1 |
192.168.0.1/24 |
||
CLENT2 |
Eth0/0/1 |
SW4 |
Eth0/0/1 |
192.168.1.1/24 |
-
MSTP簡介
MSTP(多生成樹協議)是在STP的基礎上發展而來的,用於在局域網中消除數據鏈路層的物理環路,作為一種二層協議,MSTP通過選擇性的阻塞網絡中的冗余鏈路來消除二層環路,將環路網絡結構修剪無環路的樹型網絡結構,從而防止在環路網絡中不斷增生和無限循環,避免設備由於重復接收相同報文造成報文處理能力的下降;同時,它還具備鏈路備份的能力。與STP相比,MSTP可以實現網絡拓撲的快速收斂,也能使不同VLAN的流量沿各自的路徑轉發,從而為冗余鏈路提供了更好的負載分擔機制。
-
VRRP簡介
VRRP用來為網關設備提供冗余備份。VRRP將可以承擔網關功能的一組設備加入到備份組中,形成一台虛擬路由器,局域網內的主機將此虛擬路由器設置為缺省網關。VRRP根據優先級從備份組中選舉一台網關設備作為Master,負責轉發局域網內主機與外部通信的流量,其他網關設備作為Backup。當Master出現故障后,VRRP重新選舉新的Master,保證流量轉發不會中斷。
-
配置腳本說明
[SW0]
<Huawei>sys
//進入特權模式
[Huawei]sysname SW0
//修改主機名
[SW0]vlan batch 100 200
//聲明VLAN 100 200
[SW0]interface Vlanif100
//進入VLAN100的Svi接口模式
[SW0-Vlanif100]ip address 10.0.0.1 255.255.255.0
//配置VLAN100的Svi地址
[SW0-Vlanif100]qu
//退出Svi配置模式
[SW0]interface Vlanif200
//進入VLAN200的Svi接口模式
[SW0-Vlanif200]ip address 10.0.1.1 255.255.255.0
//配置VLAN100的Svi地址
[SW0-Vlanif200]qu
//退出VLAN200的接口配置模式
[SW0]interface GigabitEthernet 0/0/23
//進入到GE0/0/23的接口配置模式
[SW0-GigabitEthernet 0/0/23]port link-type access
//配置GE0/0/23的接口類型為access
[SW0-GigabitEthernet 0/0/23]port default vlan 200
//把GE0/0/23划分到VLAN200
[SW0-GigabitEthernet 0/0/23]qu
//退出GE0/0/23的接口模式
[SW0]interface GigabitEthernet0/0/24
//進入到GE0/0/24的接口配置模式
[SW0-GigabitEthernet 0/0/24]port link-type access
//配置GE0/0/24的接口類型為access
[SW0-GigabitEthernet 0/0/24]port default vlan 100
//把GE0/0/23划分到VLAN100
[SW0-GigabitEthernet 0/0/23]qu
//退出GE0/0/23的接口模式
[SW0]rip 1
//進入到RIP路由協議配置模式
[SW0-rip-1]network 10.0.0.0
//聲明直連網段
[SW0-rip-1]qu
//退出RIP路由協議的配置模式
[SW0]qu
//退出特權模式
<SW0>sa
//保存配置
[SW1]
<Huawei>sys
//進入特權模式
[Huawei]sysname SW1
//修改主機名
[SW1]vlan batch 10 20 100
//聲明VLAN 10 20 100
[SW1]interface Vlanif10
//進入VLAN10的Svi接口模式
[SW1-Vlanif10]ip address 192.168.0.253 255.255.255.0
//配置VLAN10的Svi地址
[SW1-Vlanif10]qu
//退出Svi配置模式
[SW1]interface Vlanif20
//進入VLAN20的Svi接口模式
[SW1-Vlanif20]ip address 192.168.1.253 255.255.255.0
//配置VLAN20的Svi地址
[SW1-Vlanif20]qu
//退出Svi配置模式
[SW1]interface Vlanif100
//進入VLAN100的Svi接口模式
[SW1-Vlanif100]ip address 10.0.0.2 255.255.255.0
//配置VLAN100的Svi地址
[SW1-Vlanif100]qu
//退出Svi配置模式
[SW1]interface Eth-Trunk1
//進入到鏈路聚合配置模式
[SW1-Eth-Trunk1]port link-type trunk
//配置聚合鏈路的鏈路類型為trunk
[SW1-Eth-Trunk1]port trunk allow-pass vlan 2 to 4094
//允許所有VLAN通過鏈路
[SW1-Eth-Trunk1]qu
//退出鏈路聚合配置模式
[SW1]interface GigabitEthernet0/0/1
//進入到GE0/0/1的接口配置模式
[SW1-GigabitEthernet 0/0/1]port link-type trunk
//配置GE0/0/1的鏈路類型為trunk
[SW1-GigabitEthernet 0/0/1]port trunk allow-pass vlan 2 to 4094
//允許所有VLAN通過鏈路
[SW1-GigabitEthernet 0/0/1]qu
//退出GE0/0/1的接口配置模式
[SW1]interface GigabitEthernet0/0/11
//進入到GE0/0/11的接口配置模式
[SW1-GigabitEthernet 0/0/11] eth-trunk 1
//將GE0/0/11加入到聚合鏈路中
[SW1-GigabitEthernet 0/0/11]qu
//退出鏈路接口配置模式
[SW1]interface GigabitEthernet0/0/12
//進入到GE0/0/12的接口配置模式
[SW1-GigabitEthernet 0/0/12]eth-trunk 1
//將GE0/0/12加入到聚合鏈路中
[SW1-GigabitEthernet 0/0/12]qu
//退出GE0/0/12的接口配置模式
[SW1]interface GigabitEthernet0/0/13
//進入到GE0/0/13的接口配置模式
[SW1-GigabitEthernet 0/0/13]port link-type trunk
//配置GE0/0/13的鏈路類型為trunk
[SW1-GigabitEthernet 0/0/13]port trunk allow-pass vlan 2 to 4094
//允許所有VLAN通過鏈路
[SW1-GigabitEthernet 0/0/13]qu
//退出GE0/0/13的接口配置模式
[SW1]interface GigabitEthernet0/0/24
//進入到GE0/0/24的接口配置模式
[SW1-GigabitEthernet 0/0/24]port link-type access
//配置GE0/0/24的鏈路類型為access
[SW1-GigabitEthernet 0/0/24]port default vlan 100
//將GE0/0/24划分到VLAN100
[SW1-GigabitEthernet 0/0/24]qu
//退出GE0/0/24的接口配置模式
【MSTP配置】
[SW1]stp region-configuration
//進入到stp配置模式
[SW1-mst-region] region-name vrrp
//配置MSTP名稱
[SW1-mst-region]instance 1 vlan 10
//將VLAN10映射到實例1
[SW1-mst-region]instance 2 vlan 20
//將VLAN20映射到實例2
[SW1-mst-region]active region-configuration
//激活區域配置
[SW1-mst-region]qu
//退出MSTP配置模式
[SW1]stp instance 1 root primary
//設置實例1為主根
[SW1]stp instance 2 root secondary
//設置實例2為從根
【VRRP配置】
[SW1]interface Vlanif10
//進入到VLAN10的Svi接口模式下
[SW1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.0.254
//聲明虛擬備份組1並配置虛擬網關ip
[SW1-Vlanif10]vrrp vrid 1 priority 120
//配置虛擬備份組1的優先級為120
[SW1-Vlanif10]qu
//退出Svi接口配置模式
[SW1]interface Vlanif20
//進入到VLAN20的Svi接口模式下
[SW1-Vlanif20]vrrp vrid 2 virtual-ip 192.168.1.254
//聲明虛擬備份組2並配置虛擬網關ip
[SW1-Vlanif20]qu
//退出Svi接口配置模式
[SW1]rip 1
//進入到RIP路由協議配置模式
[SW1-rip-1]network 10.0.0.0
//聲明直連網段
[SW1-rip-1]network 192.168.0.0
//聲明直連網段
[SW1-rip-1]network 192.168.1.0
//聲明直連網段
[SW1-rip-1]qu
//退出RIP路由協議的配置模式
[SW1]qu
//退出特權模式
<SW1>sa
//保存配置
[SW2]
<Huawei>sys
//進入特權模式
[Huawei]sysname SW2
//修改主機名
[SW2]vlan batch 10 20 200
//聲明VLAN 10 20 200
[SW2]interface Vlanif10
//進入VLAN10的Svi接口模式
[SW2-Vlanif10]ip address 192.168.0.253 255.255.255.0
//配置VLAN10的Svi地址
[SW2-Vlanif20]qu
//退出Svi配置模式
[SW2]interface Vlanif20
//進入VLAN20的Svi接口模式
[SW2-Vlanif20]ip address 192.168.1.253 255.255.255.0
//配置VLAN20的Svi地址
[SW2-Vlanif20]qu
//退出Svi配置模式
[SW2]interface Vlanif200
//進入VLAN200的Svi接口模式
[SW2-Vlanif200]ip address 10.0.1.2 255.255.255.0
//配置VLAN200的Svi地址
[SW2-Vlanif200]qu
//退出Svi配置模式
[SW2]interface Eth-Trunk1
//進入到鏈路聚合配置模式
[SW2-Eth-Trunk1]port link-type trunk
//配置聚合鏈路的鏈路類型為trunk
[SW2-Eth-Trunk1]port trunk allow-pass vlan 2 to 4094
//允許所有VLAN通過鏈路
[SW2-Eth-Trunk1]qu
//退出鏈路聚合配置模式
[SW2]interface GigabitEthernet0/0/1
//進入到GE0/0/1的接口配置模式
[SW2-GigabitEthernet 0/0/1]port link-type trunk
//配置GE0/0/1的鏈路類型為trunk
[SW2-GigabitEthernet 0/0/1]port trunk allow-pass vlan 2 to 4094
//允許所有VLAN通過鏈路
[SW2-GigabitEthernet 0/0/1]qu
//退出GE0/0/1的接口配置模式
[SW2]interface GigabitEthernet0/0/11
//進入到GE0/0/11的接口配置模式
[SW2-GigabitEthernet 0/0/11] eth-trunk 1
//將GE0/0/11加入到聚合鏈路中
[SW1-GigabitEthernet 0/0/11]qu
//退出鏈路接口配置模式
[SW2]interface GigabitEthernet0/0/12
//進入到GE0/0/12的接口配置模式
[SW2-GigabitEthernet 0/0/12]eth-trunk 1
//將GE0/0/12加入到聚合鏈路中
[SW2-GigabitEthernet 0/0/12]qu
//退出GE0/0/12的接口配置模式
[SW2]interface GigabitEthernet0/0/14
//進入到GE0/0/14的接口配置模式
[SW2-GigabitEthernet 0/0/14]port link-type trunk
//配置GE0/0/14的鏈路類型為trunk
[SW2-GigabitEthernet 0/0/14]port trunk allow-pass vlan 2 to 4094
//允許所有VLAN通過鏈路
[SW2-GigabitEthernet 0/0/14]qu
//退出GE0/0/14的接口配置模式
[SW2]interface GigabitEthernet0/0/23
//進入到GE0/0/23的接口配置模式
[SW2-GigabitEthernet 0/0/23]port link-type access
//配置GE0/0/23的鏈路類型為access
[SW2-GigabitEthernet 0/0/23]port default vlan 200
//將GE0/0/23划分到VLAN200
[SW2-GigabitEthernet 0/0/23]qu
//退出GE0/0/23的接口配置模式
【MSTP配置】
[SW2]stp region-configuration
//進入到stp配置模式
[SW2-mst-region] region-name vrrp
//配置MSTP名稱
[SW2-mst-region]instance 1 vlan 10
//將VLAN10映射到實例1
[SW2-mst-region]instance 2 vlan 20
//將VLAN20映射到實例2
[SW2-mst-region]active region-configuration
//激活區域配置
[SW2-mst-region]qu
//退出MSTP配置模式
[SW2]stp instance 1 root secondary
//設置實例1為從根
[SW2]stp instance 2 root primary
//設置實例2為主根
【VRRP配置】
[SW2]interface Vlanif10
//進入到VLAN10的Svi接口模式下
[SW2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.0.254
//聲明虛擬備份組1並配置虛擬網關ip
[SW2-Vlanif10]qu
//退出Svi接口配置模式
[SW2]interface Vlanif20
//進入到VLAN20的Svi接口模式下
[SW2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.1.254
//聲明虛擬備份組2並配置虛擬網關ip
[SW2-Vlanif20]vrrp vrid 2 priority 120
//配置虛擬備份組2的優先級為120
[SW2-Vlanif20]qu
//退出Svi接口配置模式
[SW2]rip 1
//進入到RIP路由協議配置模式
[SW2-rip-1]network 10.0.0.0
//聲明直連網段
[SW2-rip-1]network 192.168.1.0
//聲明直連網段
[SW2-rip-1]network 192.168.0.0
//聲明直連網段
[SW2-rip-1]qu
//退出RIP路由協議的配置模式
[SW2]qu
//退出特權模式
<SW2>sa
//保存配置
[SW3]
<Huawei>sys
//進入特權模式
[Huawei]sysname SW3
//修改主機名
[SW3]vlan batch 10 20
//聲明VLAN 10 20
[SW3]interface Ethernet0/0/1
//進入到Eth0/0/1的接口模式
[SW3-Ethernet0/0/1]port link-type access
//配置Eth0/0/1的鏈路類型為access
[SW3-Ethernet0/0/1]port default vlan 10
//將Eth0/0/1划分到VLAN10
[SW3-Ethernet0/0/1]qu
//退出Eth0/0/1接口模式
[SW3]interface Ethernet0/0/14
//進入到Eth0/0/14的接口模式
[SW3-Ethernet0/0/14]port link-type trunk
//將Eth0/0/14的鏈路類型配置為trunk
[SW3-Ethernet0/0/14]port trunk allow-pass vlan 2 to 4094
//允許所有VLAN通過
[SW3-Ethernet0/0/14]qu
//退出Eth0/0/14的接口模式
[SW3]iinterface GigabitEthernet0/0/1
//進入到GE0/0/1的接口配置模式
[SW3-GigabitEthernet 0/0/1]port link-type trunk
//配置GE0/0/1的接口模式為trunk
[SW3-GigabitEthernet 0/0/1]port trunk allow-pass vlan 2 to 4094
//允許所有VLAN通過
[SW3-GigabitEthernet 0/0/1]qu
//退出GE0/0/1的接口配置模式
【MSTP】
[SW3]stp region-configuration
//進入到STP配置模式
[SW3]stp region-configuration
//進入到stp配置模式
[SW3-mst-region] region-name vrrp
//配置MSTP名稱
[SW3-mst-region]instance 1 vlan 10
//將VLAN10映射到實例1
[SW3-mst-region]instance 2 vlan 20
//將VLAN20映射到實例2
[SW3-mst-region]active region-configuration
//激活區域配置
[SW3-mst-region]qu
//退出MSTP配置模式
[SW3]qu
//退出特權模式
<SW3>sa
//保存配置
[SW4]
<Huawei>sys
//進入特權模式
[Huawei]sysname SW4
//修改主機名
[SW4]vlan batch 10 20
//聲明VLAN 10 20
[SW4]interface Ethernet0/0/1
//進入到Eth0/0/1的接口模式
[SW4-Ethernet0/0/1]port link-type access
//配置Eth0/0/1的鏈路類型為access
[SW4-Ethernet0/0/1]port default vlan 10
//將Eth0/0/1划分到VLAN10
[SW4-Ethernet0/0/1]qu
//退出Eth0/0/1接口模式
[SW4]interface Ethernet0/0/13
//進入到Eth0/0/13的接口模式
[SW4-Ethernet0/0/13]port link-type trunk
//將Eth0/0/13的鏈路類型配置為trunk
[SW4-Ethernet0/0/13]port trunk allow-pass vlan 2 to 4094
//允許所有VLAN通過
[SW4-Ethernet0/0/13]qu
//退出Eth0/0/13的接口模式
[SW4]iinterface GigabitEthernet0/0/1
//進入到GE0/0/1的接口配置模式
[SW4-GigabitEthernet 0/0/1]port link-type trunk
//配置GE0/0/1的接口模式為trunk
[SW4-GigabitEthernet 0/0/1]port trunk allow-pass vlan 2 to 4094
//允許所有VLAN通過
[SW4-GigabitEthernet 0/0/1]qu
//退出GE0/0/1的接口配置模式
【MSTP】
[SW4]stp region-configuration
//進入到STP配置模式
[SW4]stp region-configuration
//進入到stp配置模式
[SW4-mst-region] region-name vrrp
//配置MSTP名稱
[SW4-mst-region]instance 1 vlan 10
//將VLAN10映射到實例1
[SW4-mst-region]instance 2 vlan 20
//將VLAN20映射到實例2
[SW4-mst-region]active region-configuration
//激活區域配置
[SW4-mst-region]qu
//退出MSTP配置模式
[SW4]qu
//退出特權模式
<SW4>sa
//保存配置
-
總結
MSTP+VRRP配置步驟
1、配置交換機路由器的基本配置,例如接口信息、主機名等
2、配置交換機互連鏈路為trunk
3、配置主VRRP ID、虛擬IP、優先級,然后設置備VRRP的虛擬IP、優先級(此處的優先級一定要比主設備的低)
4、配置MSTP,進入MSTP配置接口、配置name、實例映射、激活,退出后設置主備
5、配置完成