VLAN和Trunk实验

news2025/3/14 17:38:22

VLAN和Trunk实验

实验拓扑

在这里插入图片描述

实验需求

1.按照图示给所有路由器(此处充当pc机)配置IP地址

2.SW1和SW2上分别创建vlan10和vlan20,要求R1和R3属于vlan10,R2和R4属于vlan20

3.SW1和SW2相连的接口配置类型为trunk类型,允许vlan10和vlan20通过

4.测试效果,同一vlan的路由器可以互通,不同vlan的路由器无法互通

实验步骤

1.路由器配置IP地址
在R1上
<H3C>system-view 
System View: return to User View with Ctrl+Z.
[H3C]sysname R1
[R1]int g0/0
[R1-GigabitEthernet0/0]ip address 192.168.1.1 24
[R1-GigabitEthernet0/0]display ip interface brief 
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description  
GE0/0               up       up       192.168.1.1/24     --           --
GE0/1               down     down     --                 --           --
GE0/2               down     down     --                 --           --
GE5/0               down     down     --                 --           --
GE5/1               down     down     --                 --           --
GE6/0               down     down     --                 --           --
GE6/1               down     down     --                 --           --
Ser1/0              down     down     --                 --           --
Ser2/0              down     down     --                 --           --
Ser3/0              down     down     --                 --           --
Ser4/0              down     down     --                 --           --
[R1-GigabitEthernet0/0]

在R2上
<H3C>system-view 
System View: return to User View with Ctrl+Z.
[H3C]sysname R2
[R2]int g0/0
[R2-GigabitEthernet0/0]ip address 192.168.1.2 24
[R2-GigabitEthernet0/0]display ip interface brief 
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description  
GE0/0               up       up       192.168.1.2/24     --           --
GE0/1               down     down     --                 --           --
GE0/2               down     down     --                 --           --
GE5/0               down     down     --                 --           --
GE5/1               down     down     --                 --           --
GE6/0               down     down     --                 --           --
GE6/1               down     down     --                 --           --
Ser1/0              down     down     --                 --           --
Ser2/0              down     down     --                 --           --
Ser3/0              down     down     --                 --           --
Ser4/0              down     down     --                 --           --
[R2-GigabitEthernet0/0]

在R3上
<H3C>system-view 
System View: return to User View with Ctrl+Z.
[H3C]sysname R3
[R3]int g0/0
[R3-GigabitEthernet0/0]ip address 192.168.1.3 24
[R3-GigabitEthernet0/0]display ip interface brief 
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description  
GE0/0               up       up       192.168.1.3/24     --           --
GE0/1               down     down     --                 --           --
GE0/2               down     down     --                 --           --
GE5/0               down     down     --                 --           --
GE5/1               down     down     --                 --           --
GE6/0               down     down     --                 --           --
GE6/1               down     down     --                 --           --
Ser1/0              down     down     --                 --           --
Ser2/0              down     down     --                 --           --
Ser3/0              down     down     --                 --           --
Ser4/0              down     down     --                 --           --
[R3-GigabitEthernet0/0]

在R4上
<H3C>system-view 
System View: return to User View with Ctrl+Z.
[H3C]sysname R4
[R4]int g0/0
[R4-GigabitEthernet0/0]ip address 192.168.1.4 24
[R4-GigabitEthernet0/0]display ip interface brief 
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description  
GE0/0               up       up       192.168.1.4/24     --           --
GE0/1               down     down     --                 --           --
GE0/2               down     down     --                 --           --
GE5/0               down     down     --                 --           --
GE5/1               down     down     --                 --           --
GE6/0               down     down     --                 --           --
GE6/1               down     down     --                 --           --
Ser1/0              down     down     --                 --           --
Ser2/0              down     down     --                 --           --
Ser3/0              down     down     --                 --           --
Ser4/0              down     down     --                 --           --
[R4-GigabitEthernet0/0]
2.测试四台路由器是否互通
在R1上测试
[R1]ping 192.168.1.2
Ping 192.168.1.2 (192.168.1.2): 56 data bytes, press CTRL+C to break
56 bytes from 192.168.1.2: icmp_seq=0 ttl=255 time=1.322 ms
56 bytes from 192.168.1.2: icmp_seq=1 ttl=255 time=0.704 ms
56 bytes from 192.168.1.2: icmp_seq=2 ttl=255 time=0.649 ms
56 bytes from 192.168.1.2: icmp_seq=3 ttl=255 time=0.407 ms
56 bytes from 192.168.1.2: icmp_seq=4 ttl=255 time=0.492 ms

--- Ping statistics for 192.168.1.2 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.407/0.715/1.322/0.322 ms
[R1]%Mar 13 15:33:42:421 2025 R1 PING/6/PING_STATISTICS: Ping statistics for 192.168.1.2: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 0.407/0.715/1.322/0.322 ms.

[R1]ping 192.168.1.3
Ping 192.168.1.3 (192.168.1.3): 56 data bytes, press CTRL+C to break
56 bytes from 192.168.1.3: icmp_seq=0 ttl=255 time=2.937 ms
56 bytes from 192.168.1.3: icmp_seq=1 ttl=255 time=1.287 ms
56 bytes from 192.168.1.3: icmp_seq=2 ttl=255 time=1.324 ms
56 bytes from 192.168.1.3: icmp_seq=3 ttl=255 time=0.909 ms
56 bytes from 192.168.1.3: icmp_seq=4 ttl=255 time=1.273 ms

--- Ping statistics for 192.168.1.3 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.909/1.546/2.937/0.712 ms
[R1]%Mar 13 15:33:46:677 2025 R1 PING/6/PING_STATISTICS: Ping statistics for 192.168.1.3: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 0.909/1.546/2.937/0.712 ms.

[R1]ping 192.168.1.4
Ping 192.168.1.4 (192.168.1.4): 56 data bytes, press CTRL+C to break
56 bytes from 192.168.1.4: icmp_seq=0 ttl=255 time=2.350 ms
56 bytes from 192.168.1.4: icmp_seq=1 ttl=255 time=1.049 ms
56 bytes from 192.168.1.4: icmp_seq=2 ttl=255 time=1.099 ms
56 bytes from 192.168.1.4: icmp_seq=3 ttl=255 time=1.308 ms
56 bytes from 192.168.1.4: icmp_seq=4 ttl=255 time=1.046 ms

--- Ping statistics for 192.168.1.4 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.046/1.370/2.350/0.499 ms
[R1]%Mar 13 15:33:50:508 2025 R1 PING/6/PING_STATISTICS: Ping statistics for 192.168.1.4: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.046/1.370/2.350/0.499 ms.

3.在交换机SW1和SW2上分别创建vlan10和vlan20,SW1和SW2都把g1/0/1接口加入vlan10,g1/0/2接口加入vlan20
在SW1上
<H3C>system-view 
System View: return to User View with Ctrl+Z.
[H3C]sysname SW1
[SW1]vlan 10
[SW1-vlan10]port g1/0/1
[SW1-vlan10]qu
[SW1]vlan 20
[SW1-vlan20]port g1/0/2
[SW1-vlan20]qu
[SW1]

在SW2上
<H3C>system-view 
System View: return to User View with Ctrl+Z.
[H3C]sysname SW2
[SW2]vlan 10
[SW2-vlan10]port g1/0/1
[SW2-vlan10]qu
[SW2]vlan 20
[SW2-vlan20]port g1/0/2
[SW2-vlan20]qu
[SW2]
4.SW1和SW2的g1/0/3接口都配置为trunk,允许vlan10和vlan20通过
在SW1上把g1/0/3接口配置为Trunk类型,并允许vlan10和vlan20通过
[SW1]int g1/0/3
[SW1-GigabitEthernet1/0/3]port link-type trunk        		//将接口类型改为trunk
[SW1-GigabitEthernet1/0/3]port trunk permit vlan 10 20 		//放行vlan10和vlan20
[SW1-GigabitEthernet1/0/3]display this						//查看当前接口下配置信息
#
interface GigabitEthernet1/0/3
 port link-mode bridge
 port link-type trunk
 port trunk permit vlan 1 10 20
 combo enable fiber
#
return
[SW1-GigabitEthernet1/0/3]

在SW2上把g1/0/3接口配置为Trunk类型,并允许vlan10和vlan20通过
[SW2]int g1/0/3
[SW2-GigabitEthernet1/0/3]port link-type trunk
[SW2-GigabitEthernet1/0/3]port trunk permit vlan 10 20
[SW2-GigabitEthernet1/0/3]display this
#
interface GigabitEthernet1/0/3
 port link-mode bridge
 port link-type trunk
 port trunk permit vlan 1 10 20
 combo enable fiber
#
return
[SW2-GigabitEthernet1/0/3]
5.测试结果,R1可以PING通R3,但无法PING通R2和R4
在R1上pingR2
[R1]ping 192.168.1.2
Ping 192.168.1.2 (192.168.1.2): 56 data bytes, press CTRL+C to break
Request time out
Request time out
Request time out
Request time out
Request time out

--- Ping statistics for 192.168.1.2 ---
5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
[R1]%Mar 13 15:44:47:912 2025 R1 PING/6/PING_STATISTICS: Ping statistics for 192.168.1.2: 5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss.

在R1上pingR3
[R1]ping 192.168.1.3
Ping 192.168.1.3 (192.168.1.3): 56 data bytes, press CTRL+C to break
56 bytes from 192.168.1.3: icmp_seq=0 ttl=255 time=1.053 ms
56 bytes from 192.168.1.3: icmp_seq=1 ttl=255 time=0.615 ms
56 bytes from 192.168.1.3: icmp_seq=2 ttl=255 time=1.157 ms
56 bytes from 192.168.1.3: icmp_seq=3 ttl=255 time=1.041 ms
56 bytes from 192.168.1.3: icmp_seq=4 ttl=255 time=1.410 ms

--- Ping statistics for 192.168.1.3 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.615/1.055/1.410/0.257 ms
[R1]%Mar 13 15:45:13:276 2025 R1 PING/6/PING_STATISTICS: Ping statistics for 192.168.1.3: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 0.615/1.055/1.410/0.257 ms.

在R1上pingR4
[R1]ping 192.168.1.4
Ping 192.168.1.4 (192.168.1.4): 56 data bytes, press CTRL+C to break
Request time out
Request time out
Request time out
Request time out
Request time out

--- Ping statistics for 192.168.1.4 ---
5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
[R1]%Mar 13 15:45:46:526 2025 R1 PING/6/PING_STATISTICS: Ping statistics for 192.168.1.4: 5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss.

实验效果成功实现

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

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

相关文章

鸿蒙开发-一多开发之媒体查询功能

在HarmonyOS中&#xff0c;使用ArkTS语法实现响应式布局的媒体查询是一个强大的功能&#xff0c;它允许开发者根据不同的设备特征&#xff08;如屏幕尺寸、屏幕方向等&#xff09;动态地调整UI布局和样式。以下是一个使用媒体查询实现响应式布局的实例&#xff1a; 1. 导入必要…

【Go学习】04-1-Gin框架-路由请求响应参数

【Go学习】04-1-Gin框架 初识框架go流行的web框架GinirisBeegofiber Gin介绍Gin快速入门 路由RESTful API规范请求方法URI静态url路径参数模糊匹配 处理函数分组路由 请求参数GET请求参数普通参数数组参数map参数 POST请求参数表单参数JSON参数 路径参数文件参数 响应字符串方式…

数据类设计_图片类设计之5_不规则类图形混合算法(前端架构)

前言 学的东西多了,要想办法用出来.C和C是偏向底层的语言,直接与数据打交道.尝试做一些和数据方面相关的内容 引入 接续上一篇,讨论图片类型设计出来后在场景中如何表达,以及不规则图片的混合算法. 图片示意图 图片是怎样表示的,这里把前面的补上 这里的数字1是不规则数据类对…

【模拟CMOS集成电路设计】带隙基准(Bandgap)设计与仿真(基于运放的电流模BGR)

【模拟CMOS集成电路设计】带隙基准&#xff08;Bandgap&#xff09;设计与仿真 前言工程文件&部分参数计算过程&#xff0c;私聊~ 一、 设计指标指标分析&#xff1a; 二、 电路分析三、 仿真3.1仿真电路图3.2仿真结果(1)运放增益(2)基准温度系数仿真(3)瞬态启动仿真(4)静态…

版本控制器Git(4)

文章目录 前言一、分布式版本控制系统的概念二、克隆远程仓库三、多用户协作与公钥管理四、配置Git忽略特殊文件五、给命令配置别名总结 前言 加油加油&#xff0c;路在脚下&#xff01;&#xff01;&#xff01; 一、分布式版本控制系统的概念 本地操作&#xff1a;所有操作&a…

Rabbitmq--延迟消息

13.延迟消息 延迟消息&#xff1a;生产者发送消息时指定一个时间&#xff0c;消费者不会立刻收到消息&#xff0c;而是在指定时间之后才会收到消息 延迟任务&#xff1a;一定时间之后才会执行的任务 1.死信交换机 当一个队列中的某条消息满足下列情况之一时&#xff0c;就会…

springboot436-基于SpringBoot的汽车票网上预订系统(源码+数据库+纯前后端分离+部署讲解等)

&#x1f495;&#x1f495;作者&#xff1a; 爱笑学姐 &#x1f495;&#x1f495;个人简介&#xff1a;十年Java&#xff0c;Python美女程序员一枚&#xff0c;精通计算机专业前后端各类框架。 &#x1f495;&#x1f495;各类成品Java毕设 。javaweb&#xff0c;ssm&#xf…

宇树ROS1开源模型在ROS2中Gazebo中仿真

以GO1为例 1. CMakelists.txt更新语法 cmake_minimum_required(VERSION 3.8) project(go1_description) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")add_compile_options(-Wall -Wextra -Wpedantic) endif() # find dependencies find…

Web网页制作之爱家居的设计(静态网页)

一、使用的是PyCharm来敲写的代码&#xff08;布局&#xff09; 二、主要的html代码的介绍 这段代码展示了如何使用HTML和CSS创建一个结构化的网页&#xff0c;包含导航栏、新闻内容、图片展示和页脚信息。通过引入外部CSS文件&#xff0c;可以进一步美化和布局这些元素。 HTM…

Linux云计算SRE-第二十周

完成ELK综合案例里面的实验&#xff0c;搭建完整的环境 一、 1、安装nginx和filebeat&#xff0c;配置node0(10.0.0.100)&#xff0c;node1(10.0.0.110)&#xff0c;node2(10.0.0.120)&#xff0c;采用filebeat收集nignx日志。 #node0、node1、node2采用以下相同方式收集ngin…

【MATLAB例程】AOA(到达角度)法,多个目标定位算法,三维空间、锚点数量自适应(附完整代码)

给出AOA方法下的多目标定位,适用三维空间,锚点数量>3即可,可自定义目标和锚点的数量、坐标等。 文章目录 运行结果源代码代码讲解概述功能代码结构运行结果 10个锚点、4个目标的情况: 100个锚点、10个目标的情况: 修改方便,只需调节下面的两个数字即可: 源代码 …

Matlab:矩阵运算篇——矩阵数学运算

目录 1.矩阵的加法运算 实例——验证加法法则 实例——矩阵求和 实例——矩阵求差 2.矩阵的乘法运算 1.数乘运算 2.乘运算 3.点乘运算 实例——矩阵乘法运算 3.矩阵的除法运算 1.左除运算 实例——验证矩阵的除法 2.右除运算 实例——矩阵的除法 ヾ(&#xffe3;…

MinIO问题总结(持续更新)

目录 Q: 之前使用正常&#xff0c;突然使用空间为0B&#xff0c;上传文件也是0B&#xff08;部署在k8s中&#xff09;Q: 无法上传大文件参考yaml Q: 之前使用正常&#xff0c;突然使用空间为0B&#xff0c;上传文件也是0B&#xff08;部署在k8s中&#xff09; A: 1、检查pod状态…

智算新纪元,腾讯云HAI-CPU助力法律援助

高性能应用服务 1. ChatbotUI ​应用介绍 基于腾讯云 ​DeepSeek 模型的智能化对话界面&#xff0c;支持灵活集成到企业级应用或服务中&#xff0c;提供自然语言交互能力&#xff0c;适用于客服、知识检索、任务自动化等场景。 ​核心功能 ​多轮对话引擎&#xff1a;支持上下…

android 调用wps打开文档并感知保存事件

需求场景 在项目开发中会碰到需要调用WPS打开Word,Excel,Ppt等Office系列文档的情况&#xff0c;网上目前少有正式介绍如何调用相关API打开文档&#xff0c;并实现文档编辑后回传给三方应用&#xff0c;本人在逛WPS社区时发现 解锁WPS二次开发新世界&#xff1a;Android开发用…

【fnOS飞牛云NAS本地部署跨平台视频下载工具MediaGo与远程访问下载视频流程】

&#x1f49d;&#x1f49d;&#x1f49d;欢迎来到我的博客&#xff0c;很高兴能够在这里和您见面&#xff01;希望您在这里可以感受到一份轻松愉快的氛围&#xff0c;不仅可以获得有趣的内容和知识&#xff0c;也可以畅所欲言、分享您的想法和见解。 推荐:kwan 的首页,持续学…

PyQt基础——简单的窗口化界面搭建以及槽函数跳转

一、代码实现 import sysfrom PyQt6.QtGui import QPixmap from PyQt6.QtWidgets import QApplication, QWidget, QPushButton, QLabel, QLineEdit, QMessageBox from PyQt6.uic import loadUi from PyQt6.QtCore import Qtclass LoginWindow(QWidget):def __init__(self):sup…

【Java--数据结构】优先级队列( PriorityQueue)

一. 优先级队列 1.1 优先级队列的概念 优先级队列是一种特殊的队列&#xff0c;它在入队时会根据元素的优先级进行排序&#xff0c;优先级最高的元素排在队列的前面&#xff0c;出队时会优先出队优先级最高的元素。 1.2 优先级队列的区别 &#xff08;1&#xff09;与普通…

【 <一> 炼丹初探:JavaWeb 的起源与基础】之 JavaWeb 项目的部署:从开发环境到生产环境

<前文回顾> 点击此处查看 合集 https://blog.csdn.net/foyodesigner/category_12907601.html?fromshareblogcolumn&sharetypeblogcolumn&sharerId12907601&sharereferPC&sharesourceFoyoDesigner&sharefromfrom_link <今日更新> 一、开发环境…

【AIGC】OpenAI 集成 Langchain 操作实战使用详解

目录 一、前言 二、前置准备 2.1 安装 Langchain必须的依赖 2.1.1 python环境 2.1.2 langchain openai 环境 2.1.3 准备一个apikey 2.1.4 langchain 核心组件 三、Langchain 各组件使用 3.1 Chat models组件 3.1.1 Invocation 使用 3.1.1.1 结果解析 3.2 提示词模板…