基于端口的VLAN组网图
主机A和主机C为同一网段,主机B和主机D为同一网段
(1) 配置Device A
# 创建VLAN 100,并将GigabitEthernet1/0/1加入VLAN 100。
<DeviceA> system-view
[DeviceA] vlan 100
[DeviceA-vlan100] port gigabitethernet 1/0/1
[DeviceA-vlan100] quit
# 创建VLAN 200,并将GigabitEthernet1/0/2加入VLAN 200。
[DeviceA] vlan 200
[DeviceA-vlan200] port gigabitethernet 1/0/2
[DeviceA-vlan200] quit
# 为了使Device A上VLAN 100和VLAN 200的报文能发送给Device B,将GigabitEthernet1/0/3的链路类型配置为Trunk,并允许VLAN 100和VLAN 200的报文通过。
[DeviceA] interface gigabitethernet 1/0/3
[DeviceA-GigabitEthernet1/0/3] port link-type trunk
[DeviceA-GigabitEthernet1/0/3] port trunk permit vlan 100 200
(2) 配置Device B
和A配置一样
(3) 验证
192.168.1.100ping192.168.1.101能ping通
192.168.1.100ping192.168.2.101不能ping通
其他验证同上