VRRP原理及配置

VRRP基本概述

VRRP能够在不改变组网的情况下,将多台路由器虚拟成一个虚拟路由器,通过配置虚拟路由器的IP地址为默认网关,实现网关的备份。

协议版本:VRRPv2 和VRRPv3

VRRPv2仅适用于IPv4网络,VRRPv3适用于IPv4和IPv6网络

VRRP协议报文:只有一种报文 Advertisement报文,其目的IP地址是224.0.0.18,目的MAC地址是01-00-5e-00-00-12,协议号112。

 VRRP基本结构

VRRP原理及配置

 

 

 VRRP状态机

VRRP原理及配置

 

 

 

开启VRRP的设备有三种状态:

  • Initialize:初始化状态,设备刚开机或宕机。
  • Backup:备份状态,设备进行VRRP协商的状态
  • Master:主状态,设备处于转发状态,是优先级最高的Backup设备。

 

 

 

 

VRRP配置实现

VRRP原理及配置

 

 

##SW3##

[SW3]vlan bat 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.

[SW3]int e0/0/1
[SW3-Ethernet0/0/1]p l a
[SW3-Ethernet0/0/1]p d v 10
[SW3-Ethernet0/0/1]un sh
Info: Interface Ethernet0/0/1 is not shutdown.


[SW3-Ethernet0/0/1]int e0/0/2
[SW3-Ethernet0/0/2]p l a
[SW3-Ethernet0/0/2]p d v 20
[SW3-Ethernet0/0/2]un sh
Info: Interface Ethernet0/0/2 is not shutdown.


[SW3-Ethernet0/0/2]int g0/0/1
[SW3-GigabitEthernet0/0/1]p l t
[SW3-GigabitEthernet0/0/1]p t a v 10 20
[SW3-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.


[SW3-GigabitEthernet0/0/1]int g0/0/2
[SW3-GigabitEthernet0/0/2]p l t
[SW3-GigabitEthernet0/0/2]p t a v 10 20
[SW3-GigabitEthernet0/0/2]un sh
Info: Interface GigabitEthernet0/0/2 is not shutdown.

 

 

 

##SW1##
[SW1]vlan bat 10 20 100
Info: This operation may take a few seconds. Please wait for a moment...done.

[SW1]int g0/0/1 [SW1-GigabitEthernet0/0/1]p l a [SW1-GigabitEthernet0/0/1]p d v 100 [SW1-GigabitEthernet0/0/1]un sh Info: Interface GigabitEthernet0/0/1 is not shutdown.
[SW1-GigabitEthernet0/0/1]int g0/0/2 [SW1-GigabitEthernet0/0/2]p l t [SW1-GigabitEthernet0/0/2]p t a v 10 20 [SW1-GigabitEthernet0/0/2]un sh Info: Interface GigabitEthernet0/0/2 is not shutdown.
[SW1-GigabitEthernet0/0/2]int vlanif10 [SW1-Vlanif10]ip add 192.168.10.10 24 [SW1-Vlanif10]vrrp vrid 1 virtual [SW1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1 [SW1-Vlanif10]vrrp vrid 1 priority 120 [SW1-Vlanif10]vrrp vrid 1 track interface g0/0/1 [SW1-Vlanif10]vrrp vrid 1 track interface g0/0/2
[SW1-Vlanif10]int vlanif20 [SW1-Vlanif20]ip add 192.168.20.10 24 [SW1-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1 [SW1-Vlanif20]vrrp vrid 2 priority 115
[SW1-Vlanif20]int vlanif 100 [SW1-Vlanif100]ip add 11.0.0.2 30 [SW1-Vlanif100]q [SW1]ip route-static 0.0.0.0 0.0.0.0 11.0.0.1

  

##SW2##
[SW2]vlan bat 10 20 100
Info: This operation may take a few seconds. Please wait for a moment...done.

[SW2]int g0/0/1
[SW2-GigabitEthernet0/0/1]p l a
[SW2-GigabitEthernet0/0/1]p d v 100
[SW2-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.

[SW2-GigabitEthernet0/0/1]int g0/0/2
[SW2-GigabitEthernet0/0/2]p l t	
[SW2-GigabitEthernet0/0/2]p t a v 10 20
[SW2-GigabitEthernet0/0/2]un sh
Info: Interface GigabitEthernet0/0/2 is not shutdown.

[SW2-GigabitEthernet0/0/2]int vlanif 10
[SW2-Vlanif10]ip add 192.168.10.20 24	
[SW2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1	
[SW2-Vlanif10]vrrp vrid 1 priority 115

[SW2-Vlanif10]int vlanif20
[SW2-Vlanif20]ip add 192.168.20.20 24
[SW2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1	
[SW2-Vlanif20]vrrp vrid 2 priority 120	
[SW2-Vlanif20]vrrp vrid 2 track interface g0/0/1
[SW2-Vlanif20]vrrp vrid 2 track interface g0/0/2

[SW2-Vlanif20]int vlanif100
[SW2-Vlanif100]ip add 12.0.0.2 30
[SW2-Vlanif100]q

[SW2]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1

  

##R1##
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 11.0.0.1 30

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

[R1-GigabitEthernet0/0/1]int loo 0
[R1-LoopBack0]ip add 1.1.1.1 24

[R1]ip route-static 192.168.10.0 24 11.0.0.2
[R1]ip route-static 192.168.10.0 24 12.0.0.2 pre 70
[R1]ip route-static 192.168.20.0 24 12.0.0.2
[R1]ip route-static 192.168.20.0 24 11.0.0.2 pre 70

  

 

上一篇:eNSP:OSPF基本配置(单区域配置,多区域配置,DR&BDR选举)


下一篇:eNSP:RIP基本配置