27、全局配置DHCP,地址池配置(global模式)

发布时间 2023-08-18 11:02:33作者: 五杀摇滚小拉夫

1、拓扑如下:

2、ensp模拟配置

The device is running!
############
<Huawei>
Aug 18 2023 10:27:44-08:00 Huawei %%01PHY/1/PHY(l)[0]:    GigabitEthernet0/0/0: 
change status to up
<Huawei>sys
[Huawei]sysname DHCP-Server 
[DHCP-Server]interface GigabitEthernet 0/0/0
[DHCP-Server-GigabitEthernet0/0/0]ip address 10.1.20.1 24
[DHCP-Server-GigabitEthernet0/0/0]
Aug 18 2023 10:29:02-08:00 DHCP-Server %%01IFNET/4/LINK_STATE(l)[1]:The line pro
tocol IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[DHCP-Server-GigabitEthernet0/0/0]quit
[DHCP-Server]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[DHCP-Server]ip pool  liu
Info:It's successful to create an IP address pool.
[DHCP-Server-ip-pool-liu]network 10.1.20.0 mask 255.255.255.0  
[DHCP-Server-ip-pool-liu]gateway-list 10.1.20.1
[DHCP-Server-ip-pool-liu]dns-list 192.168.9.99
[DHCP-Server-ip-pool-liu]dns-list 192.168.9.98
[DHCP-Server-ip-pool-liu]quit
[DHCP-Server]interface GigabitEthernet 0/0/0 
[DHCP-Server-GigabitEthernet0/0/0]dhcp select global 
[DHCP-Server-GigabitEthernet0/0/0]quit
[DHCP-Server]quit<DHCP-Server>save
The current configuration will be written to the device.
Are you sure to continue?[Y/N]Y
Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:
Aug 18 2023 10:32:07-08:00 DHCP-Server %%01CFM/4/SAVE(l)[2]:The user chose Y whe
n deciding whether to save the configuration to the device.
Now saving the current configuration to the slot 17.
Save the configuration successfully.
<DHCP-Server>
<DHCP-Server>
<DHCP-Server>
<DHCP-Server>

查看下地址池信息 liu  display ip pool

ip地址释放  ipconfig /release

 ip地址重新获取  ipconfig /renew

 固定IP配置如下:

适用场景,特殊场合需要固定ip绑定MAC地址 比如事业单位 。这里举例固定PC2的ip  10.1.20.88

需先将原先自动获取的ip地址释放掉,给定一个新的ip10.1.20.88 与原MAC地址绑定

[DHCP-Server-ip-pool-liu]static-bind ip-address 10.1.20.88 mac-address 5489-9886-755C

从新获取下ip 发现已经绑定了指定的ip地址,然后再查看下地址池的分配。