网络学习-eNSP配置VRRP

embedded/2024/10/21 5:55:01/

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

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

在这里插入图片描述

#配置三层交换机和路由器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: PublicDestinations : 8        Routes : 9        Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface192.168.1.0/24  Direct  0    0           D   192.168.1.252   Vlanif1192.168.2.0/24  Direct  0    0           D   192.168.2.2     Vlanif2192.168.3.0/24  OSPF    10   2           D   192.168.2.1     Vlanif2192.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 1Interface                         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         Interface192.168.1.0/24  Direct  0    0           D   192.168.1.253   Vlanif1192.168.2.0/24  OSPF    10   2           D   192.168.3.1     Vlanif3192.168.3.0/24  Direct  0    0           D   192.168.3.2     Vlanif3192.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 1Interface                         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 0Interface                         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配置
#---------配置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

http://www.ppmy.cn/embedded/108853.html

相关文章

一键云迁移:利用VMware PowerCLI将OVA虚拟机顺利迁移到AWS

哈喽大家好&#xff0c;欢迎来到虚拟化时代君&#xff08;XNHCYL&#xff09;。 “ 大家好&#xff0c;我是虚拟化时代君&#xff0c;一位潜心于互联网的技术宅男。这里每天为你分享各种你感兴趣的技术、教程、软件、资源、福利…&#xff08;每天更新不间断&#xff0c;福利…

YOLOv5的数据增强详解

文章目录 前言数据增强1.Mosaic&#xff08;马赛克增强&#xff09;2.MixUp&#xff08;混合增强&#xff09;3.Letterbox&#xff08;自适应缩放技术&#xff09;4.Random perspective&#xff08;随机透视变换&#xff09;5.Albumentations模块5.HSV变换6.Flip&#xff08;翻…

Java | Leetcode Java题解之第390题消除游戏

题目&#xff1a; 题解&#xff1a; class Solution {public int lastRemaining(int n) {int a1 1;int k 0, cnt n, step 1;while (cnt > 1) {if (k % 2 0) { // 正向a1 a1 step;} else { // 反向a1 (cnt % 2 0) ? a1 : a1 step;}k;cnt cnt >> 1;step s…

关于HarmonyOS的学习

day23 一、DOM尺寸和位置 1.只能获取到内联style属性的CSS样式中的宽和高&#xff0c;如果有&#xff0c;获取;如果没有&#xff0c;则返回空 $(.box1).style.width $(.box1).style.height $.box1).style.backgroundColor 2.返回了元素大小&#xff0c;但没有单位&#xff0…

面试准备-6

NIO底层是用Selector、Channel和ByteBuffer来实现的。主线程在循环使用select方法进行阻塞等待&#xff0c;当有acceptable&#xff08;可连接&#xff09;、readable&#xff08;可读&#xff09;或者writable&#xff08;可写&#xff09;事件发生的时候&#xff0c;循环就会…

HomeAssistant添加HACS绑定米家与苹果HomeKit设备并实现远程管理

文章目录 前言1. 下载HACS源码2. 添加HACS商店3. 绑定米家设备 前言 之前介绍过如何实现在群晖NAS使用Docker部署HomeAssistant&#xff0c;通过内网穿透在户外控制家庭智能设备。本文将介绍如何在HA平台安装HACS插件商店&#xff0c;将米家&#xff0c;果家设备接入 Home Ass…

在JS中flat() 和 flatMap()使用讲解

flat() 和 flatMap() 是 JavaScript 中处理数组的两个方法&#xff0c;用于处理嵌套数组&#xff0c;但它们有不同的用途和效果。以下是它们的详细区别&#xff1a; 1. Array.prototype.flat() 功能&#xff1a;将嵌套的数组“拉平”成一维数组。 语法&#xff1a; array.fla…

[NISACTF 2022]easyssrf

打开题目所在的环境&#xff0c;发现是快照获取的工具&#xff0c;这里我尝试输入的是百度的网址&#xff0c;发现他会返回这个网站的一些基本信息 &#xff1a; 这个题目提示了ssrf&#xff0c;我们这里用file协议开始测试&#xff1a; file:///etc/password 发现返回的结果是…