【任务说明】
在LSW2上做基于MAC地址的VLAN划分,将PC1、PC2划分到VLAN10中,并通过基于端口的VLAN划分方式将PC4划分到VLAN20中,在LSW2上为VLAN10、VLAN20设置虚拟接口地址,分别为192.168.1.254/24、192.168.2.254/24。LSW1上不作配置。

| 机器 | IP地址 | 网关 | MAC地址 |
| PC-PC1 | 192.168.1.1/24 | 192.168.1.254 | 54-89-98-11-11-11 |
| PC-PC2 | 192.168.1.2/24 | 192.168.1.254 | 54-89-98-22-22-22 |
| PC-PC3 | 192.168.1.3/24 | 192.168.1.254 | 54-89-98-33-33-33 |
| PC-PC4 | 192.168.2.4/24 | 192.168.2.254 | 54-89-98-44-44-44 |
【命令脚本】
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for amoment...done.
[Huawei]
[Huawei]int vlanif 10
[Huawei-Vlanif10]ip address 192.168.1.254 24
[Huawei-Vlanif10]quit
[Huawei]int vlanif 20
[Huawei-Vlanif20]ip address 192.168.2.254 24
[Huawei-Vlanif20]quit
[Huawei]vlan 10
[Huawei-vlan10]mac-vlan mac-address 5489-9811-1111
[Huawei-vlan10]mac-vlan mac-address 5489-9822-2222
[Huawei-vlan10]quit
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type hybrid
[Huawei-GigabitEthernet0/0/1]port hybrid untagged vlan 10
[Huawei-GigabitEthernet0/0/1]mac-vlan enable
Info: This operation may take a few seconds. Please wait for amoment...done.
[Huawei-GigabitEthernet0/0/1]quit
[Huawei]int g0/0/4
[Huawei-GigabitEthernet0/0/4]port link-type access
[Huawei-GigabitEthernet0/0/4]port default vlan 20
[Huawei-GigabitEthernet0/0/4]quit
[Huawei]

