Configuration Condition
None
Create a DHCP Address Pool
A DHCP server needs to select and allocate IP addresses and other parameters from a DHCP address pool. Therefore, a DHCP address pool must be created for the DHCP server.
Table 3-2 Creating a DHCP Address Pool
Step
|
Command
|
Description
|
Enter the global configuration mode.
|
configure terminal
|
-
|
Create a DHCP address pool and enter the DHCP configuration mode.
|
ip dhcp pool pool-name [ vrf vrf-name ]
|
Mandatory.
By default, no DHCP address pool has been created by the system.
|
![note](/storage/images/Document/Maipu/note-icon.jpg)
-
Address pools fall into two types: Network and Range. The two types of address pools can be configured respectively through the network and range commands.
Configure an IP Address Range
On a DHCP server, each DHCP address pool must be configured with an IP address range to allocate IP addresses to DHCP clients.
Table 3-3 Configuring an IP Address Range
Step
|
Command
|
Description
|
Enter the global configuration mode.
|
configure terminal
|
-
|
Enter the DHCP configuration mode.
|
ip dhcp pool pool-name [ vrf vrf-name ]
|
-
|
Configure an IP address range for an address pool of the Network type.
|
network ip-address [network-mask | mask-len]
|
Optional.
By default, an IP address range is not configured for an address pool.
|
Configure an IP address range for an address pool of the Range type.
|
range low-ip-addres high-ip-address
[network-mask | mask-len ]
|
Optional.
By default, an IP address range is not configured for an address pool.
|
![note](/storage/images/Document/Maipu/note-icon.jpg)
-
After an IP address range is configured for an address pool by using the network or range command, if you run the network or range command again, the new IP address range configuration overwrites the existing configuration.
- Modify the network type of address pool to the range type (or change the range type of address pool to the network type). If the new address range intersects with the old address range, the command line will prompt the user whether to perform the operation. If yes, delete all address configurations (static binding, vendor sub pool) in the and dynamic lease; if the actual effective range of the new address contains the actual effective range of the old address, the address pool will reserve all the address configurations in the address pool (static binding, vendor sub-pool), but will delete the configured ip range and dynamic lease of the vendor sub-pool.
Configure a DNS Server Address
On a DHCP server, you can configure the DNS server address respectively for each DHCP address pool. When a DHCP server allocates an IP address for a DHCP client, it also sends the DNS server address to the client.
When the DHCP client starts dynamic domain name resolution, it queries the DNS server.
Table 3-4 Configuring a DNS Server Address
Step
|
Command
|
Description
|
Enter the global configuration mode.
|
configure terminal
|
-
|
Enter the DHCP configuration mode.
|
ip dhcp pool pool-name [ vrf vrf-name ]
|
-
|
Configure a DNS server address.
|
dns-server { ip-address&<1-8> | autoconfig }
|
Mandatory.
By default, the DNS server address is not configured.
|
Configure the Default Route
On a DHCP server, you can specify the address of a gateway corresponding to clients for each DHCP address pool. When the server allocates an IP address to a client, it also sends the gateway address to the client.
When a DHCP client accesses a server or host that is not in the network segment, its data is forwarded through the gateway.
Table 3-5 Configuring the Default Route
Step
|
Command
|
Description
|
Enter the global configuration mode.
|
configure terminal
|
-
|
Enter the DHCP configuration mode.
|
ip dhcp pool pool-name [ vrf vrf-name ]
|
-
|
Configure the default route.
|
default-router ip-address&<1-8>
|
Mandatory.
By default, no default route is configured.
|
Configure the Lease of an IP Address
The IP address that the DHCP server allocates to the DHCP client has a lease. After the lease expires, the server will take back the allocated IP address. If the DHCP client wants to continue to use the IP address, it must have the IP address lease updated.
On the DHCP server, you can configure an IP address lease for each DHCP address pool.
Table 3-6 Configuring the Lease of an IP Address
Step
|
Command
|
Description
|
Enter the global configuration mode.
|
configure terminal
|
-
|
Enter the DHCP configuration mode.
|
ip dhcp pool pool-name [ vrf vrf-name ]
|
-
|
Configure an IP address lease.
|
lease days [ hours [ minutes ] ]
|
Mandatory.
By default, the value of days is 1, the value of hours is 6, and the value of minutes is 0.
|
Bind an IP Address and a MAC Address
After IP addresses and MAC addresses are bound, when the client with a specified MAC address sends an IP address request to the DHCP server, the DHCP server allocates the IP address that is bound to the IP address to the client. In this way, as long as the MAC address of the client is not changed (by replacing the network adapter), the client will obtain the same IP address from the server each time.
Table 3-7 Binding IP Addresses and MAC Addresses
Step
|
Command
|
Description
|
Enter the global configuration mode.
|
configure terminal
|
-
|
Enter the DHCP configuration mode.
|
ip dhcp pool pool-name [ vrf vrf-name ]
|
-
|
Bind an IP address and a MAC address.
|
bind { ip-address mac-address | automatic}
|
Mandatory.
By default, no IP address and MAC address binding is configured.
|
Configure User-Defined Options
For some options, RFC does not give specifications; therefore, you can define these options according to the actual requirement.
Table 3-8 Configuring User-Defined Options
Step |
Command |
Description |
Enter the global configuration mode.
|
configure terminal
|
-
|
Enter the DHCP configuration mode.
|
ip dhcp pool pool-name [ vrf vrf-name ]
|
-
|
Configuring user-defined options.
|
option option-code { ascii ascii-string | hex hex-string | ip ip-address&<1-8> }
|
Mandatory.
By default, user-defined options are not configured.
|
Configure the Address Pool of the DHCP Manufacturer
When the client requests the IP address, it may carry the option 60 option, indicating the manufacturer ID. The customer can specify different IP address sections for different manufacturers.
Table 3-9 Configure the DHCP manufacturer address pool
Step
|
Command
|
Description
|
Enter the global configuration mode.
|
configure terminal
|
-
|
Enter the DHCP configuration mode.
|
ip dhcp pool pool-name [ vrf vrf-name ]
|
-
|
Configure the manufacturer address pool and enter the DHCP manufacturer address pool configuration mode
|
vendor-class-identifier vendor_id
|
By default, do not configure the manufacturer address pool.
|
Configure the manufacturer address pool range
|
ip range low-ip-address high-ip-address
|
By default, do not configure the range.
|
Configure the content of the option 43 returned for the specified manufacturer
|
option 43 { ascii ascii-string | hex hex-string | ip ip-address&<1-8> }
|
By default, do not configure.
|