第一步:使用vlan配置L1交换机
//进入系统视图
<Huawei>system-view
//配置Vlan域
[L1]vlan 2
[L1-vlan2]quit
[L1]interface e0/0/2
[L1-Ethernet0/0/2]port link-type access
[L1-Ethernet0/0/2]port default vlan 2
[L1-Ethernet0/0/2]quit[L1]vlan 3
[L1-vlan3]quit
[L1]interface e0/0/3
[L1-Ethernet0/0/3]port link-type access
[L1-Ethernet0/0/3]port default vlan 3[L1-Ethernet0/0/3]quit
[L1]vlan 4
[L1-vlan4]quit
[L1]interface e0/0/4
[L1-Ethernet0/0/4]port link-type access
[L1-Ethernet0/0/4]port default vlan 4
[L1-Ethernet0/0/4]quit[L1]vlan 5
[L1-vlan5]quit[L1]interface e0/0/5
[L1-Ethernet0/0/5]port link-type access
[L1-Ethernet0/0/5]port default vlan 5
[L1-Ethernet0/0/5]quit[L1]display vlan
//进入e0/0/1接口
[L1]interface e0/0/1
//
[L1-Ethernet0/0/1]port link-type trunk//允许所有变量通过
[L1-Ethernet0/0/1]port trunk allow-pass vlan all
第二步:配置R1路由器
//开启DHCP服务
[dhcp]dhcp enable
//配置虚拟子接口 1
[dhcp]interface g0/0/0.1
[dhcp-GigabitEthernet0/0/0.1]dot1q termination vid 2
[dhcp-GigabitEthernet0/0/0.1]quit//配置虚拟子接口 2
[dhcp]interface g0/0/0.2
[dhcp-GigabitEthernet0/0/0.2]dot1q termination vid 3
[dhcp-GigabitEthernet0/0/0.2]quit