
一,实验步骤:
在交换机sw1,sw2上分别创建vlan10 ,vlan20,并在交换机SW1,SW2交换机上把端口g1/0/1,g1/0/2分别划分到vlan10,vlan20里,SW1具体配置如下:
[sw1]vlan 10 #创建vlan10
[sw1-vlan10]port GigabitEthernet 1/0/1 to GigabitEthernet 1/0/2 #把接口划到vlan10里
[sw1-vlan10]display vlan 10 查看vlan10的详细信息
VLAN ID: 10
VLAN type: Static
Route interface: Not configured
Description: VLAN 0010
Name: VLAN 0010
Tagged ports:
None
Untagged ports:
GigabitEthernet1/0/1(D) GigabitEthernet1/0/2(U)
SW2具体配置如下:
[sw2]vlan 20 #创建vlan20
[sw2-vlan20]port GigabitEthernet 1/0/1 to g1/0/2 #把接口划到vlan20里
[sw2-vlan20]display vlan 20 查看vlan20的详细信息
VLAN ID: 20
VLAN type: Static
Route interface: Not configured
Description: VLAN 0020
Name: VLAN 0020
Tagged ports:
None
Untagged ports:
GigabitEthernet1/0/1(D) GigabitEthernet1/0/2(U)
二,测试二台主机连通情况:
- 如上图配置PC3 ip地址:192.168.1.10,PC4 ip地址:192.168.1.20,然后用PC3去ping PC4,可以正常ping通,具体如下图:


- 测试 Host_3 与 Host_4 可以正常通信

三,Wireshark抓包分析:
在交换机SW1的g1/0/2口抓包,PVID 即交换机端口所属 VLAN 的标识,


- 接下来我们网络拓扑修改一下,sw1和sw2的g1/0/2分别设置成trunk口,sw2创建vlan10,把g1/0/1划入vlan10如下图:

<sw2>system-view
System View: return to User View with Ctrl+Z.
[sw2]vlan 10
[sw2-vlan10]port GigabitEthernet 1/0/1
[sw2-vlan10]display vlan 10
VLAN ID: 10
VLAN type: Static
Route interface: Not configured
Description: VLAN 0010
Name: VLAN 0010
Tagged ports:
None
Untagged ports:
GigabitEthernet1/0/1(U)
- 经测试,Host_3与 Host_4 之间可以相互 Ping 通,Wireshark 在两台交换机之间的 G1/0/2 端口上的,抓包结果如下图,可以说明在两台交换机之间传输的是 IEEE802.1q 帧。

- 分析结果如下:

H3C三层交换机DHCP配置:https://www.hao0564.com/4813.html