VRRP配置过程

  **

VRRP负载均衡

**
VRRP配置过程_第1张图片
SW1配置
The device is running!

system //进入用户视图
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw1 //更改设备名称
[sw1]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment…done.
[sw1]interface g0/0/4 //进入0/0/4接口
[sw1-GigabitEthernet0/0/4]port link-type access //更改链路类型
[sw1-GigabitEthernet0/0/4]port default vlan 20 //将接口加入vlan
[sw1-GigabitEthernet0/0/4]quit //退出接口 模式
[sw1]interface g0/0/3 //进入0/0/3接口
[sw1-GigabitEthernet0/0/3]port link-type access //更改链路类型
[sw1-GigabitEthernet0/0/3]port default vlan 10 //将接口加入vlan
[sw1-GigabitEthernet0/0/3]quit //退出接口模式
[sw1]interface g0/0/1 //进入0/0/1接口
[sw1-GigabitEthernet0/0/1]port link-type trunk 更改链路类型
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan all //端口改为运行所有vlan通过
[sw1-GigabitEthernet0/0/1]quit //退出接口模式
[sw1]interface g0/0/2 //进入接口
[sw1-GigabitEthernet0/0/2]port link-type trunk //更改链路类型
[sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan all //加入vlan
[sw1-GigabitEthernet0/0/2]quit //退出接口模式

SW2配置
The device is running!
system //进入用户视图
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw2 //更改设备名称
[sw2]vlan batch 10 20 //批量创建vlan
Info: This operation may take a few seconds. Please wait for a moment…done.
[sw2]interface g0/0/2 //进入接口
[sw2-GigabitEthernet0/0/2]port link-type trunk //更改链路类型
[sw2-GigabitEthernet0/0/2]port trunk allow-pass vlan all //允许所有vlan通过
[sw2-GigabitEthernet0/0/2]quit //退出接口
[sw2]interface vlanif 10 //进入vlan
[sw2-Vlanif10]ip addres 192.168.10.253 24 //配置IP
[sw2-Vlanif10]undo shutdown //激活
Info: Interface Vlanif10 is not shutdown.
[sw2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.254 //配置虚拟网关
[sw2-Vlanif10]vrrp vrid 1 priority 200 //更改优先级
[sw2-Vlanif10]quit //退出vlan10
[sw2]interface vlanif 20 //进入vlan20
[sw2-Vlanif20]ip address 192.168.20.253 24 //配置IP
[sw2-Vlanif20]undo shutdown //激活
Info: Interface Vlanif20 is not shutdown.
[sw2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.254 //配置虚拟网关
[sw2-Vlanif20]quit //退出vlan20
[sw2]vlan 30
[sw2]interface vlanif 30 //进入vlan30
[sw2-Vlanif30]ip address 192.168.30.1 24 //配置IP
[sw2-Vlanif30]undo shutdown //激活
Info: Interface Vlanif30 is not shutdown.
[sw2-Vlanif30]quit //退出
[sw2]interface g0/0/1 //进入接口
[sw2-GigabitEthernet0/0/1]port link-type access //更改链路类型
[sw2-GigabitEthernet0/0/1]port default vlan 30 //接口加入vlan
[sw2-GigabitEthernet0/0/1]quit //退出
VRRP配置过程_第2张图片
VRRP配置过程_第3张图片

SW3配置
system-viem
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw3
[sw3]vlan batch 10 20 //批量创建vlan
Info: This operation may take a few seconds. Please wait for a moment…done.
[sw3]interface g0/0/2 //进入接口
[sw3-GigabitEthernet0/0/2]port link-type trunk //更改链路类型
[sw3-GigabitEthernet0/0/2]port trunk allow-pass vlan all //
[sw3-GigabitEthernet0/0/2]quit
[sw3]interface vlanif 10
[sw3-Vlanif10]ip address 192.168.10.252 24 //配置IP
[sw3-Vlanif10]undo shutdown
Info: Interface Vlanif10 is not shutdown.
[sw3-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.254 //配置虚拟网关
[sw3-Vlanif10]quit
[sw3]interface vlanif 20
[sw3-Vlanif20]ip address 192.168.20.252 24
[sw3-Vlanif20]undo shutdown
Info: Interface Vlanif20 is not shutdown.
[sw3-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.254 //配置虚拟网关
[sw3-Vlanif20]vrrp vrid 2 priority 200 //配置优先级
[sw3-Vlanif20]quit

[sw3]vlan 30
[sw3-vlan30]quit
[sw3]interface vlanif 30
[sw3-Vlanif30]ip address 192.168.40.1 24
[sw3-Vlanif30]undo shutdown
Info: Interface Vlanif30 is not shutdown.
[sw3-Vlanif30]quit
[sw3]interface g0/0/1
[sw3-GigabitEthernet0/0/1]port link-type access
[sw3-GigabitEthernet0/0/1]port default vlan 30
[sw3-GigabitEthernet0/0/1]quit
VRRP配置过程_第4张图片

在这里插入图片描述
R1配置
system
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.30.2 24
[R1-GigabitEthernet0/0/0]quit
[R1]interface g0/0/1
[R1-GigabitEthernet0/0/1]ip address 192.168.40.2 24
[R1-GigabitEthernet0/0/1]quit

总结:
在多个真实的网关设备之间运行之后,形成一个虚拟的网关,实现多个真实网关之间的“冗余备份”以及数据转发的负载均衡。
场景:
当我们为了提高一个网络中的网关的安全性,从而在同一个网络中部署多个网关设备的时候,我们需要在多个网关设备之间运行 VRRP。
工作过程:
VRRP在设备上运行之后会互相发送报文,比较优先级,选取主网关,从而形成一个虚拟网关。来确定出网关设备之间的不同角色。一旦确定出主网关和备份网关之后,只有主网关一直周期性发送报文。如果在一定时间之内,没有收到master发送的报文,就认为master出现故障从而切换角色。
master - 主设备;有且只有1个;
backup - 备份设备;可以有很多;

链路追踪配置
[sw2]interface vlanif 10
[sw2-Vlanif10]vrrp vrid 1 track interface GigabitEthernet 0/0/1 reduced 150 //当g0/0/1线路故障出现问降级150

总结
当主网关出接口线路故障时,PC机不能正常访问外网。所以应将自己的优先级降低从master变为backup。那么链路追踪在发现线路down掉就会自动发送VRRP报文降低优先级,降低比backup网关角色优先级低。从而让backup变成master,接管原主网关的工作。

VRRP常见的故障:多个master。
故障原因:
1.多个真实网关之间不通
2.两边配置的 VRID 不同
3.两边配置的 virtual-ip 不同
4.vrrp 认证不成功

你可能感兴趣的:(运维,VRRP,华为设备)