一、实验拓扑¶

二、实验需求¶
PC2通过全局地址池动态获取地址,PC3通过接口地址池获取地址
三、实验配置¶
1、设备命名
[Huawei]sysname DHCP Server
[Huawei]sysname PC2
[Huawei]sysname PC3
2、IP地址配置
[DHCP Server]interface GigabitEthernet 0/0/0
[DHCP Server-GigabitEthernet0/0/0]ip address 10.1.1.1 24
[DHCP Server]interface GigabitEthernet 0/0/2
[DHCP Server-GigabitEthernet0/0/2]ip address 20.1.1.1 24
3、开启DHCP功能
[DHCP Server]dhcp enable
[PC2]dhcp enable
[PC3]dhcp enable
4、配置地址池
4.1 配置全局地址池
[DHCP Server]ip pool 1
[DHCP Server-ip-pool-1]network 10.1.1.0 mask 24
[DHCP Server-ip-pool-1]dns-list 10.1.1.1
[DHCP Server-ip-pool-1]gateway-list 10.1.1.1
[DHCP Server-ip-pool-1]lease day 2
[DHCP Server-ip-pool-1]static-bind ip-address 10.1.1.2 mac-address 00e0-fc68-29dd
[DHCP Server]interface GigabitEthernet 0/0/0
[DHCP Server-GigabitEthernet0/0/0]dhcp select global
4.2 配置接口地址池
[DHCP Server]interface GigabitEthernet 0/0/2
[DHCP Server-GigabitEthernet0/0/2]dhcp select interface
[DHCP Server-GigabitEthernet0/0/2]dhcp server dns-list 20.1.1.1
5、配置DHCP客户端
[PC2-GigabitEthernet0/0/0]ip address dhcp-alloc
[PC3-GigabitEthernet0/0/2]ip address dhcp-alloc
6、查看配置结果
6.1 查看PC2、PC3的地址获取情况
[PC2]display ip interface brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 10.1.1.2/24 up up
[PC3]display ip interface brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/2 20.1.1.254/24 up up
6.2 查看DHCP Server地址分配情况
[DHCP Server]display ip pool name 1
Pool-name : 1
Pool-No : 1
Lease : 2 Days 0 Hours 0 Minutes
Domain-name : -
DNS-server0 : 10.1.1.1
NBNS-server0 : -
Netbios-type : -
Position : Local Status : Unlocked
Gateway-0 : 10.1.1.1
Mask : 255.255.255.0
VPN instance : --
Start End Total Used Idle(Expired) Conflict Disable
10.1.1.1 10.1.1.254 253 1 252(0) 0 0
6.3 查看PC2、PC3DNS地址获取情况
[PC2]display dns server
Type:
D:Dynamic S:Static
No. Type IP Address
1 D 1.1.1.10
[PC3]display dns se
[PC3]display dns server
Type:
D:Dynamic S:Static
No. Type IP Address
1 D 1.1.1.20
6.4 查看是否获取默认路由
[PC2]display ip routing-table
Route Flags: R - relay, D - download to fib
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Unr 60 0 D 10.1.1.1 GigabitEthernet0/0/0
[PC3]display ip routing-table
Route Flags: R - relay, D - download to fib
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Unr 60 0 D 20.1.1.1 GigabitEthernet0/0/2