欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

实操:华为设备配置vrrp漂移网关虚拟路由和浮动路由

程序员文章站 2022-07-08 19:46:46
...

前言
vrrp 漂移网关地址,根据优先级来

vrrp 可以用在思科,还可用在华为

思科的PVST+就是双组双备————HSRP


实操:华为设备配置vrrp漂移网关虚拟路由和浮动路由

一:先进行配置

1.1 左边的三层交换机LSW1

The device is running!
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname lsw1
[lsw1]vlan bat 10 20 100
Info: This operation may take a few seconds. Please wait for a moment...done.
[lsw1]int g 0/0/2
[lsw1-GigabitEthernet0/0/2]p l t
[lsw1-GigabitEthernet0/0/2]p t a v 10 20
[lsw1-GigabitEthernet0/0/2]un sh
Info: Interface GigabitEthernet0/0/2 is not shutdown.
[lsw1-GigabitEthernet0/0/2]int vlanif 100
[lsw1-Vlanif100]q
[lsw1]int g 0/0/1
[lsw1-GigabitEthernet0/0/1]p l a
[lsw1-GigabitEthernet0/0/1]p d v 100
[lsw1-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.	
[lsw1-GigabitEthernet0/0/1]int vlanif 100
[lsw1-Vlanif100]ip add 11.0.0.2 30
[lsw1-Vlanif100]un sh
Info: Interface Vlanif100 is not shutdown.
[lsw1-Vlanif100]int vlanif 10
[lsw1-Vlanif10]ip add 192.168.10.10 24
[lsw1-Vlanif10]vrrp ?
  advertise  VRRP advertise message
  un-check   Uncheck VRRP packet TTL value
  vrid       Specify virtual router identifier

[lsw1-Vlanif10]vrrp vrid ?
  INTEGER<1-255>  Virtual router identifier

[lsw1-Vlanif10]vrrp vrid 1 ?
  authentication-mode  Specify password and authentication mode
  preempt-mode         Specify preempt mode
  priority             Specify priority
  timer                Specify timer
  track                Specify the track configuration
  version-3            Specify the device to support V3 for VRRP
  virtual-ip           Specify virtual IP address

[lsw1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1 	 //需要先设置虚拟ip地址,才可启用
[lsw1-Vlanif10]vrrp vrid 1 priority 120
[lsw1-Vlanif10]vrrp vrid 1 track interface g 0/0/1
[lsw1-Vlanif10]vrrp vrid 1 track interface g 0/0/2
[lsw1-Vlanif10]int vlanif 20
[lsw1-Vlanif20]ip add 192.168.20.10 24
[lsw1-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1
[lsw1-Vlanif20]vrrp vrid 2 priority 115
[lsw1-Vlanif20]q
[lsw1]ip route-static 0.0.0.0 0 11.0.0.1

1.2 右边的三层交换机 lsw2

The device is running!
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname LSW2
[LSW2]vlan bat 10 20 100
Info: This operation may take a few seconds. Please wait for a moment...done.
[LSW2]int g 0/0/2
[LSW2-GigabitEthernet0/0/2]p l t
[LSW2-GigabitEthernet0/0/2] p t a v 10 20
[LSW2-GigabitEthernet0/0/2]un sh
Info: Interface GigabitEthernet0/0/2 is not shutdown.
[LSW2-GigabitEthernet0/0/2]int g 0/0/1
[LSW2-GigabitEthernet0/0/1]p l a 
[LSW2-GigabitEthernet0/0/1]p d v 100
[LSW2-GigabitEthernet0/0/1]int vlanif 100
[LSW2-Vlanif100]ip add 12.0.0.2 30
[LSW2-Vlanif100]int vlanif 10
[LSW2-Vlanif10]ip add 192.168.10.20 24	
[LSW2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1
[LSW2-Vlanif10]vrrp vrid 1 priority 115
[LSW2-Vlanif10]int vlanif 20
[LSW2-Vlanif20]ip add 192.168.20.20 24
[LSW2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1
[LSW2-Vlanif20]vrrp vrid 2 priority 120	
[LSW2-Vlanif20]vrrp vrid 2 ?
  authentication-mode  Specify password and authentication mode
  preempt-mode         Specify preempt mode
  priority             Specify priority
  timer                Specify timer
  track                Specify the track configuration
  version-3            Specify the device to support V3 for VRRP
  virtual-ip           Specify virtual IP address
	
[LSW2-Vlanif20]vrrp vrid 2 track interface g 0/0/1
[LSW2-Vlanif20]vrrp vrid 2 track interface g 0/0/2
[LSW2-Vlanif20]q
[LSW2]ip route-static 0.0.0.0 0 12.0.0.1

1.3 二层交换机lsw3

The device is running!
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname lsw3
[lsw3]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[lsw3]int e 0/0/1
[lsw3-Ethernet0/0/1]p l a
[lsw3-Ethernet0/0/1]p d v 10
[lsw3-Ethernet0/0/1]un sh
Info: Interface Ethernet0/0/1 is not shutdown.
[lsw3-Ethernet0/0/1]int e 0/0/2
[lsw3-Ethernet0/0/2]p l a
[lsw3-Ethernet0/0/2]p d v 20
[lsw3-Ethernet0/0/2]un sh
Info: Interface Ethernet0/0/2 is not shutdown.
[lsw3-Ethernet0/0/2]int g 0/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
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[lsw3-GigabitEthernet0/0/1]int g 0/0/2
[lsw3-GigabitEthernet0/0/2]p l t
[lsw3-GigabitEthernet0/0/2]p t a v 10 20
[lsw3-GigabitEthernet0/0/2]un sh
Info: Interface GigabitEthernet0/0/2 is not shutdown.
[lsw3-GigabitEthernet0/0/2]dis vlan
The total number of vlans is : 3
VID  Type    Ports                                                          
--------------------------------------------------------------------------------
1    common  UT:Eth0/0/3(D)     Eth0/0/4(D)     Eth0/0/5(D)     Eth0/0/6(D)     
                Eth0/0/7(D)     Eth0/0/8(D)     Eth0/0/9(D)     Eth0/0/10(D)    
                Eth0/0/11(D)    Eth0/0/12(D)    Eth0/0/13(D)    Eth0/0/14(D)    
                Eth0/0/15(D)    Eth0/0/16(D)    Eth0/0/17(D)    Eth0/0/18(D)    
                Eth0/0/19(D)    Eth0/0/20(D)    Eth0/0/21(D)    Eth0/0/22(D)    
                GE0/0/1(U)      GE0/0/2(U)                                      
10   common  UT:Eth0/0/1(U)                                                     
             TG:GE0/0/1(U)      GE0/0/2(U)                                      
20   common  UT:Eth0/0/2(U)                                                     
             TG:GE0/0/1(U)      GE0/0/2(U)                                      

VID  Status  Property      MAC-LRN Statistics Description      
--------------------------------------------------------------------------------

1    enable  default       enable  disable    VLAN 0001                         
10   enable  default       enable  disable    VLAN 0010                         
20   enable  default       enable  disable    VLAN 0020                         

1.4 AR1,为每个网段设置浮动路由

The device is running!
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname AR1
[AR1]int g 0/0/0
[AR1-GigabitEthernet0/0/0]ip add 11.0.0.1 30
[AR1-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[AR1-GigabitEthernet0/0/0]int g 0/0/1
[AR1-GigabitEthernet0/0/1]ip add 12.0.0.1 30
[AR1-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[AR1-GigabitEthernet0/0/1]q
[AR1]int LoopBack 0
[AR1-LoopBack0]ip add 1.1.1.1 32
[AR1-LoopBack0]q
[AR1]ip route-static 192.168.10.0 24 11.0.0.2
[AR1]ip route-static 192.168.10.0 24 12.0.0.2 ?
  description   Add or delete description of unicast static route
  inherit-cost  Inherit the cost of the iterated route
  permanent     Specifies route permanent
  preference    Specifies route preference
  tag           Specifies route tag
  track         Specify track object
  <cr>          Please press ENTER to execute command 
[AR1]ip route-static 192.168.10.0 24 12.0.0.2 preference 70
[AR1]ip route-static 192.168.20.0 24 12.0.0.2
[AR1]ip route-static 192.168.20.0 24 11.0.0.2 preference 70

二:测试验证

2.1 给pc机设置ip地址

实操:华为设备配置vrrp漂移网关虚拟路由和浮动路由
实操:华为设备配置vrrp漂移网关虚拟路由和浮动路由

2.2 对两个上连口抓包

2.2.1 pc1(192.168.10.100)去ping1.1.1.1 ,在lsw1抓到包

实操:华为设备配置vrrp漂移网关虚拟路由和浮动路由

2.2.2 pc2(192.168.20.100)去ping 1.1.1.1,在lsw2抓到数据包

实操:华为设备配置vrrp漂移网关虚拟路由和浮动路由

2.2.3 查看路由表

2.2.3.1 LSW1三层交换机

[lsw1]dis ip routing
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 10       Routes : 10       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   Static  60   0          RD   11.0.0.1        Vlanif100
       11.0.0.0/30  Direct  0    0           D   11.0.0.2        Vlanif100
       11.0.0.2/32  Direct  0    0           D   127.0.0.1       Vlanif100
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.10.0/24  Direct  0    0           D   192.168.10.10   Vlanif10
   192.168.10.1/32  Direct  0    0           D   127.0.0.1       Vlanif10
  192.168.10.10/32  Direct  0    0           D   127.0.0.1       Vlanif10
   192.168.20.0/24  Direct  0    0           D   192.168.20.10   Vlanif20
  192.168.20.10/32  Direct  0    0           D   127.0.0.1       Vlanif20

2.2.3.2 LSW2 三层交换机

[LSW2]dis ip routing
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 10       Routes : 10       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   Static  60   0          RD   12.0.0.1        Vlanif100
       12.0.0.0/30  Direct  0    0           D   12.0.0.2        Vlanif100
       12.0.0.2/32  Direct  0    0           D   127.0.0.1       Vlanif100
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.10.0/24  Direct  0    0           D   192.168.10.20   Vlanif10
  192.168.10.20/32  Direct  0    0           D   127.0.0.1       Vlanif10
   192.168.20.0/24  Direct  0    0           D   192.168.20.20   Vlanif20
   192.168.20.1/32  Direct  0    0           D   127.0.0.1       Vlanif20
  192.168.20.20/32  Direct  0    0           D   127.0.0.1       Vlanif20

2.2.3.3 AR1 路由器

可以发现针对192.168.20.0 和192.168.10.0 网段的信息如下

192.168.10.0/24 Static 60 0 RD 11.0.0.2 GigabitEthernet0/0/0
192.168.20.0/24 Static 60 0 RD 12.0.0.2 GigabitEthernet0/0/1

[AR1]dis ip routing
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 13       Routes : 13       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
       11.0.0.0/30  Direct  0    0           D   11.0.0.1        GigabitEthernet
0/0/0
       11.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       11.0.0.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       12.0.0.0/30  Direct  0    0           D   12.0.0.1        GigabitEthernet
0/0/1
       12.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
       12.0.0.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.10.0/24  Static  60   0          RD   11.0.0.2        GigabitEthernet
0/0/0
   192.168.20.0/24  Static  60   0          RD   12.0.0.2        GigabitEthernet
0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

2.2.3.4 查看两台三层交换的vrrp

此时

  • lsw1的vrrp为 ————vlanif10 master vlanif20 backup
  • lsw2的vrrp为 ————vlanif10 backup vlanif20 master
[lsw1]dis vrrp 
  Vlanif10 | Virtual Router 1
    State : Master
    Virtual IP : 192.168.10.1
    Master IP : 192.168.10.10
    PriorityRun : 120
    PriorityConfig : 120
    MasterPriority : 120
    Preempt : YES   Delay Time : 0 s
    TimerRun : 1 s
    TimerConfig : 1 s
    Auth type : NONE
    Virtual MAC : 0000-5e00-0101
    Check TTL : YES
    Config type : normal-vrrp
    Track IF : GigabitEthernet0/0/1   Priority reduced : 10
    IF state : UP
    Track IF : GigabitEthernet0/0/2   Priority reduced : 10
    IF state : UP
    Create time : 2019-12-18 10:33:17 UTC-08:00
    Last change time : 2019-12-18 10:33:21 UTC-08:00

  Vlanif20 | Virtual Router 2
    State : Backup
    Virtual IP : 192.168.20.1
    Master IP : 192.168.20.20
    PriorityRun : 115
    PriorityConfig : 115
    MasterPriority : 120
    Preempt : YES   Delay Time : 0 s
    TimerRun : 1 s
    TimerConfig : 1 s
    Auth type : NONE
    Virtual MAC : 0000-5e00-0102
    Check TTL : YES
    Config type : normal-vrrp
    Create time : 2019-12-18 10:39:35 UTC-08:00
    Last change time : 2019-12-18 10:41:23 UTC-08:00

[LSW2]dis vrrp
  Vlanif10 | Virtual Router 1
    State : Backup
    Virtual IP : 192.168.10.1
    Master IP : 192.168.10.10
    PriorityRun : 115
    PriorityConfig : 115
    MasterPriority : 120
    Preempt : YES   Delay Time : 0 s
    TimerRun : 1 s
    TimerConfig : 1 s
    Auth type : NONE
    Virtual MAC : 0000-5e00-0101
    Check TTL : YES
    Config type : normal-vrrp
    Create time : 2019-12-18 10:40:11 UTC-08:00
    Last change time : 2019-12-18 10:40:11 UTC-08:00

  Vlanif20 | Virtual Router 2
    State : Master
    Virtual IP : 192.168.20.1
    Master IP : 192.168.20.20
    PriorityRun : 120
    PriorityConfig : 120
    MasterPriority : 120
    Preempt : YES   Delay Time : 0 s
    TimerRun : 1 s
    TimerConfig : 1 s
    Auth type : NONE
    Virtual MAC : 0000-5e00-0102
    Check TTL : YES
    Config type : normal-vrrp
    Track IF : GigabitEthernet0/0/1   Priority reduced : 10
    IF state : UP
    Track IF : GigabitEthernet0/0/2   Priority reduced : 10
    IF state : UP
    Create time : 2019-12-18 10:41:15 UTC-08:00
    Last change time : 2019-12-18 10:41:23 UTC-08:00

2.3 然后把lsw1的上连口g 0/0/1断掉测试

[lsw1] int g 0/0/1
[lsw1-GigabitEthernet0/0/1]shut	
[lsw1-GigabitEthernet0/0/1]shutdown 

2.3.1 pc1 去ping 1.1.1.1

发现数据包路径转移到LSW2中

实操:华为设备配置vrrp漂移网关虚拟路由和浮动路由

2.3.2 pc2 去ping 1.1.1.1

不变

实操:华为设备配置vrrp漂移网关虚拟路由和浮动路由

2.3.3 再次查看路由表

2.3.3.1 LSW1 三层交换

down掉的ip网段不看,别的没啥不同

[lsw1]dis ip routing
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 6        Routes : 6        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.10.0/24  Direct  0    0           D   192.168.10.10   Vlanif10
  192.168.10.10/32  Direct  0    0           D   127.0.0.1       Vlanif10
   192.168.20.0/24  Direct  0    0           D   192.168.20.10   Vlanif20
  192.168.20.10/32  Direct  0    0           D   127.0.0.1       Vlanif20

2.3.3.2 LSW2 三层交换

不变

[LSW2]dis ip routing
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 11       Routes : 11       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   Static  60   0          RD   12.0.0.1        Vlanif100
       12.0.0.0/30  Direct  0    0           D   12.0.0.2        Vlanif100
       12.0.0.2/32  Direct  0    0           D   127.0.0.1       Vlanif100
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.10.0/24  Direct  0    0           D   192.168.10.20   Vlanif10
   192.168.10.1/32  Direct  0    0           D   127.0.0.1       Vlanif10
  192.168.10.20/32  Direct  0    0           D   127.0.0.1       Vlanif10
   192.168.20.0/24  Direct  0    0           D   192.168.20.20   Vlanif20
   192.168.20.1/32  Direct  0    0           D   127.0.0.1       Vlanif20
  192.168.20.20/32  Direct  0    0           D   127.0.0.1       Vlanif20

2.3.3.3 AR1 路由器

之前的路由信息

192.168.10.0/24 Static 60 0 RD 11.0.0.2 GigabitEthernet0/0/0
192.168.20.0/24 Static 60 0 RD 12.0.0.2 GigabitEthernet0/0/1

现在的路由信息

192.168.10.0/24 Static 70 0 RD 12.0.0.2 GigabitEthernet0/0/1
192.168.20.0/24 Static 60 0 RD 12.0.0.2 GigabitEthernet0/0/1

  • 192.168.10.0 的静态路由发生改变,变成了之间设置的浮动路由
[AR1]dis ip routing
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 10       Routes : 10       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
       12.0.0.0/30  Direct  0    0           D   12.0.0.1        GigabitEthernet
0/0/1
       12.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
       12.0.0.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.10.0/24  Static  70   0          RD   12.0.0.2        GigabitEthernet
0/0/1
   192.168.20.0/24  Static  60   0          RD   12.0.0.2        GigabitEthernet
0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

2.3.3.4 查看vrrp

之前的vrrp

  • lsw1的vrrp为 ————vlanif10 master vlanif20 backup
  • lsw2的vrrp为 ————vlanif10 backup vlanif20 master

现在的vrrp

  • lsw1的vrrp为 ————vlanif10 backup vlanif20 backup
  • lsw2的vrrp为 ————vlanif10 master vlanif20 master
[lsw1]dis vrrp
  Vlanif10 | Virtual Router 1
    State : Backup
    Virtual IP : 192.168.10.1
    Master IP : 192.168.10.20
    PriorityRun : 110
    PriorityConfig : 120
    MasterPriority : 115
    Preempt : YES   Delay Time : 0 s
    TimerRun : 1 s
    TimerConfig : 1 s
    Auth type : NONE
    Virtual MAC : 0000-5e00-0101
    Check TTL : YES
    Config type : normal-vrrp
    Track IF : GigabitEthernet0/0/1   Priority reduced : 10
    IF state : DOWN
    Track IF : GigabitEthernet0/0/2   Priority reduced : 10
    IF state : UP
    Create time : 2019-12-18 10:33:17 UTC-08:00
    Last change time : 2019-12-18 11:20:18 UTC-08:00

  Vlanif20 | Virtual Router 2
    State : Backup
    Virtual IP : 192.168.20.1
    Master IP : 192.168.20.20
    PriorityRun : 115
    PriorityConfig : 115
    MasterPriority : 120
    Preempt : YES   Delay Time : 0 s
    TimerRun : 1 s
    TimerConfig : 1 s
    Auth type : NONE
    Virtual MAC : 0000-5e00-0102
    Check TTL : YES
    Config type : normal-vrrp
    Create time : 2019-12-18 10:39:35 UTC-08:00
    Last change time : 2019-12-18 10:41:23 UTC-08:00


[LSW2]dis vrrp
  Vlanif10 | Virtual Router 1
    State : Master
    Virtual IP : 192.168.10.1
    Master IP : 192.168.10.20
    PriorityRun : 115
    PriorityConfig : 115
    MasterPriority : 115
    Preempt : YES   Delay Time : 0 s
    TimerRun : 1 s
    TimerConfig : 1 s
    Auth type : NONE
    Virtual MAC : 0000-5e00-0101
    Check TTL : YES
    Config type : normal-vrrp
    Create time : 2019-12-18 10:40:11 UTC-08:00
    Last change time : 2019-12-18 11:20:18 UTC-08:00

  Vlanif20 | Virtual Router 2
    State : Master
    Virtual IP : 192.168.20.1
    Master IP : 192.168.20.20
    PriorityRun : 120
    PriorityConfig : 120
    MasterPriority : 120
    Preempt : YES   Delay Time : 0 s
    TimerRun : 1 s
    TimerConfig : 1 s
    Auth type : NONE
    Virtual MAC : 0000-5e00-0102
    Check TTL : YES
    Config type : normal-vrrp
    Track IF : GigabitEthernet0/0/1   Priority reduced : 10
    IF state : UP
    Track IF : GigabitEthernet0/0/2   Priority reduced : 10
    IF state : UP
    Create time : 2019-12-18 10:41:15 UTC-08:00
    Last change time : 2019-12-18 10:41:23 UTC-08:00

2.4 在LSW11下连口g0/0/2开启抓包,开启LSW1的g0/0/1接口,然后再查看vrrp

2.4.1 发现在下连口的vrrp协议数据开始交互

实操:华为设备配置vrrp漂移网关虚拟路由和浮动路由

2.4.1 查看vrrp

之前的vrrp

  • lsw1的vrrp为 ————vlanif10 backup vlanif20 backup
  • lsw2的vrrp为 ————vlanif10 master vlanif20 master

现在的vrrp

  • lsw1的vrrp为 ————vlanif10 master vlanif20 backup
  • lsw2的vrrp为 ————vlanif10 backup vlanif20 master

自动恢复正常

[lsw1]dis vrrp
  Vlanif10 | Virtual Router 1
    State : Master
    Virtual IP : 192.168.10.1
    Master IP : 192.168.10.10
    PriorityRun : 120
    PriorityConfig : 120
    MasterPriority : 120
    Preempt : YES   Delay Time : 0 s
    TimerRun : 1 s
    TimerConfig : 1 s
    Auth type : NONE
    Virtual MAC : 0000-5e00-0101
    Check TTL : YES
    Config type : normal-vrrp
    Track IF : GigabitEthernet0/0/1   Priority reduced : 10
    IF state : UP
    Track IF : GigabitEthernet0/0/2   Priority reduced : 10
    IF state : UP
    Create time : 2019-12-18 10:33:17 UTC-08:00
    Last change time : 2019-12-18 11:23:54 UTC-08:00

  Vlanif20 | Virtual Router 2
    State : Backup
    Virtual IP : 192.168.20.1
    Master IP : 192.168.20.20
    PriorityRun : 115
    PriorityConfig : 115
    MasterPriority : 120
    Preempt : YES   Delay Time : 0 s
    TimerRun : 1 s
    TimerConfig : 1 s
    Auth type : NONE
    Virtual MAC : 0000-5e00-0102
    Check TTL : YES
    Config type : normal-vrrp
    Create time : 2019-12-18 10:39:35 UTC-08:00
    Last change time : 2019-12-18 10:41:23 UTC-08:00

[LSW2]dis vrrp
  Vlanif10 | Virtual Router 1
    State : Backup
    Virtual IP : 192.168.10.1
    Master IP : 192.168.10.10
    PriorityRun : 115
    PriorityConfig : 115
    MasterPriority : 120
    Preempt : YES   Delay Time : 0 s
    TimerRun : 1 s
    TimerConfig : 1 s
    Auth type : NONE
    Virtual MAC : 0000-5e00-0101
    Check TTL : YES
    Config type : normal-vrrp
    Create time : 2019-12-18 10:40:11 UTC-08:00
    Last change time : 2019-12-18 11:23:54 UTC-08:00

  Vlanif20 | Virtual Router 2
    State : Master
    Virtual IP : 192.168.20.1
    Master IP : 192.168.20.20
    PriorityRun : 120
    PriorityConfig : 120
    MasterPriority : 120
    Preempt : YES   Delay Time : 0 s
    TimerRun : 1 s
    TimerConfig : 1 s
    Auth type : NONE
    Virtual MAC : 0000-5e00-0102
    Check TTL : YES
    Config type : normal-vrrp
    Track IF : GigabitEthernet0/0/1   Priority reduced : 10
    IF state : UP
    Track IF : GigabitEthernet0/0/2   Priority reduced : 10
    IF state : UP
    Create time : 2019-12-18 10:41:15 UTC-08:00
    Last change time : 2019-12-18 10:41:23 UTC-08:00

2.4.2 查看AR1 的路由表

刚才的路由信息

192.168.10.0/24 Static 70 0 RD 12.0.0.2 GigabitEthernet0/0/1
192.168.20.0/24 Static 60 0 RD 12.0.0.2 GigabitEthernet0/0/1

现在的路由信息

192.168.10.0/24 Static 60 0 RD 11.0.0.2 GigabitEthernet0/0/0
192.168.20.0/24 Static 60 0 RD 12.0.0.2 GigabitEthernet0/0/1

也恢复原状

[AR1]dis ip routing
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 13       Routes : 13       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
       11.0.0.0/30  Direct  0    0           D   11.0.0.1        GigabitEthernet
0/0/0
       11.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       11.0.0.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       12.0.0.0/30  Direct  0    0           D   12.0.0.1        GigabitEthernet
0/0/1
       12.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
       12.0.0.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.10.0/24  Static  60   0          RD   11.0.0.2        GigabitEthernet
0/0/0
   192.168.20.0/24  Static  60   0          RD   12.0.0.2        GigabitEthernet
0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0


2.5 然后关闭LSW1下连口g 0/0/2,进行测试

[lsw1]int g 0/0/2
[lsw1-GigabitEthernet0/0/2]shut

2.5.1 再次查看vrrp

刚才的vrrp

  • lsw1的vrrp为 ————vlanif10 master vlanif20 backup
  • lsw2的vrrp为 ————vlanif10 backup vlanif20 master

现在的vrrp

  • lsw1的vrrp为 ————vlanif10 Initialize vlanif20 Initialize
  • lsw2的vrrp为 ————vlanif10 master vlanif20 master
[lsw1]dis vrrp
  Vlanif10 | Virtual Router 1
    State : Initialize
    Virtual IP : 192.168.10.1
    Master IP : 0.0.0.0
    PriorityRun : 110
    PriorityConfig : 120
    MasterPriority : 0
    Preempt : YES   Delay Time : 0 s
    TimerRun : 1 s
    TimerConfig : 1 s
    Auth type : NONE
    Virtual MAC : 0000-5e00-0101
    Check TTL : YES
    Config type : normal-vrrp
    Track IF : GigabitEthernet0/0/1   Priority reduced : 10
    IF state : UP
    Track IF : GigabitEthernet0/0/2   Priority reduced : 10
    IF state : DOWN
    Create time : 2019-12-18 10:33:17 UTC-08:00
    Last change time : 2019-12-18 11:29:01 UTC-08:00

  Vlanif20 | Virtual Router 2
    State : Initialize
    Virtual IP : 192.168.20.1
    Master IP : 0.0.0.0
    PriorityRun : 115
    PriorityConfig : 115
    MasterPriority : 0
    Preempt : YES   Delay Time : 0 s
    TimerRun : 1 s
    TimerConfig : 1 s
    Auth type : NONE
    Virtual MAC : 0000-5e00-0102
    Check TTL : YES
    Config type : normal-vrrp
    Create time : 2019-12-18 10:39:35 UTC-08:00
    Last change time : 2019-12-18 11:29:01 UTC-08:00

[LSW2]dis vrrp
  Vlanif10 | Virtual Router 1
    State : Master
    Virtual IP : 192.168.10.1
    Master IP : 192.168.10.20
    PriorityRun : 115
    PriorityConfig : 115
    MasterPriority : 115
    Preempt : YES   Delay Time : 0 s
    TimerRun : 1 s
    TimerConfig : 1 s
    Auth type : NONE
    Virtual MAC : 0000-5e00-0101
    Check TTL : YES
    Config type : normal-vrrp
    Create time : 2019-12-18 10:40:11 UTC-08:00
    Last change time : 2019-12-18 11:29:03 UTC-08:00

  Vlanif20 | Virtual Router 2
    State : Master
    Virtual IP : 192.168.20.1
    Master IP : 192.168.20.20
    PriorityRun : 120
    PriorityConfig : 120
    MasterPriority : 120
    Preempt : YES   Delay Time : 0 s
    TimerRun : 1 s
    TimerConfig : 1 s
    Auth type : NONE
    Virtual MAC : 0000-5e00-0102
    Check TTL : YES
    Config type : normal-vrrp
    Track IF : GigabitEthernet0/0/1   Priority reduced : 10
    IF state : UP
    Track IF : GigabitEthernet0/0/2   Priority reduced : 10
    IF state : UP
    Create time : 2019-12-18 10:41:15 UTC-08:00
    Last change time : 2019-12-18 10:41:23 UTC-08:00

2.5.2 查看AR1 路由器

之前的路由信息

192.168.10.0/24 Static 60 0 RD 11.0.0.2 GigabitEthernet0/0/0
192.168.20.0/24 Static 60 0 RD 12.0.0.2 GigabitEthernet0/0/1

现在的路由信息

192.168.10.0/24 Static 60 0 RD 11.0.0.2 GigabitEthernet0/0/0
192.168.20.0/24 Static 60 0 RD 12.0.0.2 GigabitEthernet0/0/1

路由条目没有发生改变

[AR1]dis ip routing
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 13       Routes : 13       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
       11.0.0.0/30  Direct  0    0           D   11.0.0.1        GigabitEthernet
0/0/0
       11.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       11.0.0.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       12.0.0.0/30  Direct  0    0           D   12.0.0.1        GigabitEthernet
0/0/1
       12.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
       12.0.0.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.10.0/24  Static  60   0          RD   11.0.0.2        GigabitEthernet
0/0/0
   192.168.20.0/24  Static  60   0          RD   12.0.0.2        GigabitEthernet
0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

2.5.3 pc1 去ping 1.1.1.1

可以发现链接超时,数据包从右边LSW2(此时vrrp为master)进路由器,然后从左边LSW1出

因为AR1浮动路由并未启用,导致超时,通向192.168.10.0的路由条目的下一跳为11.0.0.2(LSW1的g0/0/1口)

实操:华为设备配置vrrp漂移网关虚拟路由和浮动路由

2.5.4 pc2 去ping 1.1.1.1

不变

实操:华为设备配置vrrp漂移网关虚拟路由和浮动路由

后面会再进行优化,解决这个问题