H3C网管交换机基于MAC的VLAN典型配置举例

一、组网需求
• 如下图所示,Device A 和 Device C 的 GigabitEthernet1/0/1 端口分别连接到两个会议室,Laptop1 和 Laptop2 是会议用笔记本电脑,会在两个会议室间移动使用。
• Laptop1 和 Laptop2 分别属于两个部门,两个部门间使用 VLAN 100 和 VLAN 200 进行隔离。现要求这两台笔记本电脑无论在哪个会议室使用,均只能访问自己部门的服务器,即 Server1和 Server2。

二、 组网图
基于 MAC 的 VLAN 组网图

三、配置步骤
(1) Device A 的配置
# 创建 VLAN 100 和 VLAN 200。
<DeviceA> system-view
[DeviceA] vlan 100
[DeviceA-vlan100] quit
[DeviceA] vlan 200
[DeviceA-vlan200] quit

# 将 Laptop1 的 MAC 地址与 VLAN 100 关联,Laptop2 的 MAC 地址与 VLAN 200 关联。
[DeviceA] mac-vlan mac-address 000d-88f8-4e71 vlan 100
[DeviceA] mac-vlan mac-address 0014-222c-aa69 vlan 200

# 配置终端的接入端口: Laptop1 和 Laptop2 均可能从 GigabitEthernet1/0/1 接入,将GigabitEthernet1/0/1 的端口类型配置为 Hybrid,并使其在发送 VLAN 100 和 VLAN 200 的报文时去掉 VLAN Tag;开启 GigabitEthernet1/0/1 端口的 MAC VLAN 功能。
[DeviceA] interface gigabitethernet 1/0/1
[DeviceA-GigabitEthernet1/0/1] port link-type hybrid
[DeviceA-GigabitEthernet1/0/1] port hybrid vlan 100 200 untagged
[DeviceA-GigabitEthernet1/0/1] mac-vlan enable
[DeviceA-GigabitEthernet1/0/1] quit

# 为了终端能够访问 Server1 和 Server2,需要将上行端口 GigabitEthernet1/0/2 的端口类型配置为Trunk,并允许 VLAN 100 和 VLAN 200 的报文通过。
[DeviceA] interface gigabitethernet 1/0/2
[DeviceA-GigabitEthernet1/0/2] port link-type trunk
[DeviceA-GigabitEthernet1/0/2] port trunk permit vlan 100 200
[DeviceA-GigabitEthernet1/0/2] quit

(2) Device B 的配置
# 创建 VLAN 100 和 VLAN 200,并将 GigabitEthernet1/0/3 加入 VLAN 100,GigabitEthernet1/0/4加入 VLAN 200。
<DeviceB> system-view
[DeviceB] vlan 100
[DeviceB-vlan100] port gigabitethernet 1/0/3
[DeviceB-vlan100] quit
[DeviceB] vlan 200
[DeviceB-vlan200] port gigabitethernet 1/0/4
[DeviceB-vlan200] quit

# 配置 GigabitEthernet1/0/1 和 GigabitEthernet1/0/2 端口为 Trunk 端口,均允许 VLAN 100 和 VLAN200 的报文通过。
[DeviceB] interface gigabitethernet 1/0/1
[DeviceB-GigabitEthernet1/0/1] port link-type trunk
[DeviceB-GigabitEthernet1/0/1] port trunk permit vlan 100 200
[DeviceB-GigabitEthernet1/0/1] quit
[DeviceB] interface gigabitethernet 1/0/2
[DeviceB-GigabitEthernet1/0/2] port link-type trunk
[DeviceB-GigabitEthernet1/0/2] port trunk permit vlan 100 200
[DeviceB-GigabitEthernet1/0/2] quit

(3) Device C 的配置
Device C 的配置与 Device A 完全一致,这里不再赘述。

四、显示与验证
(1) Laptop1 只能访问 Server1,不能访问 Server2;Laptop2 只能访问 Server2,不能访问Server1。
(2) 在 Device A 和 Device C 上可以查看到 Laptop1 和 VLAN 100、Laptop2 和 VLAN 200 的静态MAC VLAN 地址表项已经生成。以 Device A 为例:
[DeviceA] display mac-vlan all
 显示与验证

ICP备案号:晋ICP备18007549号-1
站长微信:15534641008