单臂路由
定义
单臂路由(router-on-a-stick)是指在路由器的一个接口上通过配置子接口(或“逻辑接口”,并不存在真正物理接口)的方式,实现原来相互隔离的不同VLAN(虚拟局域网)之间的互联互通。
实验
在ensp中画出拓扑如下:
(vlan10) pc1:192.168.10.10/24
(vlan20) pc1:192.168.20.10/24
R1
[Huawei]sys
[Huawei]sysname R1
[R1]int g0/0/0.10
[R1-GigabitEthernet0/0/0.10]dot1q termination vid 10
[R1-GigabitEthernet0/0/0.10]ip add 192.168.10.1 255.255.255.0
[R1-GigabitEthernet0/0/0.10]arp b en
[R1-GigabitEthernet0/0/0.10]int g0/0/0.20
[R1-GigabitEthernet0/0/0.20]dot1q termination vid 20
[R1-GigabitEthernet0/0/0.20]ip add 192.168.20.1 255.255.255.0
[R1-GigabitEthernet0/0/0.20]arp b en
LSW1
[SW1]vlan batch 10 20
[SW1]int e0/0/1
[SW1-Ethernet0/0/1]p l a
[SW1-Ethernet0/0/1]p d v 10
[SW1-Ethernet0/0/1]undo sh
[SW1-Ethernet0/0/1]int e0/0/2
[SW1-Ethernet0/0/2]p l a
[SW1-Ethernet0/0/2]p d v 20
[SW1-Ethernet0/0/2]undo sh
[SW1-Ethernet0/0/2]int g0/0/1
[SW1-GigabitEthernet0/0/1]p l t
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/1]undo sh
测试联通:
在PC1配置IP地址:
在PC2配置IP地址:
PC>ping 192.168.20.10
Ping 192.168.20.10: 32 data bytes, Press Ctrl_C to break
From 192.168.20.10: bytes=32 seq=1 ttl=127 time=156 ms
From 192.168.20.10: bytes=32 seq=2 ttl=127 time=78 ms
From 192.168.20.10: bytes=32 seq=3 ttl=127 time=94 ms
From 192.168.20.10: bytes=32 seq=4 ttl=127 time=78 ms
From 192.168.20.10: bytes=32 seq=5 ttl=127 time=47 ms
--- 192.168.20.10 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 47/90/156 ms
能实现全网互通
原文地址:https://blog.51cto.com/14475593/2447263
时间: 2024-11-08 04:24:03