当前位置:网站首页>VRRP虚拟路由冗余协议
VRRP虚拟路由冗余协议
2022-07-21 05:22:00 【linhaoyanglinhao】
VRRP虚拟路由冗余协议
1VRRP简介
1.1VRRP的介绍
VRRP Virtual route Redundancy Protocol缩写,也叫虚拟路由冗余协议
利用VRRP,一组路由器(同一个lan中的接口)协同工作,单只有一个处于Master状态,处于该状态的路由器(的接口)承担实际的数据流量转发任务,在一个VRRP组内的多个路由器接口共用一个虚拟IP地址,该地址被称为局域网内所有主机的缺省网关地址。
●VRRP决定哪个路由器是Master。
●Master路由器负责接收发送至网关的数据包并进行转发,以及响应pc对于对于其网关IP地址的ARP请求。
●Backup路由器路由器侦听Master路由器的状态,并在Master路由器发生故障时,接替其工作,从而保证业务流量的平滑切换。
1.2VRRP的作用
vrrp提供了局域网上的设备的备份机制,vrrp是一种容错协议,它们保证当主机的下一跳路由器换掉时,可以及时有另一台路由器来代替,从而保证通讯的连续性和可靠性。
它通过优先级分辨出谁是master谁是backup,当master正常时pc端访问网关直接从Master路由器进入到网关路由器,当master线路出现异常时,优先级降低,backup路由器会抢占master路由器,PC端从新的master进行转发。
1.3VRRP的工作原理
VRRP为虚拟路由器冗余协议,多个路由器都会使用虚拟ip,且有一个和多个的热备组(备份的路由器)。
●以优先级的方式,确认主从关系,同时VIP(虚拟ip)会作用在优先级最高的一个设备上。主设备称为“Master”,从设备称为“Backup”
●主设备会周期性向从设备发送vrrp报文(心跳检测),来告知从设备自己的存活情况。
●当主设备遇到故障时,VRRP对VIP所在的主设备进行降级低于从设备路由器,然后VIP会作用在热备组设备中优先级最高的设备上。继续提供流量传输。
●源Master设备故障恢复时,若该设备IP地址拥有者(则优先级为255),直接切换Master,如果低于255,则还是为Backup状态,由Backup设备的工作方式(抢占方式和非抢占方式)决定是否重新选举。
1.4VRRP部分名词解释
VRRP组:又称虛拟路由器或备份组,指一组相同 VRRP ID、相同虚拟地址、工作在同局域网的路由器。
虚拟路由器即Virtual Router,是指在软、硬件层实现物理路由器的功能仿真,属于一种逻辑设备。每个VR应该具有逻辑独立的路由表和转发表,
Master路由器:**在VRRP组中实际转发数据包的路由器,在每一个VRRP组中,仅有Master响应对虚拟IP地址的ARP请求,Master路由器同时以一定的时间间隔发送VRRP消息,以便通知Backup路由器自己的存活情况。
Backup路由器:**处于监听状态的路由器,一旦Master路由器出现故障,Baskup路由器就开始接替工作。
2VRRP配置
R1配置
system-view ###进入系统模式
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1 ###修改名称
[R1]undo info-center enable ###关闭消息提示
Info: Information center is disabled.
[R1]int g0/0/0 ###进入接口g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.10.100 24 ###设置接口ip
[R1-GigabitEthernet0/0/0]undo shutdown ###启动接口
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R1-GigabitEthernet0/0/0]int g0/0/1 ###进入接口g0/0/1
[R1-GigabitEthernet0/0/1]ip add 13.0.0.1 24 ### 设置接口ip
[R1-GigabitEthernet0/0/1]undo shutdown ###启动接口
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R1-GigabitEthernet0/0/1]int g0/0/0 ###再次进入接口g0/0/0(为什么在这个接口配置vrrp,因为此接口与虚拟接口在同一网段)
[R1-GigabitEthernet0/0/0]vrrp vrid 1 virtual-ip 192.168.10.1 ###设置虚拟ip
[R1-GigabitEthernet0/0/0]vrrp vrid 1 priority 120 ### 设置优先级为120(默认为100)
[R1-GigabitEthernet0/0/0]vrrp vrid 1 preempt-mode timer delay 5 ###设置抢占时间为5s(默认0秒)
[R1-GigabitEthernet0/0/0]vrrp vrid 1 track int g0/0/1 reduce 30 ###跟踪上下接口(出了问题就降低30优先级)
[R1-GigabitEthernet0/0/0]q ###返回上一级
[R1]ip route-static 30.0.0.1 24 13.0.0.2 ###设置静态路由(此处也可以设置默认路由)
Info: The destination address and mask of the configured static route mismatched
, and the static route 30.0.0.0/24 was generated.
R2配置
system-view ###进入系统模式
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R2 ###修改名称
[R2]undo info-center enable ###取消消息提示
Info: Information center is disabled.
[R2]int g0/0/0 ###进入接口g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.10.200 24 ###配置接口ip
[R2-GigabitEthernet0/0/0]undo shutdown ###开启接口
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R2-GigabitEthernet0/0/0]int g0/0/1 ###进入接口g0/0/1
[R2-GigabitEthernet0/0/1]ip add 23.0.0.1 24 ###设置接口ip
[R2-GigabitEthernet0/0/1]undo shutdown ###启动接口
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R2-GigabitEthernet0/0/1]int g0/0/0 ###再次进入接口g0/0/0
[R2-GigabitEthernet0/0/0]vrrp vrid 1 virtual-ip 192.168.10.1 ###设置虚拟ip
[R2-GigabitEthernet0/0/0]q ###返回上一级
[R2]ip route-static 0.0.0.0 24 23.0.0.2 ###设置默认路由(此处也可以设置静态路由)
R3配置
system-view ###进入系统模式
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R3 ###设置名称
[R3]undo info-center enable ###取消提示
Info: Information center is disabled.
[R3]int g0/0/0 ###进入接口g0/0/0
[R3-GigabitEthernet0/0/0]ip add 13.0.0.2 24 ###配置接口ip
[R3-GigabitEthernet0/0/0]undo shutdown ###开启接口
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R3-GigabitEthernet0/0/0]int g0/0/1 ###进入接口g0/0/1
[R3-GigabitEthernet0/0/1]ip add 23.0.0.2 24 ###配置接口ip
[R3-GigabitEthernet0/0/1]undo shutdown ###启动接口
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R3-GigabitEthernet0/0/1]int loopback 0 ###配置虚拟ip
[R3-LoopBack0]ip add 30.0.0.1 24 ###配置虚拟ip地址
[R3-LoopBack0]q ###返回上一层
[R3]ip route-static 192.168.10.0 24 13.0.0.1 ###配置静态路由
[R3]ip route-static 192.168.10.0 24 23.0.0.1 preference 70 ###配置浮动路由(静态路由优先级默认60 ,优先级越小 ,优先度越高)
3总结
1、VRRP组通过vrid来识别的,一个VRRP组可以有多个VRRP路由器,其中包含一个Master,一个或者多个Backup。
2vrrp提供了局域网上的设备的备份机制,vrrp是一种容错协议,它们保证当主机的下一跳路由器换掉时,可以及时有另一台路由器来代替,从而保证通讯的连续性和可靠性。
有多个VRRP路由器,其中包含一个Master,一个或者多个Backup。
2vrrp提供了局域网上的设备的备份机制,vrrp是一种容错协议,它们保证当主机的下一跳路由器换掉时,可以及时有另一台路由器来代替,从而保证通讯的连续性和可靠性。
它通过优先级分辨出谁是master谁是backup,当master正常时pc端访问网关直接从Master路由器进入到网关路由器,当master线路出现异常时,优先级降低,backup路由器会抢占master路由器,PC端从新的master进行转发。
边栏推荐
猜你喜欢
随机推荐
2787:算24
Steps for adding dependencies to idea:
Blocking and wakeup of processes
Shell scripts download data by date range and interval
Do you want to restore the drop table in oracle? Look here [just two steps]
What is hash conflict? How to resolve hash conflicts?
kettle入门之文本文件导入数据库
Deployment of three centers in two places
DataX环境部署以及测试案例
Leakage current, no grounding protection measures... 1296 imported electric kettle have major potential safety hazards
一个基于ATMEGA128的直流电机抱死程序
DHCP服务与配置
Intranet detection 1- working group information collection & intra domain information collection
Stata used in jupyter
Let interns set up a redis cluster, which almost got me in~~~
The actual case of Cisco configuring single arm routing is very simple
@Correct use of requestparam annotation
Dry goods sharing - what knowledge points did you take in the soft test high items in the first half of 2022?
Spark相关常见问题汇总
mount挂载不上,不提示任何信息