Configure a DHCP Server to Statically Allocate IP Addresses
Network Requirements
- Device2 acts as a DHCP server to allocate IP addresses, gateway IP addresses, and DNS server IP addresses in a static manner.
- The DHCP server allocates an IP address to PC in MAC binding mode.
Network Topology
![Configuring a DHCP Server to Statically Allocate IP Addresses](/storage/images/Document/Maipu/ip-protocol/config-dhcp-server.jpg)
Figure 3-1 Configuring a DHCP Server to Statically Allocate IP Addresses
Configuration Steps
Step 1: Configure the IP address of the Device2 interface and works in the DHCP server mode.
Device2#configure terminal
Device2(config)#interface vlan2
Device2(config-if-vlan2)#ip address 1.0.0.3 255.255.255.0
Device2(config-if-vlan2)#ip dhcp server
Device2(config-if-vlan2)#exit
|
Step 2: Configure the static binding address pool and parameters.
#Configure the address pool mac-binding, and adopt the static mac binding mode to distribute IP address for the PC.
Device2(config)#ip dhcp pool mac-binding
Device2(dhcp-config)#range 1.0.0.4 1.0.0.254 255.255.255.0
Device2(dhcp-config)#bind 1.0.0.11 00e0.00c1.013d
Device2(dhcp-config)#default-router 1.0.0.1
Device2(dhcp-config)#dns-server 1.0.0.2
Device2(dhcp-config)#exit
|
Step 3: Check the result.
#On Device2, query the associated address pool of the interface via the show ip dhcp server interface vlan2 command.
Device2(config)#exit
Device2#show ip dhcp server interface vlan2
DHCP server status information:
DHCP server is enabled on interface: vlan2
Vrf : global
DHCP server pool information:
Available directly-connected pool:
Interface IP Pool name Pool Range Pool utilization
-------------- --------------- ------------------- -----------------
1.0.0.3/24 mac-binding 1.0.0.4 – 1.0.0.254 0.00%
#On Device2, query the binding IP address distributed for the PC via the show ip dhcp pool mac-binding binding command.
Device2#show ip dhcp pool mac-binding binding
IP Address MAC Address Vendor Id Type Time Left(s)
------------ ----------------- ------------ ------ ------------
1.0.0.11 00e0.00c1.013d Global Binding NA
#On Device2, query the address distributed for the PC via the show ip dhcp pool mac-binding lease command.
Device#show ip dhcp pool danymic-pool2 lease
IP Address MAC Address Vendor Id Type Time Left(s)
-------------- --------------- ---------- ------- -------------
1.0.0.11 00e0.00c1.013d Global Lease 107980
On the PC, check whether the got IP address, gateway IP address, and DNS server address are correct.