网关备份之VRRP(虚拟路由器备份协议)

一、什么是VRRP
1、VRRP含义
VRRP:Virtual Router Redundancy Protocol,虚拟路由器备份协议。
VRRP能够在不改变组网的情况下,将多台路由器虚拟成一个虚拟路由器,通过配置虚拟路由器的IP地址
为默认网关,实现网关的备份。
协议版本:VRRPv2(常用)和VRRPv3:
VRRPv2仅适用于IPv4网络,VRRPv3适用于IPv4和IPv6两种网络。
VRRP描述了一个动态选举协议,该协议从一组VRRP路由器中选举一个主路由器(Master),并将Master
关联到一个虚拟路由器,作为所连接网段的网关。
VRRP组成员:Master路由器,Backup路由器,虚拟路由器,其他路由器

二、VRRP配置案例(华为)

配置命令:

基础配置

1、LSW3配置

sys
undo info enable          #关闭系统信息提示
vlan batch 10 20
interface e0/0/1
port link-type access                      #更改接口属性
port default vlan 10
interface e0/0/2
port link-type access                      #更改接口属性
port default vlan 20
quit
interface e0/0/15
port link-type trunk                        #更改接口属性
port trunk allow-pass vlan 10 20    #在接口绑定VLAN
interface e0/0/16
port link-type trunk
port trunk allow-pass vlan 10 20
quit

ospf 1
area 0
network 192.168.100.0 0.0.0.3
network 192.168.20.0 0.0.0.255
network 192.168.10.0 0.0.0.255


2、配置三层交换机LSW1

sys
undo info enable                     #关闭系统信息提示
vlan batch 10 20 100
interface g0/0/2
port link-type trunk               #更改接口属性
port trunk allow-pass vlan 10 20       #在接口绑定VLAN
interface g0/0/24
port link-type trunk
port trunk allow-pass vlan 10 20
quit
interface g0/0/1
port link-type access                 #更改接口属性
port default vlan 100               #在接口绑定VLAN
interface vlanif 100
ip addr 192.168.100.1 255.255.255.252
quit

ospf 1
area 0
network 192.168.100.0 0.0.0.3
network 192.168.20.0 0.0.0.255
network 192.168.10.0 0.0.0.255


3、配置三层交换机LSW2

sys
undo info enable                     #关闭系统信息提示
vlan batch 10 20 100
interface g0/0/2
port link-type trunk               #更改接口属性
port trunk allow-pass vlan 10 20       #在接口绑定VLAN
interface g0/0/24
port link-type trunk
port trunk allow-pass vlan 10 20
quit
interface g0/0/1
port link-type access                 #更改接口属性
port default vlan 100               #在接口绑定VLAN
interface vlanif 100
ip addr 192.168.100.5 255.255.255.252
quit

ospf 1
area 0
network 192.168.100.0 0.0.0.3
network 192.168.20.0 0.0.0.255
network 192.168.10.0 0.0.0.255


4、路由器R1

sys
undo info enable
interface g0/0/0
ip addr 192.168.100.2 255.255.255.252
interface g0/0/1
ip addr 192.168.100.6 255.255.255.252
interface loopback 0
ip addr 192.168.200.1 255.255.255.0
quit

ospf 1
area 0
network 192.168.100.0 0.0.0.3
network 192.168.20.0 0.0.0.255
network 192.168.10.0 0.0.0.255

1、LSW3配置

sys
undo info enable          #关闭系统信息提示
vlan batch 10 20
interface e0/0/1
port link-type access                      #更改接口属性
port default vlan 10
interface e0/0/2
port link-type access                      #更改接口属性
port default vlan 20
quit
interface e0/0/15
port link-type trunk                        #更改接口属性
port trunk allow-pass vlan 10 20    #在接口绑定VLAN
interface e0/0/16
port link-type trunk
port trunk allow-pass vlan 10 20
quit
ospf 1
area 0
network 192.168.100.0 0.0.0.3
network 192.168.20.0 0.0.0.255
network 192.168.10.0 0.0.0.255


2、配置三层交换机LSW1

sys
undo info enable                     #关闭系统信息提示
vlan batch 10 20 100
interface g0/0/2
port link-type trunk               #更改接口属性
port trunk allow-pass vlan 10 20       #在接口绑定VLAN
interface g0/0/24
port link-type trunk
port trunk allow-pass vlan 10 20
quit
interface g0/0/1
port link-type access                 #更改接口属性
port default vlan 100               #在接口绑定VLAN
interface vlanif 100
ip addr 192.168.100.1 255.255.255.252
quit
ospf 1
area 0
network 192.168.100.0 0.0.0.3
network 192.168.20.0 0.0.0.255
network 192.168.10.0 0.0.0.255


3、配置三层交换机LSW2

sys
undo info enable                     #关闭系统信息提示
vlan batch 10 20 100
interface g0/0/2
port link-type trunk               #更改接口属性
port trunk allow-pass vlan 10 20       #在接口绑定VLAN
interface g0/0/24
port link-type trunk
port trunk allow-pass vlan 10 20
quit
interface g0/0/1
port link-type access                 #更改接口属性
port default vlan 100               #在接口绑定VLAN
interface vlanif 100
ip addr 192.168.100.5 255.255.255.252
quit
ospf 1
area 0
network 192.168.100.0 0.0.0.3
network 192.168.20.0 0.0.0.255
network 192.168.10.0 0.0.0.255


4、路由器R1

sys
undo info enable
interface g0/0/0
ip addr 192.168.100.2 255.255.255.252
interface g0/0/1
ip addr 192.168.100.6 255.255.255.252
interface loopback 0
ip addr 192.168.200.1 255.255.255.0
quit
ospf 1
area 0
network 192.168.100.0 0.0.0.3
network 192.168.20.0 0.0.0.255
network 192.168.10.0 0.0.0.255

下面是图解

LSW3

 LSW2

 LSW1

 R1

二、配置VRRP实现网关备份冗余

配置命令如下

1、三层交换机LSW1(是VLAN10的Master路由器,VLAN20的Backup路由器)

interface Vlanif 10
ip address 192.168.10.1 24
vrrp vrid 10 virtual-ip 192.168.10.254          #虚拟路由器
vrrp vrid 10 priority 200             #优先级(VLAN10优先选择路线)
vrrp vrid 10 preempt-mode timer delay 1     #占先权
vrrp vrid 10 timer advertise 3
vrrp vrid 10 track interface GigabitEthernet0/0/1 reduced 100  #跟踪
interface Vlanif 20
ip address 192.168.20.1 24
vrrp vrid 20 virtual-ip 192.168.20.254
vrrp vrid 20 priority 150
vrrp vrid 20 preempt-mode timer delay 1
vrrp vrid 20 timer advertise 3       #时钟:(Hello间隔)


2、

interface Vlanif 10
ip address 192.168.10.2 24
vrrp vrid 10 virtual-ip 192.168.10.254  
vrrp vrid 10 priority 150
vrrp vrid 10 preempt-mode timer delay 1
vrrp vrid 10 timer advertise 3
interface Vlanif 20
ip address 192.168.20.2 24          
vrrp vrid 20 virtual-ip 192.168.20.254       #虚拟路由器
vrrp vrid 20 priority 200                           #优先级(VLAN20优先选择路线)
vrrp vrid 20 preempt-mode timer delay 1    # #占先权
vrrp vrid 20 timer advertise 3
vrrp vrid 20 track interface GigabitEthernet0/0/1 reduced 100  #跟踪

1、三层交换机LSW1(是VLAN10的Master路由器,VLAN20的Backup路由器)

interface Vlanif 10
ip address 192.168.10.1 24
vrrp vrid 10 virtual-ip 192.168.10.254          #虚拟路由器
vrrp vrid 10 priority 200             #优先级(VLAN10优先选择路线)
vrrp vrid 10 preempt-mode timer delay 1     #占先权
vrrp vrid 10 timer advertise 3
vrrp vrid 10 track interface GigabitEthernet0/0/1 reduced 100  #跟踪
interface Vlanif 20
ip address 192.168.20.1 24
vrrp vrid 20 virtual-ip 192.168.20.254
vrrp vrid 20 priority 150
vrrp vrid 20 preempt-mode timer delay 1
vrrp vrid 20 timer advertise 3       #时钟:(Hello间隔)


2、

interface Vlanif 10
ip address 192.168.10.2 24
vrrp vrid 10 virtual-ip 192.168.10.254  
vrrp vrid 10 priority 150
vrrp vrid 10 preempt-mode timer delay 1
vrrp vrid 10 timer advertise 3
interface Vlanif 20
ip address 192.168.20.2 24          
vrrp vrid 20 virtual-ip 192.168.20.254       #虚拟路由器
vrrp vrid 20 priority 200                           #优先级(VLAN20优先选择路线)
vrrp vrid 20 preempt-mode timer delay 1    # #占先权
vrrp vrid 20 timer advertise 3
vrrp vrid 20 track interface GigabitEthernet0/0/1 reduced 100  #跟踪

以下是图解

LSW1

 LSW2

验证:

1、正常情况

查看VRRP dis vrrp bri

LSW1

LSW2

 

2、出现故障(如,LSW1的上行链路G0/0/1断开)

3、测试PC能否接通到虚拟端口

PC1配置如下

测试:

 4、PC2配置如下

 

测试

总结:

VRRP(虚拟路由器冗余协议)是一种通过将多台设备组成逻辑上的一台设备来提高网络可用性和可靠性的协议。通过配置VRRP,可以将多个设备组成虚拟路由器,使得在一个设备故障或拓扑结构变化的情况下,网络可以继续正常工作,从而避免中断服务和系统故障所带来的影响。VRRP协议的主要作用是提高网络的可用性和可靠性,保证网络的连通性,降低设备故障对业务产生的影响。同时,VRRP还能够提高网络的容错能力,提升网络配置的灵活性和协议的可修改性,使网络管理更加简便。因此,VRRP的应用可以有效地提高网络的运行效率和可靠性,对于企业级网络的稳健性和可靠性至关重要。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值