VRRP基本原理
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了VRRP基本原理相关的知识,希望对你有一定的参考价值。
VRRP基本原理虚拟路由冗余协议(Virtual Router Redundancy Protocol,简称VRRP),是一个IP协议族,我们知道IP协议族里面有ICMP、OSPF,VRRP也是IP协议族的一员,协议号为112。在VRRP里面,设备有两种角色(Master,Backup),其中Master负责跑业务流量,而Backup负责备份,当Master挂掉之后,Backup自动抢占为Master,然后所有的数据从Master上走 。VRRP主要是用来做出口链路的冗余备份的,可以有多个网关设备加入一个备份组,但是只能有一个Master设备,当Master设备挂掉之后,其他的Backup设备自动抢占为Master设备,以很好的避免静态指定网关的缺陷,保障网络的可靠性。
在VRRP协议中,有两组重要的概念:VRRP路由器和虚拟路由器,主控路由器和备份路由器?VRRP路由器是指运行VRRP的路由器,是物理实体,虚拟路由器是指VRRP协议创建的,是逻辑概念?一组VRRP路由器协同工作,共同构成一台虚拟路由器?该虚拟路由器对外表现为一个具有唯一固定IP地址和MAC地址的逻辑路由器?处于同一个VRRP组中的路由器具有两种互斥的角色:主控路由器和备份路由器,一个VRRP组中有且只有一台处于主控角色的路由器,可以有一个或者多个处于备份角色的路由器?VRRP协议使用选择策略从路由器组中选出一台作为主控,负责ARP相应和转发IP数据包,组中的其它路由器作为备份的角色处于待命状态?当由于某种原因主控路由器发生故障时,备份路由器能在几秒钟的时延后升级为主路由器?由于此切换非常迅速而且不用改变IP地址和MAC地址,故对终端使用者系统是透明的?
配置过程如下:
S1:
<H3C>sys
[H3C]sys S1
[S1]vlan 10
[S1-vlan10]port g1/0/1
[S1-vlan10]vlan 20
[S1-vlan20]port g1/0/2
[S1-vlan20]vlan 30
[S1-vlan30]port g1/0/3
[S1-vlan30]vlan 40
[S1-vlan40]port g1/0/4
[S1-vlan40]int range g1/0/5 to g1/0/6
[S1-if-range]port link-type trunk
[S1-if-range]port trunk permit vlan all
[S1-if-range]qu
S2:
[S2]vlan 10
[S2-vlan10]vlan 20
[S2-vlan20]vlan 30
[S2-vlan30]vlan 40
[S2-vlan40]int vlan 10
[S2-Vlan-interface10]ip ad 192.168.10.1 24
[S2-Vlan-interface10]vrrp vrid 10 virtual-ip 192.169.10.254
[S2-Vlan-interface10]vrrp vrid 10 priority 110
[S2-Vlan-interface10]vrrp vrid 10 preempt-mode delay 5
[S2-Vlan-interface10]int vlan 20
[S2-Vlan-interface20]ip ad 192.168.20.1 24
This subnet overlaps with another interface!
[S2-Vlan-interface20]vrrp vrid 10 virtual-ip 192.169.20.254
[S2-Vlan-interface20]vrrp vrid 10 priority 110
[S2-Vlan-interface20]vrrp vrid 10 preempt-mode delay 5
[S2-Vlan-interface20]int vlan 30
[S2-Vlan-interface30]ip ad 192.168.30.1 24
[S2-Vlan-interface30]vrrp vrid 10 virtual-ip 192.169.30.254
[S2-Vlan-interface30]vrrp vrid 10 priority 100
[S2-Vlan-interface30]vrrp vrid 10 preempt-mode delay 5
[S2-Vlan-interface30]int vlan 40
[S2-Vlan-interface40]ip ad 192.168.40.1 24
[S2-Vlan-interface40]vrrp vrid 10 virtual-ip 192.169.40.254
[S2-Vlan-interface40]vrrp vrid 10 priority 100
[S2-Vlan-interface40]vrrp vrid 10 preempt-mode delay 5
[S2-Vlan-interface40]qu
验证vrrp冗余网关是否配置成功:
[S3]vlan 10
[S3-vlan10]vlan 20
[S3-vlan20]vlan 30
[S3-vlan30]vlan 40
[S3-vlan40]int vlan 10
[S3-Vlan-interface10]ip ad 192.168.10.2 24
[S3-Vlan-interface10]vrrp vrid 10 virtual-ip 192.169.10.254
[S3-Vlan-interface10]vrrp vrid 10 priority 100
[S3-Vlan-interface10]vrrp vrid 10 preempt-mode delay 5
[S3-Vlan-interface10]int vlan 20
[S3-Vlan-interface20]ip ad 192.168.20.2 24
[S3-Vlan-interface20]vrrp vrid 10 virtual-ip 192.169.20.254
[S3-Vlan-interface20]vrrp vrid 10 priority 100
[S3-Vlan-interface20]vrrp vrid 10 preempt-mode delay 5
[S3-Vlan-interface20]int vlan 30
[S3-Vlan-interface30]ip ad 192.168.30.2 24
[S3-Vlan-interface30]vrrp vrid 10 virtual-ip 192.169.30.254
[S3-Vlan-interface30]vrrp vrid 10 priority 110
[S3-Vlan-interface30]vrrp vrid 10 preempt-mode delay 5
[S3-Vlan-interface30]int vlan 40
[S3-Vlan-interface40]ip ad 192.168.40.2 24
[S3-Vlan-interface40]vrrp vrid 10 virtual-ip 192.169.40.254
[S3-Vlan-interface40]vrrp vrid 10 priority 110
[S3-Vlan-interface40]vrrp vrid 10 preempt-mode delay 5
以上是关于VRRP基本原理的主要内容,如果未能解决你的问题,请参考以下文章