一.vrrp(Virtual Router Redundancy Protocol)虚拟路由冗余协议
VRRP是解决局域网中静态网关出现单点失效的协议
VRRP广泛应用在边缘网络中,它的设计目标是支持特定情况下IP数据流量失败转移不会引起混乱,允许主机使用单路由器,以及即使在实际第一跳路由器使用失败的情形下仍能够维护路由器间的连通性。
为了防止网络中的网关出现单点故障,VRRP有主网关(Master)和备网关(Backup),当主网关(Master)出现故障时可自动切换成备份网关,不影响主机的通信
- MSTP(Multiple Spanning Tree Protocol)多生成树协议
MSTP是多生成树协议,多个VLAN组成1个实例,每个实例1个生成树
所谓生成树实例就是多个VLAN的一个集合。通过将多个VLAN捆绑到一个实例,可以节省通信开销和资源占用率。MSTP各个实例拓扑的计算相互独立,在这些实例上可以实现负载均衡。可以把多个相同拓扑结构的VLAN映射到一个实例里,这些VLAN在端口上的转发状态取决于端口在对应MSTP实例的状态
实验拓扑:
文章来源地址https://www.toymoban.com/news/detail-492609.html
要求:LSW1作为VLAN10和VLAN20的主根桥以及主网关,VLAN30的次根桥以及备份网关
LSW2作为VLAN30的主根桥以及主网关,VLAN10和VLAN20的次根桥以及备份网关
对上层端口GE0/0/6进行端口跟踪,如果接口down掉,主备切换及时。
LSW1:
[Huawei]sysname LSW1 /改名为LSW1
[LSW1]vlan b 10 20 30 /创建vlan
[LSW1]int Eth-Trunk 1 /创建二层链路聚合
[LSW1]interface GigabitEthernet 0/0/1
[LSW1-GigabitEthernet0/0/1]eth-trunk 1 /将接口加入到聚合口
[LSW1-GigabitEthernet0/0/1]interface GigabitEthernet 0/0/2
[LSW1-GigabitEthernet0/0/2]eth-trunk 1
[LSW1-GigabitEthernet0/0/2]q
[LSW1]int Eth-Trunk 1
[LSW1-Eth-Trunk1]port link-type trunk /将聚合口设置为trunk口
[LSW1-Eth-Trunk1]port trunk allow-pass vlan all /trunk允许所有vlan通过
[LSW1-Eth-Trunk1]quit
[LSW1]port-group group-member g 0/0/3 g0/0/4 g 0/0/5 /将下联接口加入到组里面
[LSW1-port-group]port link-type trunk /同时配置三个接口为trunk口
[LSW1-port-group]port trunk allow-pass vlan all /配置三个接口的trunk允许所有vlan通过
[LSW1-port-group]q
[LSW1]int vlanif 10
[LSW1-Vlanif10]ip address 192.168.10.252 24 /配置vlanif10的ip地址
[LSW1-Vlanif10]int vlanif 20
[LSW1-Vlanif20]ip address 192.168.20.252 24
[LSW1-Vlanif20]int vlanif 30
[LSW1-Vlanif30]ip address 192.168.30.252 24
[LSW1-Vlanif30]quit
[LSW1]int Vlanif 10
[LSW1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.254 /配置vlan10的VIP为192.168.10.244
[LSW1-Vlanif10]vrrp vrid 1 priority 120 /设置他的优先级为120(vrrp默认优先级是100)
[LSW1-Vlanif10]vrrp vrid 1 track interface GigabitEthernet 0/0/6 reduced 30 /设置端口跟踪,上层接口down掉后优先级减30
[LSW1-Vlanif10]int Vlanif 20
[LSW1-Vlanif20]vrrp vrid 1 virtual-ip 192.168.20.254
[LSW1-Vlanif20]vrrp vrid 1 priority 120
[LSW1-Vlanif20]vrrp vrid 1 track interface GigabitEthernet 0/0/6 reduced 30
[LSW1-Vlanif20]int Vlanif 30
[LSW1-Vlanif30]vrrp vrid 30 virtual-ip 192.168.30.254
[LSW1]stp enable /启动stp
[LSW1]stp mode mstp /选择mstp模式
[LSW1]stp region-configuration 进入域视图
[LSW1-mst-region]region-name qqq /给域起名为qqq(域名要一致)
[LSW1-mst-region]instance 1 vlan 10 20 /实列1负责vlan 10 20
[LSW1-mst-region]instance 2 vlan 30 /实列2负责vlan 30
[LSW1-mst-region]active region-configuration 激活域
[LSW1-mst-region]quit
[LSW1]stp instance 1 priority 4096 /本交互在实例1中的优先级(优先级低的为主根)
[LSW1]stp instance 2 priority 8192 /本交互在实例2中的优先级
[LSW1]int vlanif 1 /进入vlan1
[LSW1-Vlanif1]ip a 192.168.40.1 24 /给vlan1设置ip地址
[LSW1-Vlanif1]int g 0/0/6 /进入接口
[LSW1-GigabitEthernet0/0/6]port link-type trunk /将该接口设置为trunk类型
[LSW1-GigabitEthernet0/0/6]port trunk pvid vlan 1 /该接口的vlanid为1
[LSW1-GigabitEthernet0/0/6]quit
[LSW1]ospf 1 router-id 2.2.2.2 /启动ospf进程1,指定路由id为2.2.2.2
[LSW1-ospf-1]area 0 /进入骨干区域
[LSW1-ospf-1-area-0.0.0.0]network 192.168.40.0 0.0.0.255 /宣告对端网络
[LSW1-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255
[LSW1-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
[LSW1-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
LSW2:
[Huawei]sysname LSW2
[LSW2]vlan b 10 20 30
[LSW2]int Eth-Trunk 1
[LSW2-Eth-Trunk1]quit
[LSW2]int g 0/0/1
[LSW2-GigabitEthernet0/0/1]eth-trunk 1
[LSW2-GigabitEthernet0/0/1]int g 0/0/2
[LSW2-GigabitEthernet0/0/2]eth-trunk 1
[LSW2-GigabitEthernet0/0/2]quit
[LSW2]int Eth-Trunk 1
[LSW2-Eth-Trunk1]port link-type trunk
[LSW2-Eth-Trunk1]port trunk allow-pass vlan all
[LSW2-Eth-Trunk1]q
[LSW2]port-group group-member g 0/0/3 g 0/0/4 g 0/0/5
[LSW2-port-group]port link-type trunk
[LSW2-port-group]port trunk allow-pass vlan all
[LSW2-port-group]quit
[LSW2]int vlanif 10
[LSW2-Vlanif10]ip a 192.168.10.253 24
[LSW2-Vlanif10]int vlanif 20
[LSW2-Vlanif20]ip a 192.168.20.253 24
[LSW2-Vlanif20]int vlanif 30
[LSW2-Vlanif30]ip a 192.168.30.253 24
[LSW2-Vlanif30]quit
[LSW2]int vlanif 10
[LSW2-Vlanif10]vrrp vr
[LSW2-Vlanif10]vrrp vrid 1 v
[LSW2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.254
[LSW2-Vlanif10]int vlanif 20
[LSW2-Vlanif20]vrrp vrid 1 virtual-ip 192.168.20.254
[LSW2-Vlanif20]int vlanif 30
[LSW2-Vlanif30]vrrp vrid 1 virtual-ip 192.168.30.254
[LSW2-Vlanif30]vrrp vrid 1 priority 120
[LSW2-Vlanif30]vrrp vrid 1 track interface GigabitEthernet 0/0/6 reduced 30
[LSW2]stp enable
[LSW2]stp mode mstp
[LSW2]stp region-configuration
[LSW2-mst-region]region-name qqq
[LSW2-mst-region]instance 1 vlan 10 20
[LSW2-mst-region]instance 2 vlan 30
[LSW2-mst-region]active region-configuration
[LSW2-mst-region]quit
[LSW2]stp instance 1 priority 8192
[LSW2]stp instance 2 priority 4096
[LSW2]int vlanif 1
[LSW2-Vlanif1]ip a 192.168.50.1 24
[LSW2-Vlanif1]int g 0/0/6
[LSW2-GigabitEthernet0/0/6]port link-type trunk
[LSW2-GigabitEthernet0/0/6]port trunk pvid vlan 1
[LSW2-GigabitEthernet0/0/6]quit
[LSW2]ospf 1 router-id 3.3.3.3
[LSW2-ospf-1]area 0
[LSW2-ospf-1-area-0.0.0.0]network 192.168.50.0 0.0.0.255
[LSW2-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255
[LSW2-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
[LSW2-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
LSW3:
[Huawei]vlan b 10 20 30 /创建vlan
[Huawei]port-group group-member Ethernet 0/0/1 Ethernet 0/0/2 /把接口加入到组
[Huawei-port-group]port link-type trunk /同时配置组内接口为trunk
[Huawei-port-group]port trunk allow-pass vlan all /允许接口为所有vlan通过
[Huawei-port-group]quit
[Huawei]port-group group-member Ethernet 0/0/3 Ethernet 0/0/4 /接口加入到组
[Huawei-port-group]port link-type access /配置组内接口模式为access
[Huawei-port-group]port default vlan 10 /组接口属于vlan10
[Huawei-Ethernet0/0/4]q
[Huawei]stp enable /启动stp
[Huawei]stp mode mstp /模式选择为mstp
[Huawei-mst-region]region-name qqq /给域起名
[Huawei-mst-region]instance 1 vlan 10 20 /实列1负责vlan10 20
[Huawei-mst-region]instance 2 vlan 30 /实列2负责vlan 30
[Huawei-mst-region]active region-configuration /激活域
LSW4:
[Huawei]vlan b 10 20 30
[Huawei]port-group group-member Ethernet 0/0/1 Ethernet 0/0/2
[Huawei-port-group]port link-type trunk
[Huawei-port-group]port trunk allow-pass vlan all
[Huawei-port-group]quit
[Huawei]port-group group-member Ethernet 0/0/3 Ethernet 0/0/4
[Huawei-port-group]port link-type access
[Huawei-port-group]port default vlan 20
[Huawei-port-group]quit
[Huawei]stp enable
[Huawei]stp mode mstp
[Huawei]stp region-configuration
[Huawei-mst-region]region-name qqq
[Huawei-mst-region]instance 1 vlan 10 20
[Huawei-mst-region]instance 2 vlan 30
[Huawei-mst-region]active region-configuration
LSW5:
[Huawei]vlan b 10 20 30
[Huawei]port-group group-member Ethernet 0/0/1 Ethernet 0/0/2
[Huawei-port-group]port link-type trunk
[Huawei-port-group]port trunk allow-pass vlan all
[Huawei-port-group]quit
[Huawei]port-group group-member Ethernet 0/0/3 Ethernet 0/0/4
[Huawei-port-group]port link-type access
[Huawei-port-group]port default vlan 30
[Huawei-port-group]quit
[Huawei]stp enable
[Huawei]stp mode mstp
[Huawei]stp region-configuration
[Huawei-mst-region]region-name qqq
[Huawei-mst-region]instance 1 vlan 10 20
[Huawei-mst-region]instance 2 vlan 30
[Huawei-mst-region]active region-configuration
AR1:
[Huawei]int g 0/0/0 /进入接口
[Huawei-GigabitEthernet0/0/0]ip a 192.168.40.2 24 /给接口设置ip
[Huawei-GigabitEthernet0/0/0]int g 0/0/1 /进入接口
[Huawei-GigabitEthernet0/0/1]ip a 192.168.50.2 24 /给接口设置ip
[Huawei-GigabitEthernet0/0/1]int g 0/0/2 /进入接口
[Huawei-GigabitEthernet0/0/2]ip a 10.0.0.1 24 /给接口设置ip
[Huawei-GigabitEthernet0/0/2]quit
[Huawei]ospf 1 router-id 1.1.1.1 /启动ospf进程1,指定路由id为1.1.1.1
[Huawei-ospf-1]area 0 /进入骨干区域
[Huawei-ospf-1-area-0.0.0.0]network 192.168.40.0 0.0.0.255 宣告对端网络
[Huawei-ospf-1-area-0.0.0.0]network 192.168.50.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]network 10.0.0.0 0.0.0.255
验证:
使用dis vrrp brief查看vrrp的配置情况
使用dis mstp brief查看mstp配置情况
Down掉端口用备核心交换器去ping远端pc
文章来源:https://www.toymoban.com/news/detail-492609.html
到了这里,关于VRRP+MSTP+ospf配置详解的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!