网络学习-eNSP配置VRRP

虚拟路由冗余协议(Virtual Router Redundancy Protocol,简称VRRP)

VRRP广泛应用在边缘网络中,是一种路由冗余协议,它的设计目标是支持特定情况下IP数据流量失败转移不会引起混乱,允许主机使用单路由器,以及即使在实际第一跳路由器使用失败的情形下仍能够维护路由器间的连通性。

bash 复制代码
#配置三层交换机和路由器IP,实现PC1与PC2的通信
#---------------------1.LSW1配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]sysname sw1
#配置vlan1的地址,作为网关
[sw1]interface vlanif 1
[sw1-Vlanif1]ip address 192.168.1.252 24
[sw1-Vlanif1]quit
[sw1]vlan 2
[sw1-vlan2]quit        
#设置接入链路,配置vlan2地址,作为向外传输出口            
[sw1]interface gigabitethernet 0/0/2
[sw1-GigabitEthernet0/0/2]port link-type access
[sw1-GigabitEthernet0/0/2]port default vlan 2
[sw1-GigabitEthernet0/0/2]quit
[sw1]interface vlanif 2
[sw1-Vlanif2]ip address 192.168.2.2 24
[sw1-Vlanif2]quit
#通过配置动态路由实现网段互通
[sw1]ospf
[sw1-ospf-1]area 0
[sw1-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[sw1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[sw1-ospf-1-area-0.0.0.0]display ip routing-table | include /24
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 8        Routes : 9        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    192.168.1.0/24  Direct  0    0           D   192.168.1.252   Vlanif1
    192.168.2.0/24  Direct  0    0           D   192.168.2.2     Vlanif2
    192.168.3.0/24  OSPF    10   2           D   192.168.2.1     Vlanif2
    192.168.4.0/24  OSPF    10   2           D   192.168.2.1     Vlanif2
[sw1-ospf-1-area-0.0.0.0]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
MEth0/0/1                         unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Vlanif1                           192.168.1.252/24     up         up        
Vlanif2                           192.168.2.2/24       up         up 
#---------------------2.LSW2配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw2
[sw2]undo info-center enable
Info: Information center is disabled.
[sw2]interface vlanif 1
[sw2-Vlanif1]ip address 192.168.1.253 24
[sw2-Vlanif1]quit
[sw2]vlan 3
[sw2-vlan3]quit
[sw2]interface gigabitethernet 0/0/2
[sw2-GigabitEthernet0/0/2]port link-type access
[sw2-GigabitEthernet0/0/2]port default vlan 3
[sw2-GigabitEthernet0/0/2]quit
[sw2]interface vlanif 3
[sw2-Vlanif3]ip address 192.168.3.2 24
[sw2-Vlanif3]quit
#配置动态路由
[sw2]ospf 
[sw2-ospf-1]area 0
[sw2-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[sw2-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[sw2-ospf-1-area-0.0.0.0]display ip routing-table | include /24
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public         Destinations : 8        Routes : 9        
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
    192.168.1.0/24  Direct  0    0           D   192.168.1.253   Vlanif1
    192.168.2.0/24  OSPF    10   2           D   192.168.3.1     Vlanif3
    192.168.3.0/24  Direct  0    0           D   192.168.3.2     Vlanif3
    192.168.4.0/24  OSPF    10   2           D   192.168.3.1     Vlanif3
[sw2-ospf-1-area-0.0.0.0]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
MEth0/0/1                         unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Vlanif1                           192.168.1.253/24     up         up        
Vlanif3                           192.168.3.2/24       up         up  
#---------------------3.AR1配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]interface gigabitethernet 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.2.1 24
[Huawei-GigabitEthernet0/0/0]quit
[Huawei]interface gigabitethernet 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.3.1 24
[Huawei-GigabitEthernet0/0/1]quit
[Huawei]interface gigabitethernet 0/0/2
[Huawei-GigabitEthernet0/0/2]ip address 192.168.4.254 24
[Huawei-GigabitEthernet0/0/2]quit
[Huawei]ospf
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255 
[Huawei-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255

[Huawei]display ip routing-table | include /24
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public         Destinations : 14       Routes : 15       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
192.168.1.0/24  OSPF    10   2           D   192.168.2.2     GigabitEthernet0/0/0
192.168.2.0/24  Direct  0    0           D   192.168.2.1     GigabitEthernet0/0/0
192.168.3.0/24  Direct  0    0           D   192.168.3.1     GigabitEthernet0/0/1
192.168.4.0/24  Direct  0    0           D   192.168.4.254   GigabitEthernet0/0/2
[Huawei]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 0

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.2.1/24       up         up        
GigabitEthernet0/0/1              192.168.3.1/24       up         up        
GigabitEthernet0/0/2              192.168.4.254/24     up         up        
NULL0                             unassigned           up         up(s)  
VRRP组成员
  • 主路由器
  • 备份路由器
  • 虚拟路由器
VRRP配置
bash 复制代码
#---------配置LSW1
[sw1]interface vlanif 1
[sw1-Vlanif1]vrrp vrid 1 virtual-ip 192.168.1.254
#查询VRRP状态
[sw1-Vlanif1]display vrrp brief
VRID  State        Interface                Type     Virtual IP     
----------------------------------------------------------------
1     Master       Vlanif1                  Normal   192.168.1.254  
----------------------------------------------------------------
Total:1     Master:1     Backup:0     Non-active:0 
#---------配置LSW2
[sw2]interface vlanif 1
[sw2-Vlanif1]vrrp vrid 1 virtual-ip 192.168.1.254
[sw2-Vlanif1]display vrrp brief
VRID  State        Interface                Type     Virtual IP     
----------------------------------------------------------------
1     Backup       Vlanif1                  Normal   192.168.1.254  
----------------------------------------------------------------
Total:1     Master:0     Backup:1     Non-active:0 
#--------VRRP定义优先级,默认100,数值越大,优先给越高
[sw1]interface vlanif1
[sw1-Vlanif1]vrrp vrid 1 priority 199
[sw1-Vlanif1]display vrrp brief
VRID  State        Interface                Type     Virtual IP     
----------------------------------------------------------------
1     Master       Vlanif1                  Normal   192.168.1.254  
----------------------------------------------------------------
Total:1     Master:1     Backup:0     Non-active:0
相关推荐
qq_416560202 分钟前
fmql之ubuntu添加dhcp服务
网络
小狮子安度因37 分钟前
边缘智能-大模型架构初探
linux·网络
优思学院40 分钟前
优思学院|如何从零开始自己学习六西格玛?
大数据·运维·服务器·学习·六西格玛黑带·cssbb
LN花开富贵1 小时前
stm32g431rbt6芯片中VREF+是什么?在电路中怎么设计?
笔记·stm32·单片机·嵌入式硬件·学习
怀九日1 小时前
C++(学习)2024.9.18
开发语言·c++·学习·面向对象·引用·
一道秘制的小菜1 小时前
C++第七节课 运算符重载
服务器·开发语言·c++·学习·算法
宇宙第一小趴菜1 小时前
探索网络世界:TCP/IP协议、Python Socket编程及日常生活比喻
网络·python·tcp/ip
新手嵌入式学习1 小时前
Modbus_tcp
网络·网络协议·tcp/ip
极术社区2 小时前
ResNeXt学习
开发语言·学习·计算机视觉·php
小宋10212 小时前
RabbitMQ:交换机详解(Fanout交换机、Direct交换机、Topic交换机)
服务器·网络·rabbitmq