基于mac地址划分VLAN
网络拓扑图:
SW2配置命令:将服务器划分至相应的vlan
<huawei>system-view #进入系统视图 [huawei]sysname SW2 #命名为SW2 [SW2]vlan batch 10 20 #创建vlan 10 20 [SW2]interface GigabitEthernet 0/0/2 #进入G0/0/2 [SW2-GigabitEthernet0/0/2]port link-type access #配置接口类型 [SW2-GigabitEthernet0/0/2]port default vlan 10 #划分至vlan 10 [SW2-GigabitEthernet0/0/2]inter gig0/0/3 #进入G0/0/3 [SW2-GigabitEthernet0/0/3]port link-type access #配置接口类型 [SW2-GigabitEthernet0/0/3]port default vlan 20 #划分至vlan 20 [SW2-GigabitEthernet0/0/3]inter gig0/0/1 #进入G0/0/1 [SW2-GigabitEthernet0/0/1]port link-type trunk #配置trunk [SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20 #允许vlan 10 20数据通过
SW1配置:
<Huawei>system-view #进入系统视图 [Huawei]vlan batch 10 20 #创建vlan 10 20 [Huawei]interface GigabitEthernet 0/0/1 #进入G0/0/1 [Huawei-GigabitEthernet0/0/1]port link-type trunk #配置trunk [Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20 #允许vlan 10 20数据包通过 [Huawei-GigabitEthernet0/0/1]quit #退出 [Huawei]vlan 10 #进入vlan 10 [Huawei-vlan10]mac-vlan mac-address 5489-98EB-7EE2 #将这个mac地址划分vlan 10 [Huawei-vlan10]mac-vlan mac-address 5489-989A-6EEC #将这个mac地址划分vlan 10 [Huawei-vlan10]vlan 20 #进入vlan 20 [Huawei-vlan20]mac-vlan mac-address 5489-9890-105A #将这个mac地址划分vlan 20 [Huawei]interface GigabitEthernet 0/0/2 #进入G0/0/2 [Huawei-GigabitEthernet0/0/2]port hybrid untagged vlan 10 20 #配置混合接口 [Huawei-GigabitEthernet0/0/2]mac-vlan enable #开启基于mac地址划分vlan
查看mac地址:dis mac-vlan mac-address all