1.通过搭建的拓扑图来实现PC的IP地址自动获取 2.配置思路: ⑴首先将PC机调到DHCP自动获取状态; ⑵创建相应的VLAN,将VLAN放入对应的端口; <Huawei>system-view [SW2]vlan batch 10 20 30 [SW2]interface Eth0/0/2 [SW2-Ethernet0/0/2]port link-type access [SW2-Ethernet0/0/2]port default vlan 10 [SW2]interface Eth0/0/3 [SW2-Ethernet0/0/3]port link-type access [SW2-Ethernet0/0/3]port default vlan 20 [SW2]interface Eth0/0/1 [SW2-Ethernet0/0/1]port link-type trunk [SW2-Ethernet0/0/1]port trunk allow-pass vlan all <Huawei>system-view [SW3]vlan batch 10 20 30 [SW3]interface Eth0/0/2 [SW3-Ethernet0/0/2]port link-type access [SW3-Ethernet0/0/2]port default vlan 30 [SW3]interface Eth0/0/1 [SW3-Ethernet0/0/1]port link-type trunk [SW3-Ethernet0/0/1]port trunk allow-pass vlan all

⑶在三层交换机上创建DHCP地址池,并开启; <Huawei>system-view [SW1]vlan batch 10 20 30 [SW1]interface GigabitEthernet 0/0/1 [SW1-GigabitEthernet0/0/1]port link-type trunk [SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan all [SW1-GigabitEthernet0/0/1]int g0/0/2 [SW1-GigabitEthernet0/0/2]port link-type trunk [SW1-GigabitEthernet0/0/2]port trunk allow-pass vlan all [SW1]interface Vlanif 10 [SW1-Vlanif10]ip address 192.168.1.254 24 [SW1-Vlanif10]int vl20 [SW1-Vlanif20]ip address 192.168.2.254 24 [SW1-Vlanif20]int vl30 [SW1-Vlanif30]ip address 192.168.3.254 24 [SW1]dhcp enable [SW1]ip pool vlan10 [SW1-ip-pool-vlan10]network 192.168.1.0 mask 24 [SW1-ip-pool-vlan10]gateway-list 192.168.1.254 [SW1-ip-pool-vlan10]dns-list 8.8.8.8 [SW1]ip pool vlan20 [SW1-ip-pool-vlan20]network 192.168.2.0 mask 24 [SW1-ip-pool-vlan20]gateway-list 192.168.2.254 [SW1-ip-pool-vlan20]dns-list 8.8.8.8 [SW1]ip pool vlan30 [SW1-ip-pool-vlan30]network 192.168.3.0 mask 24 [SW1-ip-pool-vlan30]gateway-list 192.168.3.254 [SW1-ip-pool-vlan30]dns-list 8.8.8.8 [SW1]interface Vlanif 10 [SW1-Vlanif10]dhcp select global [SW1-Vlanif10]int vl20 [SW1-Vlanif20]dhcp select global [SW1-Vlanif20]int vl30 [SW1-Vlanif30]dhcp select global

⑷ 验证;注意:华为获取的IP地址是从254往下开始分配的,思科是从1往上开始分配的; PC1: PC2: PC3: