华为VRRP-流量负载均衡配置

一、将SW1与SW2虚拟成一台SW

1.设备正常运行时,vlan10的流量转给SW1,vlan20的流量转发给SW2
2.SW1作为vlan10的主网关,只有当SW1故障时流量才转到SW2
3.SW2作为vlan20的主网关,只有当SW2故障时流量才转到SW1
在这里插入图片描述
二、配置思路
1.分别在三台SW上创建vlan10、13、20、23
2.给PC、SW、路由器配置好IP
3.在LSW3上将相应的vlan划入相应的端口
4.将交换机相连的链路配置为主干链路并允许特定vlan通过
4.在SW1/2配置VRRP主备网关
5.配置路由
6.验证配置效果
三、PC的配置

PC1配置
在这里插入图片描述
PC2配置
在这里插入图片描述
四、交换机、路由器配置

SW3配置(vlan、链路类型)
[SW1]vlan batch 10 13 20 23
[SW3]interface e0/0/1
[SW3-Ethernet0/0/1]port link-type access
[SW3-Ethernet0/0/1]port default vlan 10
[SW3-Ethernet0/0/1]int e0/0/4
[SW3-Ethernet0/0/4]port link-type access
[SW3-Ethernet0/0/4]port default vlan 20
[SW3]port-group group-member e0/0/2 e0/0/3
[SW3-port-group]port link-type trunk
[SW3-port-group]port trunk allow-pass vlan 10 13 20 23

SW1配置(vlan、链路类型)
[SW1]vlan batch 10 13 20 23
[SW1]interface g0/0/2
[SW1-GigabitEthernet0/0/2]port link-type trunk
[SW1-GigabitEthernet0/0/2]port trunk allow-pass vlan 10 13 20 23
[SW1]interface g0/0/1
[SW1-GigabitEthernet0/0/1]port link-type access
[SW1-GigabitEthernet0/0/1]port default vlan 13

SW2配置(vlan、链路类型)
[SW1]vlan batch 10 13 20 23
[SW1]interface g0/0/3
[SW1-GigabitEthernet0/0/3]port link-type trunk
[SW1-GigabitEthernet0/0/3]port trunk allow-pass vlan 10 13 20 23
[SW2]interface g0/0/2
[SW2-GigabitEthernet0/0/2]port link-type access
[SW2-GigabitEthernet0/0/2]port default vlan 23

SW1配置(VRRP)
[SW1]interface Vlanif 10
[SW1-Vlanif10]ip ad
[SW1-Vlanif10]ip address 192.168.1.251 24
[SW1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.1.254
[SW1-Vlanif10]vrrp vrid 1 priority 200
[SW1-Vlanif10]vrrp vrid 1 preempt-mode timer delay 20
[SW1-Vlanif10]vrrp vrid 1 track interface g0/0/1 reduced 100
[SW1]interface Vlanif 20
[SW1-Vlanif20]ip address 192.168.2.251 24
[SW1-Vlanif20]vrrp vrid 1 virtual-ip 192.168.2.254
[SW1-Vlanif20]vrrp vrid 1 priority 150

SW2配置(VRRP)
[SW2]interface vla
[SW2]interface Vlanif 10
[SW2-Vlanif10]ip address 192.168.1.252 24
[SW2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.1.254
[SW2-Vlanif10]vrrp vrid 1 priority 150
[SW2]interface Vlanif 20
[SW2-Vlanif20]ip address 192.168.2.252 24
[SW2-Vlanif20]vrrp vrid 1 virtual-ip 192.168.2.254
[SW2-Vlanif20]vrrp vrid 1 priority 200
[SW2-Vlanif20]vrrp vrid 1 track interface g0/0/2 reduced 100
[SW2-Vlanif20]vrrp vrid 1 preempt-mode timer delay 20

SW1配置(IP、路由)
[SW1]interface Vlanif 13
[SW1-Vlanif13]ip address 13.1.1.1 24
[SW1]ip route-static 0.0.0.0 0 13.1.1.3

SW2配置(IP、路由)
[SW2]interface Vlanif 23
[SW2-Vlanif23]ip address 23.1.1.2 24
[SW2]ip route-static 0.0.0.0 0 23.1.1.3

R3配置(IP、路由)
[R3]interface g0/0/1
[R3-GigabitEthernet0/0/1]ip address 13.1.1.3 24
[R3]interface g0/0/2
[R3-GigabitEthernet0/0/2]ip address 23.1.1.3 24
[R3]interface LoopBack 1
[R3-LoopBack1]ip address 1.1.1.1 32
[R3]ip route-static 192.168.1.0 24 13.1.1.1
[R3]ip route-static 192.168.1.0 24 23.1.1.2 preference 100
[R3]ip route-static 192.168.2.0 24 23.1.1.2
[R3]ip route-static 192.168.2.0 24 13.1.1.1 preference 100

五、验证配置效果
刷新VRRP进程:reset vrrp statistics

可以在SW1上看到SW1是vlan10的主网关,vlan20的备网关
在这里插入图片描述
可以在SW2上看到SW2是vlan20的主网关,vlan10的备网关
在这里插入图片描述
在PC1上长ping R3,ping通后将SW1关闭,也还是可以ping通
ping 1.1.1.1 -t
在这里插入图片描述
在PC2上长ping R3,ping通后将SW2关闭,也还是可以ping通
ping 1.1.1.1 -t
在这里插入图片描述

原创文章 14 获赞 17 访问量 1672

猜你喜欢

转载自blog.csdn.net/wyyfpzy/article/details/104651649