2021年4月12日 关于VRRP!!!

                                               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 available



Please 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 available



Please 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 time

  Configuration 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 time

  Configuration 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.1
 dot1q termination vid 10
 ip address 192.168.1.253 255.255.255.0 
 vrrp vrid 1 virtual-ip 192.168.1.254
 vrrp vrid 1 priority 110
 vrrp vrid 1 track interface GigabitEthernet0/0/1 reduced 20
 vrrp vrid 1 track interface GigabitEthernet0/0/0 reduced 20
 arp broadcast enable
#
return
[R1-GigabitEthernet0/0/0.1]undo vrrp vrid 1 track interface GigabitEthernet0/0/1
 reduced 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/1
 reduced 
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/1
 reduced ?
  <cr>  Please press ENTER to execute command 
[R1-GigabitEthernet0/0/0.1]undo vrrp vrid 1 track interface GigabitEthernet0/0/1
 reduced 
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/0
 reduced 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/0
 reduced
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 time

  Configuration 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.1
 dot1q termination vid 10
 ip address 192.168.1.253 255.255.255.0 
 vrrp vrid 1 virtual-ip 192.168.1.254
 vrrp vrid 1 priority 110
 vrrp vrid 1 track interface GigabitEthernet0/0/1 reduced 20
 vrrp vrid 1 track interface GigabitEthernet0/0/0 reduced 20
 arp 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.2
 dot1q termination vid 20
 ip address 192.168.2.252 255.255.255.0 
 vrrp vrid 2 virtual-ip 192.168.2.254
 vrrp vrid 2 preempt-mode timer delay 10
 vrrp vrid 2 track interface GigabitEthernet0/0/1 reduced 20
 vrrp vrid 2 track interface GigabitEthernet0/0/0 reduced 20
 arp broadcast enable
#
return
[R1-GigabitEthernet0/0/0.2]

  Please check whether system data has been changed, and save data in time

  Configuration 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 time

  Configuration 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 Router
 state 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 Router
 state 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 Router
 state 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 time

  Configuration 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 Router
 state 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.1
 dot1q termination vid 10
 ip address 192.168.1.252 255.255.255.0 
 vrrp vrid 1 virtual-ip 192.168.1.254
 vrrp vrid 1 preempt-mode timer delay 10
 arp broadcast enable
#
interface GigabitEthernet0/0/0.2
 dot1q termination vid 20
 ip address 192.168.2.253 255.255.255.0 
 vrrp vrid 2 virtual-ip 192.168.2.254
 vrrp vrid 2 priority 110
 arp broadcast enable
#
interface GigabitEthernet0/0/1
 ip 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 0
 authentication-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 800007DB03000000000000
 snmp-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 default
 authorization-scheme default
 accounting-scheme default
 domain default 
 domain default_admin 
 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
 local-user admin service-type http
#
firewall zone Local
 priority 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.1
 dot1q termination vid 10
 ip address 192.168.1.252 255.255.255.0 
 vrrp vrid 1 virtual-ip 192.168.1.254
 vrrp vrid 1 preempt-mode timer delay 10
 arp broadcast enable
#
interface GigabitEthernet0/0/0.2
 dot1q termination vid 20
 ip address 192.168.2.253 255.255.255.0 
 vrrp vrid 2 virtual-ip 192.168.2.254
 vrrp vrid 2 priority 110
 arp broadcast enable
#
interface GigabitEthernet0/0/1
 ip 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 0
 authentication-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 time

  Configuration 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 Router
 state 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 Router
 state 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 protocol
 IP 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 protocol
 IP 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 time

  Configuration console time out, please press any key to log on

<Huawei>

  Please check whether system data has been changed, and save data in time

  Configuration 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 time

  Configuration 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 time

  Configuration 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 time

  Configuration 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 800007DB03000000000000
 snmp-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 800007DB03000000000000
 snmp-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 default
 authorization-scheme default
 accounting-scheme default
 domain default 
 domain default_admin 
 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
 local-user admin service-type http
#
firewall zone Local
 priority 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
 ip address 192.168.10.1 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 192.168.20.1 255.255.255.0 
#
interface NULL0
#
interface LoopBack0
 ip 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 0
 authentication-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 time

  Configuration 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 time

  Configuration 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 br
 MSTID  Port                        Role  STP State     Protection
   0    GigabitEthernet0/0/1        ROOT  FORWARDING      NONE
   0    GigabitEthernet0/0/2        ALTE  DISCARDING      NONE
   0    GigabitEthernet0/0/3        DESI  FORWARDING      NONE
   0    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一下试一试

断开后

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值