【ENSP模拟器】ENSP——VRRP的配置示例

本篇主要讲解的是VRRP协议的配置过程和VRRP的几个小实验。

(1)案例1:基础VRRP

完成简单并且基础的VRRP配置

【ENSP模拟器】ENSP——VRRP的配置示例_第1张图片

#
sysname R2
#
interface GigabitEthernet0/0/2
 ip address 192.168.1.253 255.255.255.0
 vrrp vrid 1 virtual-ip 192.168.1.254
 vrrp vrid 1 priority 120
 vrrp vrid 1 preempt-mode timer delay 60
#
sysname R3
#
interface GigabitEthernet0/0/1
 ip address 192.168.1.252 255.255.255.0
 vrrp vrid 1 virtual-ip 192.168.1.254

检查:

display vrrp:在R1上使用检查一下配置结果;

display vrrp brief:在R2上检查VRRP的运行状态。

(2)案例2:监视上行链路

之前介绍了,Master路由器会周期性的发送VRRP报文,以便告知同一个VRRP组中的Backup路由器自己的存活情况。缺省时,VRRP时无法感知的上行链路是否发送故障或者是上行接口故障,所以一旦发送故障,PC机发送的数据包仍然转发给失效的接口,所以我们可以在VRRP路由器上配置VRRP监视(Track)功能,通过这个功能来监视上行接口,当感知到接口的切换到Down时,会自动将VRRP的优先级减去一个值,从而使Backup上位。

【ENSP模拟器】ENSP——VRRP的配置示例_第2张图片

#
sysname R1
#
interface GigabitEthernet0/0/1
 ip address 192.168.1.253 255.255.255.0
 vrrp vrid 1 virtual-ip 192.168.1.254
 vrrp vrid 1 priority 120
 vrrp vrid 1 track interface GigabitEthernet0/0/0 reduced 30 #监视命令,若接口Down则优先级-30
#
sysname R2
#
interface GigabitEthernet0/0/2
 ip address 192.168.1.252 255.255.255.0
 vrrp vrid 1 virtual-ip 192.168.1.254

(3)案例3:在路由器子接口上部署VRRP

正常情况下从PC到达外部网络的数据始终被发往Master路由器,在Master路由器发送故障之前,Backup路由器始终不承担数据转发任务,交换机与Backup路由器之间的这段链路也不会承担业务数据,这就造成了设备资源和链路带宽的浪费。在某些网络中,网关路由器的性能以及链路的带宽足以承载所有的业务流量,这种一主一备的VRRP工作方式确实能够满足需求,然而当业务流量特别大而路由器的性能及链路带宽又存在瓶颈时,就不得不考虑让另一台路由器也参与到业务流量转发的工作中来。

【ENSP模拟器】ENSP——VRRP的配置示例_第3张图片

#
sysname SW1
#
vlan batch 10 20
#
interface Ethernet0/0/1
 port link-type access
 port default vlan 20
#
interface Ethernet0/0/2
 port link-type access
 port default vlan 10
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
sysname R1
#
interface GigabitEthernet0/0/1.10
 dot1q termination vid 10
 dot1q vrrp vid 10 #(重要)
 ip address 192.168.10.253 255.255.255.0
 vrrp vrid 10 virtual-ip 192.168.10.254
 vrrp vrid 10 priority 120
 arp broadcast enable
#
interface GigabitEthernet0/0/1.20
 dot1q termination vid 20
 dot1q vrrp vid 20 #(重要)
 ip address 192.168.20.253 255.255.255.0
 vrrp vrid 20 virtual-ip 192.168.20.254
 arp broadcast enable
#
sysname R2
#
interface GigabitEthernet0/0/2.10
 dot1q termination vid 10
 dot1q vrrp vid 10 #(重要)
 ip address 192.168.10.252 255.255.255.0
 vrrp vrid 10 virtual-ip 192.168.10.254
 arp broadcast enable
#
interface GigabitEthernet0/0/2.20
 dot1q termination vid 20
 dot1q vrrp vid 20 #(重要)
 ip address 192.168.20.252 255.255.255.0
 vrrp vrid 20 virtual-ip 192.168.20.254
 vrrp vrid 20 priority 120
 arp broadcast enable

(4)案例4:在三层交换机上部署VRRP

实际上,许多交换机及防火墙产品也是支持VRRP的,在传统的双核心园区网络中,企业会部署两台核心层交换机作为内网用户的网关设备,并在这两台交换机上采用VRRP来实现网关的冗余,这以及成为一个经典的解决方案。

【ENSP模拟器】ENSP——VRRP的配置示例_第4张图片

#
sysname SW1
#
vlan batch 10 20
#
interface Ethernet0/0/1
 port link-type access
 port default vlan 10
#
interface Ethernet0/0/2
 port link-type access
 port default vlan 20
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
sysname SW2
#
vlan batch 10 20
#
interface Vlanif10
 ip address 192.168.10.253 255.255.255.0
 vrrp vrid 10 virtual-ip 192.168.10.254
 vrrp vrid 10 priority 120
#
interface Vlanif20
 ip address 192.168.20.253 255.255.255.0
 vrrp vrid 20 virtual-ip 192.168.20.254
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
sysname SW3
#
vlan batch 10 20
#
interface Vlanif10
 ip address 192.168.10.252 255.255.255.0
 vrrp vrid 10 virtual-ip 192.168.10.254
#
interface Vlanif20
 ip address 192.168.20.252 255.255.255.0
 vrrp vrid 20 virtual-ip 192.168.20.254
 vrrp vrid 20 priority 120
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094

 

你可能感兴趣的:(网络及路由交换)