任务

组网需求: 如下图所示,办公区的主机属于不同的网段 192.168.5.0/24 和192.168.50.0/24,Device C 在收到 来自办公区主机的报文时,根据报文的源IP 地址,使来自不同网段主机的报文分别在指定的VLAN 中传输。试验拓扑图如下: 使用H3C模拟器配置VLAN相关项目 2.配置步骤: (1) 配置 Device C 配置子网192.168.5.0/24 与VLAN 100 关联。 <DeviceC> system-view [DeviceC] vlan 100 [DeviceC-vlan100] ip-subnet-vlan ip 192.168.5.0 255.255.255.0 [DeviceC-vlan100] quit

配置子网192.168.50.0/24 与VLAN 200 关联。 [DeviceC] vlan 200 [DeviceC-vlan200] ip-subnet-vlan ip 192.168.50.0 255.255.255.0 [DeviceC-vlan200] quit

配置端口GigabitEthernet1/0/11 允许通过VLAN 100 的报文。 [DeviceC] interface ten-gigabitethernet 1/0/11 [DeviceC-Ten-GigabitEthernet1/0/11] port link-type hybrid [DeviceC-Ten-GigabitEthernet1/0/11] port hybrid vlan 100 tagged [DeviceC-Ten-GigabitEthernet1/0/11] quit

配置端口GigabitEthernet1/0/12 允许通过VLAN 200 的报文。 [DeviceC] interface ten-gigabitethernet 1/0/12 [DeviceC-Ten-GigabitEthernet1/0/12] port link-type hybrid [DeviceC-Ten-GigabitEthernet1/0/12] port hybrid vlan 200 tagged [DeviceC-Ten-GigabitEthernet1/0/12] quit

配置端口GigabitEthernet1/0/1 和基于IP 子网的VLAN 100、VLAN 200 关联。 [DeviceC] interface ten-gigabitethernet 1/0/1 [DeviceC-Ten-GigabitEthernet1/0/1] port link-type hybrid [DeviceC-Ten-GigabitEthernet1/0/1] port hybrid vlan 100 200 untagged [DeviceC-Ten-GigabitEthernet1/0/1] port hybrid ip-subnet-vlan vlan 100 [DeviceC-Ten-GigabitEthernet1/0/1] port hybrid ip-subnet-vlan vlan 200 [DeviceC-Ten-GigabitEthernet1/0/1] quit

(2) 配置Device A 和Device B 配置Device A 和Device B 允许对应VLAN 通过。 3.验证配置如图所示: