【eNSP模拟实验】单臂路由实现VLAN通信

实验需求

如下图所示,辅导员办公室需要访问处在不同vlan的学生管理服务器的文件,那么如何实现两台终端相互通信呢?我们可以使用单臂路由的方式来实现。

单臂路由(router-on-a-stick)是指在路由器的一个接口上通过配置子接口(或“逻辑接口”,并不存在真正物理接口)的方式,实现原来相互隔离的不同VLAN(虚拟局域网)之间的互联互通。百度链接:单臂路由_百度百科 (baidu.com)

实验操作

配置终端ip地址

首先我们先把PC1Server1的ip地址配置好

双击PC1,按照图下所示配置好ip,配置好后记得一定要点击右下角应用按钮

Server1按照图下所示进行配置,配置好之后,点击右下角的保存按钮

配置S1交换机

在S1交换机上进行如下配置

The device is running!
#进入系统模式
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
#给设备重命名为S1
[Huawei]sysname S1
#关掉提示信息
[S1]un in en
Info: Information center is disabled.
#批量创建vlan10、vlan20
[S1]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
#进入e0/0/1接口
[S1]int e0/0/1
#将接口设置为access模式
[S1-Ethernet0/0/1]port link-type access
#将接口划到vlan10中
[S1-Ethernet0/0/1]port default vlan 10
#进入e0/0/2接口
[S1-Ethernet0/0/1]int e0/0/2
#将接口设置为access模式
[S1-Ethernet0/0/2]port link-type access
#将接口划到vlan20中
[S1-Ethernet0/0/2]port default vlan 20
#进入g0/0/1接口
[S1-Ethernet0/0/2]int g0/0/1
#将接口设置为trunk模式
[S1-GigabitEthernet0/0/1]port link-type trunk
#允许trunk通过所有vlan
[S1-GigabitEthernet0/0/1]port trunk allow-pass vlan all

配置R1路由器

在路由器R1上做如下配置

The device is running!
#进入系统模式
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
#设备重命名为R1
[Huawei]sysname R1
#关闭提示信息
[R1]un in en
Info: Information center is disabled.
#批量创建vlan10、vlan20
[R1]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
#创建虚拟子接口g0/0/1.10(后面的.10和vlan10对应)
[R1]int g0/0/1.10
#给虚拟子接口配置ip
[R1-GigabitEthernet0/0/1.10]ip add 192.168.1.254 24
#封装dot1q协议,加标签
[R1-GigabitEthernet0/0/1.10]dot1q termination vid 10
#开启arp广播
[R1-GigabitEthernet0/0/1.10]arp broadcast enable 
#进入g0/0/1.20虚拟子接口做同样的配置
[R1-GigabitEthernet0/0/1.10]int g0/0/1.20
[R1-GigabitEthernet0/0/1.20]ip add 192.168.2.254 24
[R1-GigabitEthernet0/0/1.20]dot1q termination vid 20
[R1-GigabitEthernet0/0/1.20]arp broadcast enable 

测试连通性

用PC1pingPC2的ip进行连通性测试。可以ping通,说明实验已经成功。

检查配置是否有问题

#查明接口简要配置信息
[R1]dis ip interface brief

R1接口简要配置信息如下:

容易踩坑的地方

PC1的ip配置好了,忘记点应用,导致无法ping通。可以在命令行下使用ipconfig命令查看下PC1的ip地址,有ip地址才是正常的

相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-12 17:12:02       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-12 17:12:02       71 阅读
  3. 在Django里面运行非项目文件

    2024-07-12 17:12:02       58 阅读
  4. Python语言-面向对象

    2024-07-12 17:12:02       69 阅读

热门阅读

  1. mysql8遇到的报错Public Key Retrieval is not allowed

    2024-07-12 17:12:02       21 阅读
  2. MySQL事务

    2024-07-12 17:12:02       20 阅读
  3. C语言阶乘(只用逻辑运算中的短路效应判断)

    2024-07-12 17:12:02       20 阅读
  4. numpy 解释函数nanmax

    2024-07-12 17:12:02       22 阅读
  5. AIGC:AI创作短片-流程以及工具介绍(学习笔记)

    2024-07-12 17:12:02       23 阅读
  6. NLP简介

    NLP简介

    2024-07-12 17:12:02      20 阅读
  7. Linux 内核中的 Makefile 和 Kconfig:深入理解与实践

    2024-07-12 17:12:02       19 阅读
  8. 【Cesium开发实战】淹没分析功能的实现

    2024-07-12 17:12:02       19 阅读
  9. 人生低谷来撸C#--007 结构体

    2024-07-12 17:12:02       23 阅读