单臂路由实验

单臂路由实验

实验拓扑#

实验需求#

  1. 按照图示为 PC3 和 PC4 配置 IP 地址和网关
  2. PC3 属于 Vlan10,PC4 属于 Vlan20,配置单臂路由实现 Vlan10 和 Vlan20 三层互通
  3. PC3 和 PC4 可以互通

配置步骤#

1.PC 配置 IP 地址部分略#

2.PC3 属于 Vlan10,PC4 属于 Vlan20,配置单臂路由实现 Vlan10 和 Vlan20 三层互通#

分析: 用单臂路由实现 Vlan 间三层互通,需要把 SW2 连接 AR1 的接口配置为 Trunk,并允许 Vlan10 和 Vlan20 通过。

AR1 连接 SW2 的接口上要开启子接口,分别作为 Vlan10 和 Vlan20 的网关。这里规划 g0/0.1 子接口作为 Vlan10 的网关,IP 地址就是192.168.1.254/24,g0/0.2 子接口作为 Vlan20 的网关,IP 地址就是192.168.2.254/24。

AR1 的子接口上为了能够识别 SW2 的 Trunk 端口发送的 802.1Q 帧,还需要开启 dot1q 识别并绑定相应 Vlan。

步骤 1: 在 SW2 上创建 Vlan10 和 Vlan20,并把 g1/0/1 接口加入 Vlan10,把 g1/0/2 接口加入 Vlan20

vlan 10
port g1/0/1
vlan 20
port g1/0/2

步骤 2: 把 SW2 的 g1/0/3 接口配置为 Trunk,并允许 Vlan10 和 Vlan20 通过

interface g1/0/3
port link-type trunk
port trunk permit vlan 10 20

步骤 3: 在 AR1 上创建子接口 g0/0.1,开启 dot1q 识别,绑定到 Vlan10,并配置 IP 地址 192.168.1.254/24

interface g0/0.1
vlan-type dot1q vid 10
ip address 192.168.1.254 24

步骤 4: 在 AR1 上创建子接口 0/0.2,开启 dot1q 识别,绑定到 Vlan20,并配置 IP 地址192.168.2.254/24

interface g0/0.2
vlan-type dot1q vid 20
ip address 192.168.2.254 24

分析: 配置结束后,在 AR1 上查看路由表,会发现已经产生了到达192.168.1.0/24网段和192.168.2.0/24网段的直连路由,出接口分别指向各自子接口,证明路由器已经可以对 Vlan10 和 Vlan20 间的数据进行三层转发了

[AR1]display ip routing-table
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.0/24 Direct 0 0 192.168.1.254 GE0/0.1
192.168.1.254/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.255/32 Direct 0 0 192.168.1.254 GE0/0.1
192.168.2.0/24 Direct 0 0 192.168.2.254 GE0/0.2
192.168.2.254/32 Direct 0 0 127.0.0.1 InLoop0
192.168.2.255/32 Direct 0 0 192.168.2.254 GE0/0.2
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

3.测试在 PC3 上 Ping PC4 ,可以 Ping 通 PC4#

[H3C]ping 192.168.2.1
Ping 192.168.2.1 (192.168.2.1): 56 data bytes, press CTRL_C to break
56 bytes from 192.168.2.1: icmp_seq=0 ttl=254 time=10.313 ms
56 bytes from 192.168.2.1: icmp_seq=1 ttl=254 time=9.691 ms
56 bytes from 192.168.2.1: icmp_seq=2 ttl=254 time=8.030 ms
56 bytes from 192.168.2.1: icmp_seq=3 ttl=254 time=8.680 ms
56 bytes from 192.168.2.1: icmp_seq=4 ttl=254 time=8.871 ms
--- Ping statistics for 192.168.2.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 8.030/9.117/10.313/0.799 ms
[H3C]%Aug 28 16:59:51:153 2026 H3C PING/6/PING_STATISTICS: Ping statistics for 192.168.2.1: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 8.030/9.117/10.313/0.799 ms.
Profile Image of the Author
Ynm
Hello, I'm Ynm.
公告
近期Cloudflare全球网络波动导致本站部分地区访问变慢,若遇长时间加载,刷新或稍后重试通常可恢复。 欢迎来到我的博客,本博客仅供学习交流使用,请严格遵守法律法规,未经授权严禁对真实目标进行扫描或攻击!
分类
标签
最新动态