目的:PC1 PC2 PC3三个网段通过 DHCP获取自己对应网段的IP地址
LSW1配置
bash
[Huawei]vlan batch 10 20 30
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[Huawei]dhcp enable
[Huawei]ip pool dhcp10
[Huawei-ip-pool-dhcp10]network 192.168.10.0 mask 24
[Huawei-ip-pool-dhcp10]gateway-list 192.168.10.1
[Huawei-ip-pool-dhcp10]dns-list 8.8.8.8
[Huawei-ip-pool-dhcp10]q
[Huawei]ip pool dhcp20
[Huawei-ip-pool-dhcp20]network 192.168.20.0 mask 24
[Huawei-ip-pool-dhcp20]gateway-list 192.168.20.1
[Huawei-ip-pool-dhcp20]dns-list 8.8.8.8
[Huawei-ip-pool-dhcp20]q
[Huawei]ip pool dhcp30
[Huawei-ip-pool-dhcp30]network 192.168.30.0 mask 24
[Huawei-ip-pool-dhcp30]gateway-list 192.168.30.1
[Huawei-ip-pool-dhcp30]dns-list 8.8.8.8
[Huawei-ip-pool-dhcp30]q
[Huawei]interface Vlanif 10
[Huawei-Vlanif10]ip address 192.168.10.1 24
[Huawei-Vlanif10]dhcp select global
[Huawei]int Vlanif 20
[Huawei-Vlanif20]ip address 192.168.20.1 24
[Huawei-Vlanif20]dhcp select global
[Huawei]int Vlanif 30
[Huawei-Vlanif30]ip address 192.168.30.1 24
[Huawei-Vlanif30]dhcp select globa
LSW2配置
bash
[Huawei]vlan batch 10 20 30
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[Huawei]int e0/0/1
[Huawei-Ethernet0/0/1]port link-type access
[Huawei-Ethernet0/0/1]port default vlan 10
[Huawei-Ethernet0/0/1]int e0/0/2
[Huawei-Ethernet0/0/2]port link-type access
[Huawei-Ethernet0/0/2]port default vlan 20
[Huawei-Ethernet0/0/2]int e0/0/3
[Huawei-Ethernet0/0/3]port link-type access
[Huawei-Ethernet0/0/3]port default vlan 30
PC1使用DHCP获取IP地址
PC2使用DHCP获取IP地址
PC3使用DHCP获取IP地址