VRRP

VRRP概述

Virtual Router Redundancy Protocol,即虚拟路由器冗余协议。利用VRRP,一组路由器(同一个LAN中的接口)协同工作,但只有一个处于Master状态,处于该状态的路由器(的接口)承担实际的数据流量转发任务。在一个VRRP组内的多个路由器接口一个虚拟IP地址,该地址被作为局域网内所有主句的缺省网关地址。VRRP决定哪个路由器是Master,Master路由器负责接收发送至用户网关的数据包并进行转发,以及响应PC对于其网关IP地址的ARP请求。Backup路由器侦听Master路由器的状态,并在Master路由器发生故障时,接替其工作,从而保证业务流量的平滑切换。

VRRP的工作过程

VRRP组中的设备选举出Master,Master设备通过发送免费ARP报文,将虚拟MAC地址通知给与它连接的设备或者主机。Master设备周期性向备份组内所有Backup设备发送VRRP通告报文。如果Master设备出现故障,VRRP备份组中的Backup设备选举新的Master。VRRP组状态切换时,Master设备由一台设备切换另外一台设备,新的Master设备会立即发送携带虚拟路由器的虚拟MAC地址和虚拟IP地址信息的免费ARP报文,刷新与它连接的主机或设备中的MAC表项,从而把用户流量引到新的Master设备上来,整个过程对用户完全透明。原Master设备故障恢复时,若该设备为IP地址的拥有者(则其优先级为255),将直接切换至Master状态。若该设备优先级小于255,将首先切换至Backup状态,且其优先级恢复为故障前配置的优先级。Backup设备的优先级高于Master设备时,由Backup设备的工作方式(抢占方式和非抢占方式)决定是否重新选举Master。

VRRP

VRRP路由器
运行VRRP的路由器。一台VRRP路由器(的接口)可以同时参与到多个VRRP组中,在不同的组中一台VRRP路由器可以充当不同角色。
VRRP组
一个VRRP组由多个VRRP路由器组成,使用相同的VRID进行标识,属于同一个VRRP组的VRRP路由器互相交换信息,每个VRRP组中只能有一个Master。
虚拟路由器
对于每一个VRRP组抽象出来的一个逻辑路由器,该路由器充当网络用户的网关,该路由器并非真实存在,事实上对于用户而言,只需知道虚拟路由器的IP,至于具体的虚拟路由器的角色谁来承担、数据转发任务由谁来承担、Master故障后谁来接替,这是VRRP的工作。

VRRP术语

虚拟IP地址、MAC地址:
虚拟IP地址就是虚拟路由器的IP地址,该地址实际上就是用户的网关地址
虚拟MAC地址时虚拟路由器根据VRID生成的MAC地址。一个虚拟路由器拥有一个虚拟MAC地址,格式为:00-00-5E-00-01-{VRID}。
Master、Backup路由器:
Master路由器:在VRRP组职工实际转发数据包的路由器,在每一个VRRP组中,仅有Master响应对虚拟IP地址的ARP请求。Master路由器同时以一定的时间间隔发送VRRP消息,一边通知Backup路由器自己的存活情。
Backup路由器:处于监听状态的路由器,一旦Master路由器出现故障,Backup路由器即开始接替工作。
选举依据:先比较接口VRRP优先级(比大),如果相等,则比较接口IP地址(比大)。
虚拟MAC地址
通过VRRP形成的虚拟路由器使用虚拟IP地址和虚拟MAC与网络的PC通信,虚拟MAC的格式如下:最后一个字节的VRID标识虚拟路由器ID的16进制。
VRRP状态机
VRRP协议的状态共有三种分别是Initialize,Master,Backup,初始状态都是Initialize,通过比较优先级产生Master和Backup,在规定时间内,Backup若没有收到Master发来的心跳报文,切换为Master。

Master/Backup路由器
Master路由器:
定时发送VRRP通告报文,以便向Backup路由器告知自己的存货情况。以虚拟MAC地址响应其他设备对虚拟IP地址的ARP请求,转发目的MAC地址为虚拟MAC地址的IP报文。
如果它是这个虚拟IP地址的拥有者(接口实际IP地址为虚拟IP地址),则接收目的IP地址为这个虚拟IP地址的IP报文。否则,丢弃这个IP报文。如果收到比自己优先级大的报文,立即成为Backup
如果收到与自己优先级相等的VRRP报文且本地接口IP地址小于对接端口IP,立即成为Backup。
Backup路由器:
接收Master设备发送的VRRP报文通告报文,判断Master设备的状态是否正常;对虚拟IP地址的ARP请求,不做响应;丢弃目的IP地址为虚拟IP地址的IP报文。如果收到优先级和自己相同或者比自己大的报文,则重置Master-DownInterval定时器,不进一步比较IP地址;如果收到比自己优先级小的报文且该报文优先级为0时,定时器时间设置为Skew-time(偏移时间),如果该报文优先级不是0,丢弃报文,立刻成为Master。

路由器的三种状态的示意图
VRRP协议的状态共有三种,分别是Initialize,Master,Backup,初始状态都是 Initialize,通过比较优先级产生Master和Backup,在规定时间内,Backup若没有收 到Master发来的心跳报文,将切换Master。

VRRP工作原理

VRRP组中的设备选举出Master。Master设备通过发送免费ARP报文,将虚拟MAC地址通知给与它连接的设备或者主机,从而承担报文转发任务。Master设备周期性向备份组内所有Backup设备发送VRRP通告报文。如果Master设备出现故障,VRRP备份组中的Backup设备重新选举新的Master。VRRP组状态切换时,Master设备由一台设备切换为另外一台设备,新的Master设备会立即发送携带虚拟路由器的虚拟MAC地址和虚拟IP地址信息的免费ARP报文,刷新与它连接的主机或设备中的MAC表项,从而把用户流量引到新的Master设备 上来,整个过程对用户完全透明。原Master设备故障恢复时,若该设备为IP地址拥有者(则其优先级为255),将直接切换至Master状态。若该设备优先级小于255,将首先切换至Backup状态,且其优先级恢复为故障前配置的优先级。Backup设备的优先级高于Master设备时,由Backup设备的工作方式(抢占方式和非抢占方式)决定是否重新选举Master。

抢占

R2加入到网络后,接口的VRRP状态首先过渡到Backup,在收到R1发送的 VRRP报文后,由于本地接口的VRRP优先级大于报文中的优先级,因此如果设备激活Preempt(缺省启用)则可立即抢占Master的角色,过渡到 Master状态,R2开始发送VRRP消息。可修改抢占延迟时间,缺省时间为0s。

路由器的选举

(1)VRRP根据优先级来确定虚拟路由器中每台路由器的角色(Master路由器或Backup路由器)。优先级越高,则越有可能成为Master路由器。
(2)初始创建的路由器工作在Backup状态,通过VRRP报文的交互获知虚拟路由器中其他成员的优先级:如果VRRP报文中Master路由器的优先级高于自己的优先级,则路由器保持在Backup状态;
(3)如果VRRP报文中Master路由器的优先级低于自己的优先级,采用抢占工作方式的路由器将抢占成为Master状态,周期性地发送VRRP报文,采用非抢占工作方式的路由器仍保持Backup状态;
如果在一定时间内没有收到心跳报文(每1s发送一次),则路由器切换为Master状态。
(4)VRRP优先级的取值范围为0到255(数值越大表明优先级越高),可配置的范围是1到254,优先级0为系统保留给路由器放弃Master位置时候使用,255则是系统保留给IP地址拥有者使用。当路由器为IP地址拥有者时,其优先级始终为255。因此,当虚拟路由器内存在IP地址拥有者时,只要其工作正常,则为Master路由器。

实验一

SW1

The device is running!<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info
[Huawei]undo info-center en
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]sys SW1
[SW1]int e0/0/3
[SW1-Ethernet0/0/3]p l a
[SW1-Ethernet0/0/3]p d v 10
Error: The VLAN does not exist.
[SW1-Ethernet0/0/3]q
[SW1]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]int e0/0/3
[SW1-Ethernet0/0/3]p d v 10
[SW1-Ethernet0/0/3]int e0/0/4
[SW1-Ethernet0/0/4]p l a
[SW1-Ethernet0/0/4]p d v 20
[SW1-Ethernet0/0/4]int e0/0/1
[SW1-Ethernet0/0/1]p l t
[SW1-Ethernet0/0/1]p t a v a
[SW1-Ethernet0/0/1]int e0/0/2
[SW1-Ethernet0/0/2]p l t
[SW1-Ethernet0/0/2]p t a v a
[SW1-Ethernet0/0/2] User interface con0 is availablePlease Press ENTER.<SW1>sys
Enter system view, return user view with Ctrl+Z.
[SW1]dis vrrp b
[SW1]dis vrrp br
[SW1]dis vrrp brief
Info: No VRRP backup group is configured with a virtual IPv4 address.
[SW1] User interface con0 is availablePlease Press ENTER.<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys sw1
[sw1]undo in
Apr 12 2021 19:40:36-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 4, the c
hange loop count is 0, and the maximum number of records is 4095.fo
[sw1]undo info-center en
[sw1]undo info-center enable
Info: Information center is disabled.
[sw1]int e0/0/3
[sw1-Ethernet0/0/3]d l a
Error: The license file does not exist.
[sw1-Ethernet0/0/3]q
[sw1]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1]into e 0/0/3^
Error: Unrecognized command found at '^' position.
[sw1]int e0/0/3
[sw1-Ethernet0/0/3]d l a
Error: The license file does not exist.
[sw1-Ethernet0/0/3]p l a
[sw1-Ethernet0/0/3]p d v 10
[sw1-Ethernet0/0/3]int e0/0/4
[sw1-Ethernet0/0/4]p l a
[sw1-Ethernet0/0/4]p d v 20
[sw1-Ethernet0/0/4]int e0/0/1
[sw1-Ethernet0/0/1]p l t
[sw1-Ethernet0/0/1]p t a v a
[sw1-Ethernet0/0/1]int e0/0/2
[sw1-Ethernet0/0/2]p l t
[sw1-Ethernet0/0/2]p t a v a
[sw1-Ethernet0/0/2] User interface con0 is available

R1

[R1-GigabitEthernet0/0/0.2]vrrp vrid 1 track interface g0/0/0 reduced 20
Error: The VRRP does not exist.
[R1-GigabitEthernet0/0/0.2]q
[R1]int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]vrrp vrid 1 track interface g0/0/0 reduced 20
[R1-GigabitEthernet0/0/0.1]undo vrrp vrid 1 track interface g0/0/0 reduced 20^
Error:Too many parameters found at '^' position.
[R1-GigabitEthernet0/0/0.1]q
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]undo shutdown
[R1-GigabitEthernet0/0/0]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<R1>
<R1>int g0/0/0^
Error: Unrecognized command found at '^' position.
<R1>sys
Enter system view, return user view with Ctrl+Z.
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]shutdown
[R1-GigabitEthernet0/0/0]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<R1>sys
Enter system view, return user view with Ctrl+Z.
[R1]int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]dis this
[V200R003C00]
#
interface GigabitEthernet0/0/0.1dot1q termination vid 10ip address 192.168.1.253 255.255.255.0 vrrp vrid 1 virtual-ip 192.168.1.254vrrp vrid 1 priority 110vrrp vrid 1 track interface GigabitEthernet0/0/1 reduced 20vrrp vrid 1 track interface GigabitEthernet0/0/0 reduced 20arp broadcast enable
#
return
[R1-GigabitEthernet0/0/0.1]undo vrrp vrid 1 track interface GigabitEthernet0/0/1reduced 20^
Error:Too many parameters found at '^' position.
[R1-GigabitEthernet0/0/0.1]
[R1-GigabitEthernet0/0/0.1]undo vrrp vrid 1 track interface GigabitEthernet0/0/1reduced
Error: The interface to be deleted is not in the tracked interface list of the V
RRP.
[R1-GigabitEthernet0/0/0.1]undo vrrp vrid 1 track interface GigabitEthernet0/0/1reduced ?<cr>  Please press ENTER to execute command
[R1-GigabitEthernet0/0/0.1]undo vrrp vrid 1 track interface GigabitEthernet0/0/1reduced
Error: The interface to be deleted is not in the tracked interface list of the V
RRP.
[R1-GigabitEthernet0/0/0.1]undo vrrp vrid 1 track interface GigabitEthernet0/0/0reduced 20^
Error:Too many parameters found at '^' position.
[R1-GigabitEthernet0/0/0.1]
[R1-GigabitEthernet0/0/0.1]undo vrrp vrid 1 track interface GigabitEthernet0/0/0reduced
Error: The interface to be deleted is not in the tracked interface list of the V
RRP.
[R1-GigabitEthernet0/0/0.1]q
[R1]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<R1>sys
Enter system view, return user view with Ctrl+Z.
[R1]int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]dis this
[V200R003C00]
#
interface GigabitEthernet0/0/0.1dot1q termination vid 10ip address 192.168.1.253 255.255.255.0 vrrp vrid 1 virtual-ip 192.168.1.254vrrp vrid 1 priority 110vrrp vrid 1 track interface GigabitEthernet0/0/1 reduced 20vrrp vrid 1 track interface GigabitEthernet0/0/0 reduced 20arp broadcast enable
#
return
[R1-GigabitEthernet0/0/0.1]int g0/0/0.2
[R1-GigabitEthernet0/0/0.2]dis this
[V200R003C00]
#
interface GigabitEthernet0/0/0.2dot1q termination vid 20ip address 192.168.2.252 255.255.255.0 vrrp vrid 2 virtual-ip 192.168.2.254vrrp vrid 2 preempt-mode timer delay 10vrrp vrid 2 track interface GigabitEthernet0/0/1 reduced 20vrrp vrid 2 track interface GigabitEthernet0/0/0 reduced 20arp broadcast enable
#
return
[R1-GigabitEthernet0/0/0.2]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<R1>
<R1>
<R1>sys
Enter system view, return user view with Ctrl+Z.
[R1]
[R1]
[R1]ip route-static 0.0.0.0 0 192.168.10.1
[R1]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<R1>######
<Huawei>
<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysR2^
Error: Unrecognized command found at '^' position.
[Huawei]SYS R1
[R1]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[R1]int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]ip a 192.168.1.253^
Error:Incomplete command found at '^' position.
[R1-GigabitEthernet0/0/0.1]ip a 192.168.1.253 24
[R1-GigabitEthernet0/0/0.1]d t v 10
Apr 12 2021 19:47:01-08:00 R1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/0.1 has entered the UP state.
[R1-GigabitEthernet0/0/0.1]a b e
[R1-GigabitEthernet0/0/0.1]vrrp v
[R1-GigabitEthernet0/0/0.1]vrrp vrid 1 vir
[R1-GigabitEthernet0/0/0.1]vrrp vrid 1 virtual-ip 192.168.1.254
[R1-GigabitEthernet0/0/0.1]vrrp
Apr 12 2021 19:47:31-08:00 R1 VRRP/2/VRRPCHANGETOMASTER:OID 16777216.50331648.10
0663296.16777216.33554432.16777216.1140850688.0.16777216 The status of VRRP chan
ged to master. (VrrpIfIndex=218103808, VrId=16777216, IfIndex=218103808, IPAddre
ss=253.1.168.192, NodeName=R1, IfName=GigabitEthernet0/0/0.1, ChangeReason=proto
col timer expired(GigabitEthernet0/0/0.1 up))
[R1-GigabitEthernet0/0/0.1]vrrp
Apr 12 2021 19:47:31-08:00 R1 %%01VRRP/4/STATEWARNINGEXTEND(l)[3]:Virtual Routerstate BACKUP changed to MASTER, because of protocol timer expired. (Interface=G
igabitEthernet0/0/0.1, VrId=16777216, InetType=IPv4)
[R1-GigabitEthernet0/0/0.1]vrrp vrid 1 pri
[R1-GigabitEthernet0/0/0.1]vrrp vrid 1 priority 110
[R1-GigabitEthernet0/0/0.1]int g0/0/0.2
[R1-GigabitEthernet0/0/0.2]ip a 192.168.2.252^
Error:Incomplete command found at '^' position.
[R1-GigabitEthernet0/0/0.2]ip a 192.168.2.252 24
[R1-GigabitEthernet0/0/0.2]d t v 20
Apr 12 2021 19:48:31-08:00 R1 %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP
on the interface GigabitEthernet0/0/0.2 has entered the UP state.
[R1-GigabitEthernet0/0/0.2]a b e
[R1-GigabitEthernet0/0/0.2]vrrp vrid 2 vir
[R1-GigabitEthernet0/0/0.2]vrrp vrid 2 virtual-ip 192.168.2.254
[R1-GigabitEthernet0/0/0.2]v
Apr 12 2021 19:49:00-08:00 R1 VRRP/2/VRRPCHANGETOMASTER:OID 16777216.50331648.10
0663296.16777216.33554432.16777216.1140850688.0.16777216 The status of VRRP chan
ged to master. (VrrpIfIndex=234881024, VrId=33554432, IfIndex=234881024, IPAddre
ss=253.1.168.192, NodeName=R1, IfName=GigabitEthernet0/0/0.2, ChangeReason=proto
col timer expired(GigabitEthernet0/0/0.2 up))
[R1-GigabitEthernet0/0/0.2]v
Apr 12 2021 19:49:00-08:00 R1 %%01VRRP/4/STATEWARNINGEXTEND(l)[5]:Virtual Routerstate BACKUP changed to MASTER, because of protocol timer expired. (Interface=G
igabitEthernet0/0/0.2, VrId=33554432, InetType=IPv4)
[R1-GigabitEthernet0/0/0.2]vrrp vrid 2 preept-m
[R1-GigabitEthernet0/0/0.2]vrrp vrid 2 preempt-mode t
[R1-GigabitEthernet0/0/0.2]vrrp vrid 2 preempt-mode timer delay 10
[R1-GigabitEthernet0/0/0.2]q
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip a 192.168.10.254 24
[R1-GigabitEthernet0/0/1]
Apr 12 2021 19:50:18-08:00 R1 %%01IFNET/4/LINK_STATE(l)[6]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R1-GigabitEthernet0/0/1]
Apr 12 2021 19:52:56-08:00 R1 VRRP/2/VRRPMASTERDOWN:OID 16777216.50331648.100663
296.16777216.67108864.16777216.3674669056.83886080.419430400.2130706432.33554432
.503316480.16777216 The state of VRRP changed from master to other state. (VrrpI
fIndex=234881024, VrId=33554432, IfIndex=234881024, IPAddress=253.1.168.192, Nod
eName=R1, IfName=GigabitEthernet0/0/0.2, CurrentState=Backup, ChangeReason=prior
ity calculation)
[R1-GigabitEthernet0/0/1]
Apr 12 2021 19:52:56-08:00 R1 %%01VRRP/4/STATEWARNINGEXTEND(l)[7]:Virtual Routerstate MASTER changed to BACKUP, because of priority calculation. (Interface=Gig
abitEthernet0/0/0.2, VrId=33554432, InetType=IPv4)
[R1-GigabitEthernet0/0/1]q
[R1]ip route-s
[R1]ip route-static 3.3.3.3 32 192.168.10.1
[R1]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<R1>sys
Enter system view, return user view with Ctrl+Z.
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]shutdown
Apr 12 2021 20:01:32-08:00 R1 %%01IFPDT/4/IF_STATE(l)[0]:Interface GigabitEthern
et0/0/0 has turned into DOWN state.
[R1-GigabitEthernet0/0/0]
[R1-GigabitEthernet0/0/0]
Apr 12 2021 20:01:32-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0.1 has entered the DOWN state.
[R1-GigabitEthernet0/0/0]
Apr 12 2021 20:01:32-08:00 R1 %%01VRRP/4/STATEWARNINGEXTEND(l)[2]:Virtual Routerstate MASTER changed to INITIALIZE, because of interface down. (Interface=Gigab
itEthernet0/0/0.1, VrId=16777216, InetType=IPv4)
[R1-GigabitEthernet0/0/0]
Apr 12 2021 20:01:32-08:00 R1 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet0/0/0.2 has entered the DOWN state.
[R1-GigabitEthernet0/0/0]
Apr 12 2021 20:01:32-08:00 R1 VRRP/2/VRRPMASTERDOWN:OID 16777216.50331648.100663
296.16777216.67108864.16777216.3674669056.83886080.419430400.2130706432.33554432
.503316480.16777216 The state of VRRP changed from master to other state. (VrrpI
fIndex=218103808, VrId=16777216, IfIndex=218103808, IPAddress=253.1.168.192, Nod
eName=R1, IfName=GigabitEthernet0/0/0.1, CurrentState=Initialize, ChangeReason=i
nterface down)
[R1-GigabitEthernet0/0/0]q
[R1]ip route-sta
[R1]ip route-static 192.168.2.0 24 192.168.10.1
[R1]

R2

interface GigabitEthernet0/0/0.1dot1q termination vid 10ip address 192.168.1.252 255.255.255.0 vrrp vrid 1 virtual-ip 192.168.1.254vrrp vrid 1 preempt-mode timer delay 10arp broadcast enable
#
interface GigabitEthernet0/0/0.2dot1q termination vid 20ip address 192.168.2.253 255.255.255.0 vrrp vrid 2 virtual-ip 192.168.2.254vrrp vrid 2 priority 110arp broadcast enable
#
interface GigabitEthernet0/0/1ip address 192.168.20.254 255.255.255.0
#
interface NULL0
#
ip route-static 0.0.0.0 0.0.0.0 192.168.20.1
ip route-static 3.3.3.3 255.255.255.255 192.168.20.1
#
user-interface con 0authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return<R2>sys
[R2]undo ip route-static 0.0.0.0 0 192.168.20.1
[R2]dis cu
[V200R003C00]
#sysname R2
#snmp-agent local-engineid 800007DB03000000000000snmp-agent
#clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#drop illegal-mac alarm
#undo info-center enable
#
vlan batch 10 20
#set cpu-usage threshold 80 restore 75
#
aaa authentication-scheme defaultauthorization-scheme defaultaccounting-scheme defaultdomain default domain default_admin local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$local-user admin service-type http
#
firewall zone Localpriority 15
#
interface Ethernet0/0/0
#
interface Ethernet0/0/1
#
interface Ethernet0/0/2
#
interface Ethernet0/0/3
#
interface Ethernet0/0/4
#
interface Ethernet0/0/5
#
interface Ethernet0/0/6
#
interface Ethernet0/0/7
#
interface GigabitEthernet0/0/0
#
interface GigabitEthernet0/0/0.1dot1q termination vid 10ip address 192.168.1.252 255.255.255.0 vrrp vrid 1 virtual-ip 192.168.1.254vrrp vrid 1 preempt-mode timer delay 10arp broadcast enable
#
interface GigabitEthernet0/0/0.2dot1q termination vid 20ip address 192.168.2.253 255.255.255.0 vrrp vrid 2 virtual-ip 192.168.2.254vrrp vrid 2 priority 110arp broadcast enable
#
interface GigabitEthernet0/0/1ip address 192.168.20.254 255.255.255.0
#
interface NULL0
#
ip route-static 3.3.3.3 255.255.255.255 192.168.20.1
#
user-interface con 0authentication-mode password
user-interface vty 0 4<Huawei>SYS
Enter system view, return user view with Ctrl+Z.
[Huawei]SYS R2
[R2]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<R2>
<R2>
<R2>sys
Enter system view, return user view with Ctrl+Z.
[R2]int g0/0/0.1
[R2-GigabitEthernet0/0/0.1]ip a 192.168.1.252 24
[R2-GigabitEthernet0/0/0.1]d t v 10
Apr 12 2021 19:50:57-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0.1 has entered the UP state.
[R2-GigabitEthernet0/0/0.1]a b e
[R2-GigabitEthernet0/0/0.1]vrrp vrid 1 vir
[R2-GigabitEthernet0/0/0.1]vrrp vrid 1 virtual-ip 192.168.1.254
[R2-GigabitEthernet0/0/0.1]vrrp vrid 1 pree
[R2-GigabitEthernet0/0/0.1]vrrp vrid 1 preempt-mode t
[R2-GigabitEthernet0/0/0.1]vrrp vrid 1 preempt-mode timer delay 10
[R2-GigabitEthernet0/0/0.1]int g0/0/0.2
[R2-GigabitEthernet0/0/0.2]ip a 192.168.2.253 24
[R2-GigabitEthernet0/0/0.2]d t v 20
Apr 12 2021 19:52:03-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0.2 has entered the UP state.
[R2-GigabitEthernet0/0/0.2]a b e
[R2-GigabitEthernet0/0/0.2]vrrp vrid 2 virtu
[R2-GigabitEthernet0/0/0.2]vrrp vrid 2 virtual-ip 192.168.2.254
[R2-GigabitEthernet0/0/0.2]vrrp vrid 2 pri
[R2-GigabitEthernet0/0/0.2]vrrp vrid 2 priority 110
[R2-GigabitEthernet0/0/0.2]
Apr 12 2021 19:52:56-08:00 R2 VRRP/2/VRRPCHANGETOMASTER:OID 16777216.50331648.10
0663296.16777216.33554432.16777216.1140850688.0.16777216 The status of VRRP chan
ged to master. (VrrpIfIndex=234881024, VrId=33554432, IfIndex=234881024, IPAddre
ss=252.1.168.192, NodeName=R2, IfName=GigabitEthernet0/0/0.2, ChangeReason=prior
ity calculation(GigabitEthernet0/0/0.2 up))
[R2-GigabitEthernet0/0/0.2]
Apr 12 2021 19:52:56-08:00 R2 %%01VRRP/4/STATEWARNINGEXTEND(l)[2]:Virtual Routerstate BACKUP changed to MASTER, because of priority calculation. (Interface=Gig
abitEthernet0/0/0.2, VrId=33554432, InetType=IPv4)
[R2-GigabitEthernet0/0/0.2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip a 192.168.20.254 24
Apr 12 2021 19:53:15-08:00 R2 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R2-GigabitEthernet0/0/1]q
[R2]ip route-s
[R2]ip route-static 3.3.3.3 32 192.168.20.1
[R2]
Apr 12 2021 20:01:35-08:00 R2 VRRP/2/VRRPCHANGETOMASTER:OID 16777216.50331648.10
0663296.16777216.33554432.16777216.1140850688.0.16777216 The status of VRRP chan
ged to master. (VrrpIfIndex=218103808, VrId=16777216, IfIndex=218103808, IPAddre
ss=252.1.168.192, NodeName=R2, IfName=GigabitEthernet0/0/0.1, ChangeReason=proto
col timer expired(GigabitEthernet0/0/0.1 up))
[R2]
Apr 12 2021 20:01:35-08:00 R2 %%01VRRP/4/STATEWARNINGEXTEND(l)[4]:Virtual Routerstate BACKUP changed to MASTER, because of protocol timer expired. (Interface=G
igabitEthernet0/0/0.1, VrId=16777216, InetType=IPv4)
[R2]

R3

The device is running!<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]int loo
[Huawei]int LoopBack ^
Error:Incomplete command found at '^' position.
[Huawei]int LoopBack 0
[Huawei-LoopBack0]ip add 3.3.3.3 32
[Huawei-LoopBack0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 192.168.10.1 24
Apr 12 2021 16:16:10-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocolIP on the interface GigabitEthernet0/0/0 has entered the UP state.
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 192.168.20.1 24
[Huawei-GigabitEthernet0/0/1]
Apr 12 2021 16:16:23-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocolIP on the interface GigabitEthernet0/0/1 has entered the UP state.
[Huawei-GigabitEthernet0/0/1]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<Huawei>Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]int lo
[Huawei]int LoopBack 0
[Huawei-LoopBack0]ip add 3.3.3.3 32
Error: The address already exists.
[Huawei-LoopBack0]
[Huawei-LoopBack0]
[Huawei-LoopBack0]q
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]
[Huawei]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]ip route-s
[Huawei]ip route-static 0.0.0.0 24 192.168.10.254
[Huawei]ip route-static 0.0.0.0 24 192.168.20.254
[Huawei]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]undo ip route-static 0.0.0.0 24 192.168.10.254
[Huawei]
[Huawei]undo ip route-static 0.0.0.0 24 192.168.20.254
[Huawei]
[Huawei]ip route-static 0.0.0.0 0 192.168.10.254
[Huawei]ip route-static 0.0.0.0 0 192.168.20.254
[Huawei]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]dis this
[V200R003C00]
#snmp-agent local-engineid 800007DB03000000000000snmp-agent
#clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#drop illegal-mac alarm
#undo info-center enable
#set cpu-usage threshold 80 restore 75
#
ip route-static 0.0.0.0 0.0.0.0 192.168.10.254
ip route-static 0.0.0.0 0.0.0.0 192.168.20.254
#
return
[Huawei]dis cu
[V200R003C00]
#snmp-agent local-engineid 800007DB03000000000000snmp-agent
#clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#drop illegal-mac alarm
#undo info-center enable
#set cpu-usage threshold 80 restore 75
#
aaa authentication-scheme defaultauthorization-scheme defaultaccounting-scheme defaultdomain default domain default_admin local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$local-user admin service-type http
#
firewall zone Localpriority 15
#
interface Ethernet0/0/0
#
interface Ethernet0/0/1
#
interface Ethernet0/0/2
#
interface Ethernet0/0/3
#
interface Ethernet0/0/4
#
interface Ethernet0/0/5
#
interface Ethernet0/0/6
#
interface Ethernet0/0/7
#
interface GigabitEthernet0/0/0ip address 192.168.10.1 255.255.255.0
#
interface GigabitEthernet0/0/1ip address 192.168.20.1 255.255.255.0
#
interface NULL0
#
interface LoopBack0ip address 3.3.3.3 255.255.255.255
#
ip route-static 0.0.0.0 0.0.0.0 192.168.10.254
ip route-static 0.0.0.0 0.0.0.0 192.168.20.254
#
user-interface con 0authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
[Huawei]
[Huawei]
[Huawei]
[Huawei]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<Huawei>SYS
Enter system view, return user view with Ctrl+Z.
[Huawei]SYS R3
[R3]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<R3>sys
Enter system view, return user view with Ctrl+Z.
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip a 192.168.10.1 24
Apr 12 2021 19:53:43-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip a 192.168.20.1 24
[R3-GigabitEthernet0/0/1]
Apr 12 2021 19:54:03-08:00 R3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R3-GigabitEthernet0/0/1]int loo
[R3-GigabitEthernet0/0/1]
[R3-GigabitEthernet0/0/1]q
[R3]int loo
[R3]int LoopBack 0
[R3-LoopBack0]ip a 3.3.3.3 32
[R3-LoopBack0]q
[R3]ip route-s
[R3]ip route-static 0.0.0.0 0 192.168.10.254
[R3]ip route-static 0.0.0.0 0 192.168.20.254
[R3]

PC1

SW1和R1shutdown后 PC2

实验二

SW1

[Huawei]sysname sw1
[sw1]vlan b 10 20
[sw1]stp re
[sw1]stp region-configuration
[sw1-mst-region]re
[sw1-mst-region]region-name zwh
[sw1-mst-region]instance 1 vlan 10
[sw1-mst-region]instance 2 vlan 20
[sw1-mst-region]active region-configuration
[sw1-mst-region]q
[sw1]stp mode mstp
[sw1]stp instance 1 root primary
[sw1]stp instance 2 root secondary
[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]p l t
[sw1-GigabitEthernet0/0/1]p t a v a
[sw1-GigabitEthernet0/0/1]int g0/0/2
[sw1-GigabitEthernet0/0/2]p l t
[sw1-GigabitEthernet0/0/2]p t a v a
[sw1-GigabitEthernet0/0/2]q
[sw1]int vlanif 10
[sw1-Vlanif10]ip add 192.168.1.252 24
[sw1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.1.254
[sw1-Vlanif10]vrrp vrid 1 priority 110
[sw1-Vlanif10]int vlan 20
[sw1-Vlanif20]ip add 192.168.2.253 24
[sw1-Vlanif20]vrrp vrid 2 virtual-ip 192.168.2.254
[sw1-Vlanif20]q
[sw1]dis vrrp br
VRID  State        Interface                Type     Virtual IP
----------------------------------------------------------------
1     Master       Vlanif10                 Normal   192.168.1.254
2     Backup       Vlanif20                 Normal   192.168.2.254
----------------------------------------------------------------
Total:2     Master:1     Backup:1     Non-active:0

SW2

[Huawei]sysname sw2
[sw2]vlan b 10 20
[sw2]stp region-configuration
[sw2-mst-region]re
[sw2-mst-region]region-name zwh
[sw2-mst-region]instance 1 vlan 10
[sw2-mst-region]instance 2 vlan 20
[sw2-mst-region]act
[sw2-mst-region]active re
[sw2-mst-region]active region-configuration
[sw2-mst-region]q
[sw2]stp instance 1 root secondary
[sw2]stp instance 2 root primary
[sw2]int g0/0/1
[sw2-GigabitEthernet0/0/1]p l t
[sw2-GigabitEthernet0/0/1]p t a v a
[sw2-GigabitEthernet0/0/1]int g0/0/2
[sw2-GigabitEthernet0/0/2]p l t
[sw2-GigabitEthernet0/0/2]p t a v a
[sw2-GigabitEthernet0/0/2]q
[sw2]int vlan 10
[sw2-Vlanif10]ip add 192.168.1.253 24
[sw2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.1.254
[sw2-Vlanif10]int vlan 20
[sw2-Vlanif20]ip add 192.168.2.252 24
[sw2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.2.254
[sw2-Vlanif20]vrrp vrid 2 priority 110
[sw2-Vlanif20]q
[sw2]dis vrrp brief
VRID  State        Interface                Type     Virtual IP
----------------------------------------------------------------
1     Backup       Vlanif10                 Normal   192.168.1.254
2     Master       Vlanif20                 Normal   192.168.2.254
----------------------------------------------------------------
Total:2     Master:1     Backup:1     Non-active:0

SW3

[Huawei]sysname sw3
[sw3]vlan b 10 20
[sw3]stp region-configuration
[sw3-mst-region]region-name zwh
[sw3-mst-region]instance 1 vlan 10
[sw3-mst-region]instance 2 vlan 20
[sw3-mst-region]q
[sw3]int g0/0/1
[sw3-GigabitEthernet0/0/1]p l t
[sw3-GigabitEthernet0/0/1]p t a v a
[sw3-GigabitEthernet0/0/1]int g0/0/2
[sw3-GigabitEthernet0/0/2]p l t
[sw3-GigabitEthernet0/0/2]p t a v a
[sw3-GigabitEthernet0/0/2]int g0/0/3
[sw3-GigabitEthernet0/0/3]p l a
[sw3-GigabitEthernet0/0/3]p d v 10
[sw3-GigabitEthernet0/0/3]int g0/0/4
[sw3-GigabitEthernet0/0/4]p l a
[sw3-GigabitEthernet0/0/4]p d v 20
[sw3-GigabitEthernet0/0/4]q
[sw3]dis stp brMSTID  Port                        Role  STP State     Protection0    GigabitEthernet0/0/1        ROOT  FORWARDING      NONE0    GigabitEthernet0/0/2        ALTE  DISCARDING      NONE0    GigabitEthernet0/0/3        DESI  FORWARDING      NONE0    GigabitEthernet0/0/4        DESI  FORWARDING      NONE

PC1

PC2

实验三

SW1

[Huawei]sysname sw1
[sw1]vlan b 10 20
[sw1]stp region-configuration
[sw1-mst-region]region-name zwh
[sw1-mst-region]instance 1 vlan 10
[sw1-mst-region]instance 2 vlan 20
[sw1-mst-region]active region-configuration
[sw1-mst-region]q
[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]p l t
[sw1-GigabitEthernet0/0/1]p t a v a
[sw1-GigabitEthernet0/0/1]int vlanif 10
[sw1-Vlanif10]ip add 192.168.1.252 24
[sw1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.1.254
[sw1-Vlanif10]vrrp vrid 1 priority 110
[sw1-Vlanif10]int vlanif 20
[sw1-Vlanif20]ip add 192.168.2.253 24
[sw1-Vlanif20]vrrp vrid 2 virtual-ip 192.168.2.254
[sw1-Vlanif20]q
[sw1]int vlanif 20
[sw1-Vlanif20]dis this
[sw1]dis vrrp 1

SW2

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan b 10 20
[Huawei]stp region-configuration
[Huawei-mst-region]region-name zwh
[Huawei-mst-region]active region-configuration
[Huawei-mst-region]instance 1 vlan 10
[Huawei-mst-region]instance 2 vlan 20
[Huawei-mst-region]int g0/0/1
[Huawei-GigabitEthernet0/0/1]p l t
[Huawei-GigabitEthernet0/0/1]p t a v a
[Huawei-GigabitEthernet0/0/1]int vlanif 10
[Huawei-Vlanif10]ip add 192.168.1.253 24
[Huawei-Vlanif10]vrrp vrid 1 virtual-ip 192.168.1.254
[Huawei-Vlanif10]int vlanif 20
[Huawei-Vlanif20]ip add 192.168.2.252 24
[Huawei-Vlanif20]vrrp vrid 2 vir
[Huawei-Vlanif20]vrrp vrid 2 virtual-ip 192.168.2.254
[Huawei-Vlanif20]q  

SW3

[Huawei]sysname sw3
[sw3]vlan b 10 20
[sw3]stp region-configuration
[sw3-mst-region]region-name zwh
[sw3-mst-region]instance 1 vlan 10
[sw3-mst-region]instance 2 vlan 20
[sw3-mst-region]active region-configuration
[sw3-mst-region]q
[sw3]int g0/0/1
[sw3-GigabitEthernet0/0/1]p l t
[sw3-GigabitEthernet0/0/1]p t a v a
[sw3-GigabitEthernet0/0/1]int g0/0/2
[sw3-GigabitEthernet0/0/2]p l t
[sw3-GigabitEthernet0/0/2]p t a v a
[sw3-GigabitEthernet0/0/2]int g0/0/3
[sw3-GigabitEthernet0/0/3]p l a
[sw3-GigabitEthernet0/0/3]p d v 10
[sw3-GigabitEthernet0/0/3]int g0/0/4
[sw3-GigabitEthernet0/0/4]p l a
[sw3-GigabitEthernet0/0/4]p d v 20
[sw3-GigabitEthernet0/0/4]q

PING一下试一试

断开后

2021年4月12日 关于VRRP!!!相关推荐

  1. 2021年4月12日 阿里供应链Java研发实习面试(一面)(含总结)

    title: 2021年4月12日 阿里供应链Java研发实习面试(一面) tags: 面经 2021年4月12日 阿里供应链Java研发实习面试(一面) 自我介绍介绍项目你用哪个版本的Java呢?( ...

  2. 2021年3月12日 北京格灵深瞳Java开发实习面试(一面)

    title: 2021年3月12日 北京格灵深瞳Java开发实习面试 tags: 面经 2021年3月12日 北京格灵深瞳Java开发实习面试(一面) 首先上来问你问什么不做算法,转做开发呢?(因为我 ...

  3. 任天堂推出《塞尔达传说》GAMEampWATCH游戏机,预计要在 2021 年 11 月 12 日推出塞尔达版本的 GAMEampWATCH

    模玩资讯:任天堂推出<塞尔达传说>GAME&ampWATCH游戏机 任天堂将自家起底基业商品GAME&ampWATCH结合招牌游戏有奇效!继去年此时推出<超级玛利欧兄 ...

  4. 拯救者14OpenCore0.6.8黑苹果Big Sur 2021年4月12日

    型号:联想(Lenovo)拯救者 14.0英寸游戏本(i7-4720HQ 8G 128G SSD+1T GTX960M ) 原配置如上.后来又加了根内存,机械盘换成了ssd. 特色 极简,几乎没有冗余 ...

  5. 头条服务器维护更新公告,【更新公告】《第五人格》2021年8月12日维护公告

    致诸位尊敬的访客: 欢迎诸位来到[第五人格]! 为保证庄园的稳定运行,[第五人格]将于周四上午7: 30进行不停服维护. -- 本周将采用不停服维护方式.7点30分服务器进入不停服维护状态,届时各位访 ...

  6. ACwing算法基础课全程笔记(2021年8月12日开始重写+优化)

    更好的阅读体验 ※基础模板 2021年8月12日开始对基础课笔记进行重写+优化 请大家支持AcWing正版,购买网课能让自己获得更好的学习体验哦~ 链接:https://www.acwing.com/ ...

  7. 遥感期刊论文速读2(2021年8月12日)

    ISPRS Journal 期刊论文2021年6月-9月 Urban scene understanding based on semantic and socioeconomic features: ...

  8. 遥感期刊论文速读1(2021年8月12日)

    ISPRS Journal 期刊论文2021年3月-5月 Deep multisensor learning for missing-modality all-weather mapping 用于缺失 ...

  9. 2021年4月12日-民航上海医院-瑞金医院古北分院-检查报告单

    民航上海医院检查报告单 姓名 俞驰 体检编号 202103160300 体检日期 2021-04-12 09:15:10.327 身份证 xxxxxxxxxxxxxxxxxxx 单位名称 xxxxxx ...

  10. (更新时间)2021年5月12日 redis数据库 Redis面试题

    Redis高频面试题 文章目录 Redis高频面试题 1.什么是Redis?简述它的优缺点? 2.Redis相比memcached有哪些优势? 3.Redis支持哪几种数据类型? 4.Redis主要消 ...

最新文章

  1. [新手学Go]GO语言闭包的使用
  2. @Data注解使用后get set报错解决方法
  3. 鸟哥的Linux私房菜10.16 vim程序编辑器
  4. “懒惰”Linux 管理员的 10 个关键技巧
  5. 【Python】青少年蓝桥杯_每日一题_1.11_奇偶数
  6. 实验7.2 二维数组 7-6 方阵循环右移
  7. word文档下划线无法显示的解决方法
  8. 通过示例休眠–第2部分(DetachedCriteria)
  9. java springmvc注解详解_springMVC注解开发详解(转)
  10. Java集合框架之Collection实例解析
  11. BAT 鼎立格局被打破,2019 年这些互联网公司是程序员跳槽首选!
  12. 技术人不会学习,35 岁必然要焦虑!
  13. 软件测试工作中的沟通问题
  14. 字符串、数值 等类型的相互 安全转换
  15. ArcGIS地理配准(Georeferencing)详解
  16. 盛金公式解一元三次方程_一元三次方程的解法
  17. pika在codis中的探索
  18. 电脑网页无法解析服务器dns,电脑无法解析服务器dns地址怎么办
  19. ArcGIS教程:解决裁剪功能输出的数据集为空的情况。
  20. 爬取图片-工作常用小工具01

热门文章

  1. 职场心理学-心理学第一天(非原创)
  2. 论文格式问题解决,标题前的黑点去除,分页后产生的空格消除。
  3. 读书笔记-大型网站技术架构:核心原理与案例分析
  4. 关于考研复习数学分析和高等代数
  5. 计算机c盘内存怎么转给d盘,C盘空间太大怎么把空间转到D盘或E盘
  6. java文本框背景_Java 添加文本框到PPT幻灯片过程解析
  7. 计算机硬盘发展现状,固态硬盘的发展现状
  8. 【数据产品案例】美团外卖O2O的用户画像实践
  9. 中国各省市及省会城市名称的由来
  10. HTML中如何修改提示文字,html中input提示文字样式修改