VRRP配置案例(路由走向分析,端口切换)

以下配置图为例

PC1的配置

acsw下行为access口,上行为trunk口, 将g0/0/3划分到vlan100中

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname acsw
[acsw]
Sep 11 2023 18:15:48-08:00 acsw DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 4, the 
change loop count is 0, and the maximum number of records is 4095.
[acsw]undo info-center enable
Info: Information center is disabled.
[acsw]vlan 10[acsw-vlan100]int g0/0/3
[acsw-GigabitEthernet0/0/3]port link-type access[acsw-GigabitEthernet0/0/3]port default vlan 10
[acsw-GigabitEthernet0/0/3]qu[acsw]int g0/0/1
[acsw-GigabitEthernet0/0/1]port link-type trunk
[acsw-GigabitEthernet0/0/1]port trunk allow-pass vlan all[acsw-GigabitEthernet0/0/1]int g0/0/2
[acsw-GigabitEthernet0/0/2]port link-type trunk
[acsw-GigabitEthernet0/0/2]port trunk allow-pass vlan all[acsw-GigabitEthernet0/0/2]qu
[acsw]

 核心交换机1的配置

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname coresw1
[coresw1]
Sep 11 2023 21:33:29-08:00 coresw1 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, t
he change loop count is 0, and the maximum number of records is 4095.
[coresw1]undo info-center enable
Info: Information center is disabled.
[coresw1]interface g0/0/1
[coresw1-GigabitEthernet0/0/1]port link-type trunk
[coresw1-GigabitEthernet0/0/1]port trunk allow-pass vlan all[coresw1-GigabitEthernet0/0/1]int g0/0/3
[coresw1-GigabitEthernet0/0/3]port link-type trunk
[coresw1-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[coresw1-GigabitEthernet0/0/3]q[coresw1]vlan 10
[coresw1-vlan10]q
[coresw1]vlan 100
[coresw1-vlan100]q
[coresw1]int g0/0/2
[coresw1-GigabitEthernet0/0/2]port link-type access
[coresw1-GigabitEthernet0/0/2]port default vlan 100
[coresw1-GigabitEthernet0/0/2]q[coresw1]interface vlanif 10
[coresw1-Vlanif10]ip address 192.168.10.252 24
[coresw1-Vlanif10]qu[coresw1]interface vlanif 100
[coresw1-Vlanif100]ip add 192.168.100.1 30
[coresw1-Vlanif100]qu<coresw1>sys
Enter system view, return user view with Ctrl+Z.
[coresw1]interface vlanif 10
#必配
[coresw1-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254
#选配
[coresw1-Vlanif10]vrrp vrid 10 priority 120
[coresw1-Vlanif10]vrrp vrid 10 preempt-mode time delay 20
[coresw1-Vlanif10]qu
[coresw1]
[coresw1]display vrrpVlanif10 | Virtual Router 10State : MasterVirtual IP : 192.168.10.254Master IP : 192.168.10.252PriorityRun : 120PriorityConfig : 120MasterPriority : 120Preempt : YES   Delay Time : 20 sTimerRun : 1 sTimerConfig : 1 sAuth type : NONEVirtual MAC : 0000-5e00-010aCheck TTL : YESConfig type : normal-vrrpCreate time : 2023-09-11 21:57:31 UTC-08:00Last change time : 2023-09-11 21:57:35 UTC-08:00#抢占延迟20秒的作用
这里我们先将coresw1
vrrp vrid 10 priority 90
在变为
vrrp vrid 10 priority 120
我们通过tracert路径可以看见,还是走coresw2,这就是因为有抢占延迟

核心交换机2的配置

<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname coresw2
[coresw2]
Sep 11 2023 21:48:13-08:00 coresw2 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, t
he change loop count is 0, and the maximum number of records is 4095.
[coresw2]undo info-center enable
Info: Information center is disabled.
[coresw2]interface g0/0/1
[coresw2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[coresw2-GigabitEthernet0/0/1]int g0/0/3
[coresw2-GigabitEthernet0/0/3]p l t
[coresw2-GigabitEthernet0/0/3]port trunk allow vlan all
[coresw2-GigabitEthernet0/0/3]qu
[coresw2]vlan 10
[coresw2-vlan10]vlan 200
[coresw2-vlan200]qu
[coresw2]interface g0/0/2
[coresw2-GigabitEthernet0/0/2]port link-type access
[coresw2-GigabitEthernet0/0/2]port default vlan 200
[coresw2-GigabitEthernet0/0/2]qu
[coresw2]int vlanif 10
[coresw2-Vlanif10]ip add 192.168.10.253 24
[coresw2-Vlanif10]interface vlan 200
[coresw2-Vlanif200]ip address 192.168.200.1 30
[coresw2-Vlanif200]
[coresw2-Vlanif200]ping 192.168.10.252PING 192.168.10.252: 56  data bytes, press CTRL_C to breakReply from 192.168.10.252: bytes=56 Sequence=1 ttl=255 time=130 msReply from 192.168.10.252: bytes=56 Sequence=2 ttl=255 time=60 msReply from 192.168.10.252: bytes=56 Sequence=3 ttl=255 time=70 msReply from 192.168.10.252: bytes=56 Sequence=4 ttl=255 time=60 msReply from 192.168.10.252: bytes=56 Sequence=5 ttl=255 time=70 ms[coresw2]  
[coresw2]int vlanif 10
#必选
[coresw2-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254
[coresw2-Vlanif10]
#默认优先级是100,但是第一个核心交换机为120,所以第一个是master
[coresw2-Vlanif10]qu[coresw2]display vrrpVlanif10 | Virtual Router 10State : BackupVirtual IP : 192.168.10.254Master IP : 192.168.10.252PriorityRun : 100PriorityConfig : 100MasterPriority : 120Preempt : YES   Delay Time : 0 sTimerRun : 1 sTimerConfig : 1 sAuth type : NONEVirtual MAC : 0000-5e00-010aCheck TTL : YESConfig type : normal-vrrpCreate time : 2023-09-11 22:05:51 UTC-08:00Last change time : 2023-09-11 22:05:51 UTC-08:00[coresw2]

ping 网关,是master,即coresw1进行回应

PC>ping 192.168.10.254Ping 192.168.10.254: 32 data bytes, Press Ctrl_C to break
From 192.168.10.254: bytes=32 seq=1 ttl=255 time=31 ms
From 192.168.10.254: bytes=32 seq=2 ttl=255 time=31 ms
From 192.168.10.254: bytes=32 seq=3 ttl=255 time=47 ms
From 192.168.10.254: bytes=32 seq=4 ttl=255 time=47 ms
From 192.168.10.254: bytes=32 seq=5 ttl=255 time=31 ms--- 192.168.10.254 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 31/37/47 ms

AR1的配置

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname AR1
[AR1]interface g0/0/1
[AR1-GigabitEthernet0/0/1]ip add 192.168.100.2 30
Sep 11 2023 22:16:34-08:00 AR1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IPon the interface GigabitEthernet0/0/1 has entered the UP state. 
[AR1-GigabitEthernet0/0/1]int g0/0/2
[AR1-GigabitEthernet0/0/2]ip add 192.168.200.2 30
[AR1-GigabitEthernet0/0/2]
Sep 11 2023 22:17:17-08:00 AR1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IPon the interface GigabitEthernet0/0/2 has entered the UP state. 
[AR1-GigabitEthernet0/0/2]int g0/0/0 
[AR1-GigabitEthernet0/0/0]ip add 100.1.1.2 30
[AR1-GigabitEthernet0/0/0]
Sep 11 2023 22:17:39-08:00 AR1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IPon the interface GigabitEthernet0/0/0 has entered the UP state. 
[AR1-GigabitEthernet0/0/0]q
#ping直连
[AR1]ping 192.168.100.1PING 192.168.100.1: 56  data bytes, press CTRL_C to breakReply from 192.168.100.1: bytes=56 Sequence=1 ttl=255 time=50 msReply from 192.168.100.1: bytes=56 Sequence=2 ttl=255 time=10 msReply from 192.168.100.1: bytes=56 Sequence=3 ttl=255 time=10 msReply from 192.168.100.1: bytes=56 Sequence=4 ttl=255 time=30 msReply from 192.168.100.1: bytes=56 Sequence=5 ttl=255 time=20 ms--- 192.168.100.1 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 10/24/50 ms[AR1]ping 192.168.200.1PING 192.168.200.1: 56  data bytes, press CTRL_C to breakReply from 192.168.200.1: bytes=56 Sequence=1 ttl=255 time=50 msReply from 192.168.200.1: bytes=56 Sequence=2 ttl=255 time=20 msReply from 192.168.200.1: bytes=56 Sequence=3 ttl=255 time=10 msReply from 192.168.200.1: bytes=56 Sequence=4 ttl=255 time=30 msReply from 192.168.200.1: bytes=56 Sequence=5 ttl=255 time=10 ms--- 192.168.200.1 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 10/24/50 ms

 互联网的配置

sys
int g0/0/0
ip add 100.1.1.1 30

 到这里PC1仍然ping不通互联网,PC1与互联网并不在一个网段,就到达网关(coresw1)

<coresw1>display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: PublicDestinations : 7        Routes : 7        Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0192.168.10.0/24  Direct  0    0           D   192.168.10.252  Vlanif10192.168.10.252/32  Direct  0    0           D   127.0.0.1       Vlanif10192.168.10.254/32  Direct  0    0           D   127.0.0.1       Vlanif10192.168.100.0/30  Direct  0    0           D   192.168.100.1   Vlanif100192.168.100.1/32  Direct  0    0           D   127.0.0.1       Vlanif100

重要的一步

#配置默认路由,5个0,8个0都可以
[coresw1]ip route-static 0.0.0.0 0.0.0.0 192.168.100.2[coresw2]ip route-static 0.0.0.0 0 192.168.200.2

到达这一步,再配置互联网的回程路由
这里可以写静态路由,也可以写默认路由

#静态ip
ip route-static 192.168.10.0 24 100.1.1.2#默认路由
ip route-static 0.0.0.0 0 100.1.1.2

 这里AR1没有目的地址:192.168.10.1的路由 

[AR1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: PublicDestinations : 13       Routes : 13       Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface100.1.1.0/30  Direct  0    0           D   100.1.1.2       GigabitEthernet
0/0/0100.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0100.1.1.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0127.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       InLoopBack0192.168.100.0/30  Direct  0    0           D   192.168.100.2   GigabitEthernet
0/0/1192.168.100.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1192.168.100.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1192.168.200.0/30  Direct  0    0           D   192.168.200.2   GigabitEthernet
0/0/2192.168.200.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2192.168.200.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

 所以AR1还需要配静态路由

[AR1]ip route-static 192.168.10.0 24 192.168.100.1
[AR1]ip route-static 192.168.10.0 24 192.168.200.1

 现在终于可以ping通啦!!

注:

可以用tracert观察路径

 最后一个问题:端口的切换

#如果g0/0/2接口down了,那么其优先级变为120-30=90,那么master会变为coresw2
[coresw1]interface vlanif 10
[coresw1-Vlanif10]vrrp vrid 10 track interface g0/0/2
[coresw1-Vlanif10]vrrp vrid 10 track interface g0/0/2 reduced 30

可以自己试试

[coresw1]int g0/0/2
[coresw1-GigabitEthernet0/0/2]shutdown
[coresw1-GigabitEthernet0/0/2]qu
[coresw1]display vrrpVlanif10 | Virtual Router 10State : MasterVirtual IP : 192.168.10.254Master IP : 192.168.10.252PriorityRun : 90PriorityConfig : 120MasterPriority : 90Preempt : YES   Delay Time : 20 sTimerRun : 1 sTimerConfig : 1 sAuth type : NONEVirtual MAC : 0000-5e00-010aCheck TTL : YESConfig type : normal-vrrpTrack IF : GigabitEthernet0/0/2   Priority reduced : 30IF state : DOWNCreate time : 2023-09-11 21:57:31 UTC-08:00Last change time : 2023-09-11 21:57:35 UTC-08:00[coresw2]display vrrpVlanif10 | Virtual Router 10State : MasterVirtual IP : 192.168.10.254Master IP : 192.168.10.253PriorityRun : 120PriorityConfig : 120MasterPriority : 120Preempt : YES   Delay Time : 20 sTimerRun : 1 sTimerConfig : 1 sAuth type : NONEVirtual MAC : 0000-5e00-010aCheck TTL : YESConfig type : normal-vrrpCreate time : 2023-09-11 22:05:51 UTC-08:00Last change time : 2023-09-11 22:56:50 UTC-08:00

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.xdnf.cn/news/147357.html

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

再次总结nios II 下载程序到板子上时出现 Downloading RLF Process failed的问题

之前也写过两篇关于NIOS II 出现&#xff1a;Downloading RLF Process failed的问题&#xff0c;但是总结都不是很全面&#xff0c;小梅哥的教程总结的比较全面特此记录。 问题&#xff1a;nios II 下载程序到板子上时出现 Downloading RLF Process failed的问题。 即当nios中…

《Jetpack Compose从入门到实战》 第二章 了解常用UI组件

目录 常用的基础组件文字组件图片组件按钮组件选择器组件对话框组件进度条组件 常用的布局组件布局Scaffold脚手架 列表 书附代码 Google的图标库 常用的基础组件 文字组件 Composable fun TestText() {Column(modifier Modifier.verticalScroll(state rememberScrollState…

Ubuntu20.04.1编译qt6.5.3版mysql驱动

下载qtbase6.5.3源码&#xff0c;将plugin中sqldrivers源码拷至于项目工程中&#xff0c;使用qtcreator打开文件 1、下载mysql开发库 sudo apt-get update sudo apt-get install build-essential libmysqlclient-dev 2、在msyql子目录中CMakeLists.txt第一行添加头文件、引…

浏览器指定DNS

edge--设置 https://dns.alidns.com/dns-query

前端页面初步开发

<template><div><el-card class"box-card" style"height: 620px"><el-input v-model"query.name" style"width:200px" placeholder"请输入用户姓名"></el-input>&nbsp&nbsp&nbsp…

yolov8 opencv模型部署(C++版)

yolov8 opencv模型部署&#xff08;C 版&#xff09; 使用opencv推理yolov8模型&#xff0c;仅依赖opencv&#xff0c;无需其他库&#xff0c;以yolov8s为例子&#xff0c;注意&#xff1a; 使用opencv4.8.0 &#xff01;使用opencv4.8.0 &#xff01;使用opencv4.8.0 &#…

有时候,使用 clang -g test.c 编译出可执行文件后,发现 gdb a.out 进行调试无法读取符号信息,为什么?

经过测试&#xff0c;gdb 并不是和所有版本的 llvm/clang 都兼容的 当 gdb 版本为 9.2 时&#xff0c;能支持 9.0.1-12 版本的 clang&#xff0c;但无法支持 16.0.6 版本的 clang 可以尝试使用 LLVM 专用的调试器 lldb 我尝试使用了 16.0.6 版本的 lldb 调试 16.0.6 的 clan…

string类的使用方式的介绍

目录 前言 1.什么是STL 2. STL的版本 3. STL的六大组件 4.STL的缺陷 5.string 5.1 为什么学习string类&#xff1f; 5.1.1 C语言中的字符串 5.2 标准库中的string类 5.3 string类的常用接口的使用 5.3.1 构造函数 5.3.2 string类对象的容量操作 5.3.3 string类对象…

Multiple CORS header ‘Access-Control-Allow-Origin‘ not allowed

今天在修改天天生鲜超市项目的时候&#xff0c;因为使用了前后端分离模式&#xff0c;前端通过网关统一转发请求到后端服务&#xff0c;但是第一次使用就遇到了问题&#xff0c;比如跨域问题&#xff1a; 但是&#xff0c;其实网关里是有配置跨域的&#xff0c;只是忘了把前端项…

画CMB天图使用Planck配色方案

使用Planck的配色方案&#xff1a; 全天图&#xff1a; 或者方形图&#xff1a; 使用下面设置即可&#xff1a; import pspy, pixell from pspy.so_config import DEFAULT_DATA_DIR pixell.colorize.mpl_setdefault("planck")此方法不会改变matplotlib默认配色方案…

虚拟机安装 centos

title: 虚拟机安装 centos createTime: 2020-12-13 12:00:27 updateTime: 2020-12-13 12:00:27 categories: linux tags: 虚拟机安装 centos 路线图 主机(宿主机) —> centos --> docker --> docker 镜像 --> docker 容器 — docker 服务 1.前期准备 一台 主机 或…

分类预测 | Matlab实现SSA-CNN-SVM麻雀算法优化卷积支持向量机分类预测

分类预测 | Matlab实现SSA-CNN-SVM麻雀算法优化卷积支持向量机分类预测 目录 分类预测 | Matlab实现SSA-CNN-SVM麻雀算法优化卷积支持向量机分类预测分类效果基本描述程序设计参考资料 分类效果 基本描述 1.Matlab实现SSA-CNN-SVM麻雀算法优化卷积支持向量机分类预测&#xff0…

TensorFlow入门(一、环境搭建)

一、下载安装Anaconda 下载地址:http://www.anaconda.comhttp://www.anaconda.com 下载完成后运行exe进行安装 二、下载cuda 下载地址:http://developer.nvidia.com/cuda-downloadshttp://developer.nvidia.com/cuda-downloads 下载完成后运行exe进行安装 安装后winR cmd进…

JAVA面经整理(5)

创建线程池不是说现用先创建&#xff0c;而是要是可以复用线程池中的线程&#xff0c;就很好地避免了大量用户态和内核态的交互&#xff0c;不需要频繁的创建和销毁线程 一)什么是池化技术&#xff1f;什么是线程池&#xff1f; 1)池化技术是提前准备好一些资源&#xff0c;在…

[React] 性能优化相关 (一)

文章目录 1.React.memo2.useMemo3.useCallback4.useTransition5.useDeferredValue 1.React.memo 当父组件被重新渲染的时候&#xff0c;也会触发子组件的重新渲染&#xff0c;这样就多出了无意义的性能开销。如果子组件的状态没有发生变化&#xff0c;则子组件是不需要被重新渲…

华为智能企业上网行为管理安全解决方案(1)

华为智能企业上网行为管理安全解决方案&#xff08;1&#xff09; 课程地址方案背景需求分析企业上网行为概述企业上网行为安全风险分析企业上网行为管理需求分析 方案设计组网架构设备选型设备简介行为管理要点分析方案功能概述 课程地址 本方案相关课程资源已在华为O3社区发…

网络协议--概述

1.2 分层 网络协议通常分不同层次进行开发&#xff0c;每一层分别负责不同的通信功能。一个协议族&#xff0c;比如TCP/IP&#xff0c;是一组不同层次上的多个协议的组合。TCP/IP通常被认为是一个四层协议系统&#xff0c;如图1-1所示。 每一层负责不同的功能&#xff1a; 1.…

C++(string类)

本节目标&#xff1a; 1、为什么要学习string类 2.标准库中的string类 3.vs和g下string结构说明 1.为什么学习string类 1.1 c语言中的字符串 C 语言中&#xff0c;字符串是以 \0 结尾的一些字符的集合&#xff0c;为了操作方便&#xff0c; C 标准库中提供了一些 str系列的…

基于java的鲜花销售系统/网上花店

摘 要 本毕业设计的内容是设计并且实现一个基于Spring Boot框架的驿城鲜花销售系统。它是在Windows下&#xff0c;以MYSQL为数据库开发平台&#xff0c;Tomcat网络信息服务作为应用服务器。驿城鲜花销售系统的功能已基本实现&#xff0c;主要包括首页、个人中心、用户管理、鲜…

【算法挨揍日记】day10——704. 二分查找、34. 在排序数组中查找元素的第一个和最后一个位置

704. 二分查找 704. 二分查找 题目描述&#xff1a; 给定一个 n 个元素有序的&#xff08;升序&#xff09;整型数组 nums 和一个目标值 target &#xff0c;写一个函数搜索 nums 中的 target&#xff0c;如果目标值存在返回下标&#xff0c;否则返回 -1。 解题思路&…