工具:eNSP
拓扑:
配置:
SW-1:
#
sysname SW-1
#
vlan batch 2 to 3
#
interface GigabitEthernet0/0/1
description to_RT-1
port link-type trunk
port trunk allow-pass vlan 2 to 3
stp disable
#
interface GigabitEthernet0/0/2
description to_pc1
port link-type access
port default vlan 2
#
interface GigabitEthernet0/0/3
description to_pc2
port link-type access
port default vlan 3
#
---------------------
RT-1:
#
sysname RT-1
#
interface GigabitEthernet0/0/0
description to_SW-1
#
interface GigabitEthernet0/0/0.2
dot1q termination vid 2
ip address 10.10.10.1 255.255.255.0
arp broadcast enable
#
interface GigabitEthernet0/0/0.3
dot1q termination vid 3 //指定使用标准IEEE802.1q打上VLAN号为3的标签
ip address 10.10.20.1 255.255.255.0
arp broadcast enable //开启路由子接口的ARP广播功能,默认关闭状态,无法进行ARP广播导致获取 //目标的MAC地址
----------------------
PC-1:
10.10.10.100
255.255.255.0
10.10.10.1
----------------------
PC-2:
10.10.20.100
255.255.255.0
10.10.20.1
----------------------
结果分析:
PC2 Ping PC1
通讯过程:
顺便分析一下数据帧中插入的4个字节的802.1q标签(非封装型)
建立正常的通讯之后,路由器会维护自身的ARP表项,因此会定期向两个终端发送ARP请求来保持ARP表项不过期。