基于三层交换机的VRRP技术--MSTP、VRRP的综合运用

MSTP (多生成树) 每个VLAN或者几个VLAN拥有一颗生成树,基于实例的生成树。instance 1、instance 2 每个实例拥有一颗生成树。MSTP可以实现多VLAN 的负载分担,可以实现多厂商对接。

VRRP虚拟路由冗余协议(Virtual Router Redundancy Protocol)是由IETF提出的解决局域网中配置静态网关出现单点失效现象的路由协议。

注意:当MSTP 和VRRP共同存在时,我们必须要做MSTP的区域设置以及实例优先级,网络中二层MSTP的Vlan主根和三层VRRP的master网关要放在同一台设备上。在下面的图中,我们把Vlan10的instance 1的根桥设置为LSW1,Vlan10的网关设备也设置为LSW1。Vlan20的instance 2的根桥设置为LSW2,Vlan20的网关设备也为LSW2。

如图,PC1、PC2是企业内网的主机,分别属于VLAN10和VLAN20,LSW1和LSW2之间的g0/0/2口和g0/0/3口之间形成链路聚合。AR1是企业边界路由器,用于和外网通信。AR1、LSW1和LSW2之间运行ospf协议。LSW1、LSW2和LSW3之间运行MSTP协议。要让PC1、PC2出去和回来的流量方向一致,且形成第一跳网关冗余,且负载均衡。如下是配置

PC1

PC>ipconfig

IPv4 address......................: 192.168.10.10
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.10.254
Physical address..................: 54-89-98-55-50-74
VLAN..............................: 10

PC2

PC>ipconfig

IPv4 address......................: 192.168.20.10
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.20.254
Physical address..................: 54-89-98-85-59-50
Vlan..............................: 20

LSW1

[LSW1]display current-configuration 
#
vlan batch 10 20 100
#
stp instance 1 priority 4096
stp instance 2 priority 8192
#
stp region-configuration
 region-name MSTP
 instance 1 vlan 10
 instance 2 vlan 20
 active region-configuration
#
interface Vlanif10
 ip address 192.168.10.1 255.255.255.0
 vrrp vrid 10 virtual-ip 192.168.10.254
 vrrp vrid 10 priority 150
 vrrp vrid 10 preempt-mode timer delay 10
 vrrp vrid 10 track interface GigabitEthernet0/0/4 reduced 60
 vrrp vrid 10 authentication-mode md5 GX2lR,}C+Ky~t+Byca8YR#(#
#
interface Vlanif20
 ip address 192.168.20.1 255.255.255.0
 vrrp vrid 20 virtual-ip 192.168.20.254
 vrrp vrid 20 authentication-mode md5 L>YK#S.jKJu:|l#3M^#3"$f#
#
interface Vlanif100
 ip address 192.168.30.1 255.255.255.0
#
interface Eth-Trunk1
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/2
 eth-trunk 1
#
interface GigabitEthernet0/0/3
 eth-trunk 1
#
interface GigabitEthernet0/0/4
 port link-type access
 port default vlan 100
#
ospf 100 router-id 192.168.30.1
 import-route direct route-policy POLICY
 area 0.0.0.0
  network 192.168.30.1 0.0.0.0
#
route-policy POLICY permit node 10
 if-match ip-prefix F
 apply cost 10
#
route-policy POLICY permit node 20
 if-match ip-prefix F2
 apply cost 20
#
ip ip-prefix F index 10 permit 192.168.10.0 24
ip ip-prefix F2 index 10 permit 192.168.20.0 24
#

LSW2

[LSW2]display current-configuration 
#
vlan batch 10 20 100
#
stp instance 1 priority 8192
stp instance 2 priority 4096
#
stp region-configuration
 region-name MSTP
 instance 1 vlan 10
 instance 2 vlan 20
 active region-configuration
#
interface Vlanif10
 ip address 192.168.10.2 255.255.255.0
 vrrp vrid 10 virtual-ip 192.168.10.254
 vrrp vrid 10 authentication-mode md5 CN7EFU,9+,'eKRQqbl+O/%;#
#
interface Vlanif20
 ip address 192.168.20.2 255.255.255.0
 vrrp vrid 20 virtual-ip 192.168.20.254
 vrrp vrid 20 priority 150
 vrrp vrid 20 preempt-mode timer delay 60
 vrrp vrid 20 track interface GigabitEthernet0/0/4 reduced 60
 vrrp vrid 20 authentication-mode md5 :||$@<`|wYu:|l#3M^#36%L#
#
interface Vlanif100
 ip address 192.168.40.2 255.255.255.0
#
interface Eth-Trunk1
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/2
 eth-trunk 1
#
interface GigabitEthernet0/0/3
 eth-trunk 1
#
interface GigabitEthernet0/0/4
 port link-type access
 port default vlan 100
#
ospf 100 router-id 192.168.40.2
 import-route direct route-policy POLICY
 area 0.0.0.0
  network 192.168.40.2 0.0.0.0
#
route-policy POLICY permit node 10
 if-match ip-prefix F
 apply cost 20
#
route-policy POLICY permit node 20
 if-match ip-prefix F2
 apply cost 10
#
ip ip-prefix F index 10 permit 192.168.10.0 24
ip ip-prefix F2 index 10 permit 192.168.20.0 24
#

LSW3

[LSW3]display current-configuration 
#
vlan batch 10 20
#
stp region-configuration
 region-name MSTP
 instance 1 vlan 10
 instance 2 vlan 20
 active region-configuration
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/3
 port link-type access
 port default vlan 10
 stp edged-port enable
#
interface GigabitEthernet0/0/4
 port link-type trunk
 port trunk allow-pass vlan 20
 stp edged-port enable
#

AR1

[AR1]display current-configuration
#
interface GigabitEthernet0/0/0
 ip address 192.168.30.2 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 192.168.40.1 255.255.255.0 
#
ospf 100 router-id 111.1.1.1 
 area 0.0.0.0 
  network 192.168.30.2 0.0.0.0 
  network 192.168.40.1 0.0.0.0 
#

附上ensp源文件:链接: https://pan.baidu.com/s/1WhN79Z7b8XviOmmFAi5WyQ 密码: 8qkg

基于路由器的VRRP---------->基于路由器的VRRP技术---VRRP的应用

基于防火墙的VRRP --------->基于防火墙的VRRP技术--华为防火墙双机热备--VGMP

### ENSP 中配置三层交换机实现 VRRPMSTP #### 配置概述 为了在网络中提供更高的可靠性和稳定性,在华为 eNSP 模拟环境中可以通过配置三层交换机来部署 VRRP (虚拟路由冗余协议) 和 MSTP (多生成树协议)[^1]。 #### 准备工作 确保实验环境已搭建好相应的拓扑结构,并且各设备间能够正常通信。对于本案例而言,至少应包含两台以上的三层交换机以及若干终端节点用于测试连通性[^2]。 #### 启用并配置 MSTP 多实例生成树协议 在每一台参与组网的三层交换机上执行命令启用全局范围内的 MSTP 功能: ```shell [Huawei] stp mode mstp ``` 接着定义不同的 VLAN 映射到特定的 MST Instance 下面,以便于更精细地控制流量路径;同时调整优先级参数使得某一台指定为主根桥或者备份根桥角色: ```shell [Huawei-mst-process-0] instance 0 vlan 1 to 4094 [Huawei-mst-process-0] active region-configuration [Huawei-mst-process-0] set force true [Huawei-mst-process-0] commit [Huawei-mst-process-0] quit [Huawei] stp root primary // 设置当前设备为MST域中的主要根桥 // 或者设置次要根桥 [Huawei] stp secondary-root secondary ``` 以上操作完成后可以查看具体的状态信息验证是否生效: ```shell display stp brief ``` #### 创建并管理 VRRP 组 针对每一个需要保护的关键子网分别建立对应的 VRRP Group ,设定唯一的 VRID 号码、关联接口 IP 地址及其掩码长度还有期望优先级别等属性值: ```shell interface GigabitEthernet0/0/1 vrrp vrid 1 virtual-ip 192.168.1.254 vrrp vrid 1 priority 120 vrrp vrid 1 track interface GigabitEthernet0/0/2 reduced 30 ``` 上述指令片段表示在一个名为 `GigabitEthernet0/0/1` 的物理端口之上创建了一个编号为 1 的 VRRP 实体,并指定了其对外呈现给客户端使用的默认网关地址为 `192.168.1.254`. 此外还设置了初始选举权重分值为 120 并启用了跟踪机制当另一条链路状态发生变化时自动降低自身的竞争力从而触发切换过程. 最后同样要记得检查运行状况以确认各项参数均已按照预期加载完毕: ```shell display vrrp all ``` 通过上述步骤可以在 ENSP 上成功构建起具备高可用性的企业内部网络架构模型[^3].
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

谢公子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值