工具: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表項不過期。