VRRP介绍

VRRP(虚拟路由冗余协议):

             VRRP是一种容错协议,它保证当主机的下一跳路由器出现故障时,由另一台路由器来代替出现故障的路由器进行工作,从而保持网络通信的连续性和可靠性。

              VRRP使用ip报文作为传输协议报文,协议号为112,

             使用固定的组播地址224.0.0.18进行发送,通过协议报文选举处一台路由器作为master,其他设备作为backup,来实现网关备份功能。
VRRP优点:

             简化网络管理。在具有多播或广播能力的局域网(如以太网)中,借助VRRP能在某台设备出现故障时仍然提供高可靠的缺省链路,有效避免单一链路发生故障后网络中断的问题,而无需修改动态路由协议、路由发现协议等配置信息,也无需修改主机的默认网关配置。

              适应性强。VRRP报文封装在IP报文中,支持各种上层协议。

              网络开销小。VRRP只定义了一种报文——VRRP通告报文,并且只有处于Master状态的路由器可以发送VRRP报文。

VRRP的工作过程:

          运行VRRP的“多个”路由器之间通过vrrp报文的交互,从而选择出一个最牛的路由器,作为master路由器,以后就用这个设备来转发数据包
            master路由器,仅仅只有一个,其他的路由器称之为backup路由器。

            同时,master和backup路由器,会产生一个虚拟的路由器,也就是一个虚拟的IP地址

基础配置命令:

vrrp 1 ip A.B.C.D  #配置虚拟网关地址

vrrp 1 priority 120   #配置设备优先级

vrrp 1 preempt    #支持抢占性

vrrp 1 timers advertise1  # 配置advertisement时间为1秒

vrrp 1 authentication md5 key-string Cisco  #配置md5认证密码为Cisco

vrrp 1 track int A    #监测A若是链路down了 则降低优先级10

通过下面这个双主双备路由实验理解下↓↓↓

LSW3

 <Huawei>un te m

 <Huawei>sys

 [Huawei]sys LSW3

 [LSW3]vlan b 10 20

 [LSW3]int e0/0/1

 [LSW3-Ethernet0/0/1]p l a

 [LSW3-Ethernet0/0/1]p d v 10

 [LSW3-Ethernet0/0/1]un sh

 [LSW3-Ethernet0/0/1]int e0/0/2

 [LSW3-Ethernet0/0/2]p l a

 [LSW3-Ethernet0/0/2]p d v 20

 [LSW3-Ethernet0/0/2]un sh

 [LSW3-Ethernet0/0/2]int g0/0/1

 [LSW3-GigabitEthernet0/0/1]p l t

 [LSW3-GigabitEthernet0/0/1]p t a v 10 20

 [LSW3-GigabitEthernet0/0/1]un sh

 [LSW3-GigabitEthernet0/0/1]int g0/0/2

 [LSW3-GigabitEthernet0/0/2]p l t

 [LSW3-GigabitEthernet0/0/2]p t a v 10 20

 [LSW3-GigabitEthernet0/0/2]q

RSW1

<Huawei>un te m

<Huawei>sys

[Huawei]sys RSW1

[RSW1]vlan b 10 20 100

[RSW1]int g0/0/2

[RSW1-GigabitEthernet0/0/2]p l t

[RSW1-GigabitEthernet0/0/2]p t a v 10 20

[RSW1-GigabitEthernet0/0/2]un sh

[RSW1-GigabitEthernet0/0/2]int g0/0/1

[RSW1-GigabitEthernet0/0/1]p l a

[RSW1-GigabitEthernet0/0/1]p d v 100

[RSW1-GigabitEthernet0/0/1]un sh

[RSW1-GigabitEthernet0/0/1]q

[RSW1]int Vlanif 10

[RSW1-Vlanif10]ip add 192.168.10.10 24

[RSW1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1(配置虚拟IP地址)

[RSW1-Vlanif10]vrrp vrid 1 priority 120(配置优先级120)

[RSW1-Vlanif10]vrrp vrid 1 track int g0/0/1(配置监听端口,当这个地方down时,优先级降10)

[RSW1-Vlanif10]vrrp vrid 1 track int g0/0/2

[RSW1-Vlanif10]q

int vlanif20

[RSW1-Vlanif20]ip add 192.168.20.10 24

[RSW1-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1

[RSW1-Vlanif20]vrrp vrid 2 priority 115

[RSW1-Vlanif20]q

[RSW1]int Vlanif 100

[RSW1-Vlanif100]ip add 11.0.0.2 30(配置互联口IP地址)

[RSW1-Vlanif100]q

[RSW1]ip route-static 0.0.0.0 0.0.0.0 11.0.0.1(配置默认路由)

RSW2

<Huawei>un te m

<Huawei>sys

[Huawei]sys RSW2

[RSW2]vlan b 10 20 100

[RSW2]int g0/0/2

[RSW2-GigabitEthernet0/0/2]p l t

[RSW2-GigabitEthernet0/0/2]p t v a 10 20

[RSW2-GigabitEthernet0/0/2]p t a v 10 20

[RSW2-GigabitEthernet0/0/2]un sh

[RSW2-GigabitEthernet0/0/2]int g0/0/1

[RSW2-GigabitEthernet0/0/1]p l a

[RSW2-GigabitEthernet0/0/1]p d v 100

[RSW2-GigabitEthernet0/0/1]un sh

[RSW2-GigabitEthernet0/0/1]q

[RSW2]int Vlanif 10

[RSW2-Vlanif10]ip add 192.168.10.20 24

[RSW2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1

[RSW2-Vlanif10]vrrp vrid 1 priority 115

[RSW2-Vlanif10]q

[RSW2]int Vlanif 20

[RSW2-Vlanif20]ip add 192.168.20.20 24

[RSW2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1

[RSW2-Vlanif20]vrrp vrid 2 priority 120

[RSW2-Vlanif20]vrrp vrid 2 track int g0/0/1

[RSW2-Vlanif20]vrrp vrid 2 track int g0/0/2

[RSW2-Vlanif20]q

[RSW2]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1

[RSW2]int Vlanif 100

[RSW2-Vlanif100]ip add 12.0.0.2 30

[RSW2-Vlanif100]q

AR1

<Huawei>un te m

<Huawei>sys

[Huawei]sys R1

[R1]int g0/0/0

[R1-GigabitEthernet0/0/0]ip add 11.0.0.1 30

[R1-GigabitEthernet0/0/0]q

[R1]int g0/0/1

[R1-GigabitEthernet0/0/1]ip add 12.0.0.1 30

[R1-GigabitEthernet0/0/1]q

[R1]int lo

[R1]int LoopBack 0

[R1-LoopBack0]ip add 1.1.1.1 24

[R1-LoopBack0]q

[R1]ip route-static 192.168.10.0 24 11.0.0.2

[R1]ip route-static 192.168.20.0 24 11.0.0.2 p 70

[R1]ip route-static 192.168.10.0 24 12.0.0.2 p 70

[R1]ip route-static 192.168.20.0 24 12.0.0.2

[R1]int g0/0/0

[R1-GigabitEthernet0/0/0]shutdown (切断线路,抓包验证

道阻且长,行则将至!加油! --不是冷漠
原文地址:https://www.cnblogs.com/bushilengmo/p/13214693.html