Configuring a DHCP Server
- Enabling DHCP
- Enabling the DHCP Server Function
- (Optional) Configuring DHCP Data Restoration
- (Optional) Configuring IP Address Conflict Detection
- (Optional) Configuring a DHCP Server to Dynamically Allocate IP Addresses to BOOTP Clients
- (Optional) Forcing a DHCP Server to Reply with a DHCP NAK Message
- (Optional) Configuring the DHCP Rate Limiting Function
- (Optional) Configuring Option Parameters to Be Filled in the sname and file Fields
- Configuring an Address Pool
- Creating an Address Pool
- (Optional) Configuring the Range of IP Addresses in an Address Pool
- (Optional) Excluding IP Addresses from an Address Pool
- (Optional) Configuring Fixed IP Addresses in an Address Pool
- (Optional) Configuring an Address Lease Time
- (Optional) Configuring Automatic Reclaim of Conflicting IP Addresses in an Address Pool
- (Optional) Configuring the Alarm Function for IP Address Exhaustion
- (Optional) Configuring the Logging Function for IP Address Allocation
- (Optional) Configuring a Gateway Address for Clients
- (Optional) Configuring a Configuration File for a DHCP Client
- (Optional) Configuring User-defined Options
- (Optional) Configuring DNS Configurations Allocated by a DHCP Server
- (Optional) Configuring NetBIOS Configurations Allocated by a DHCP Server
- (Optional) Configuring a SIP Server Address to Be Allocated by the DHCP Server
- (Optional) Associating an IP Address Pool with NQA
- Verifying the DHCP Server Configuration
Enabling DHCP
Context
Before enabling the DHCP server function, enable DHCP in the system view.
The dhcp enable command is the prerequisite for configuring DHCP-related functions, including DHCP relay, DHCP snooping, and DHCP server. These functions take effect only after the dhcp enable command is run. After the undo dhcp enable command is run, all DHCP-related configurations of the device are deleted. After DHCP is enabled again using the dhcp enable command, all DHCP-related configurations of the device are restored to the default configurations.
After DHCP is enabled, if STP is also enabled, address allocation may slow down. By default, STP is enabled. To disable STP, run the undo stp enable command.
Enabling the DHCP Server Function
Context
Before a device can function as a DHCP server, you must enable DHCP. You can then enable the DHCP server function to operate based on an interface address pool or based on a global address pool.
The DHCP server function based on an interface address pool and a global address pool can be configured on MEth management interfaces (using the dhcp select interface and dhcp select global commands, respectively) to enable access terminals to obtain IP addresses. The interfaces do not support other DHCP server functions.
(Optional) Configuring DHCP Data Restoration
Context
Automatically saving IP address allocation information allows the DHCP server to re-allocate the same configurations (such as IP address and lease time) to clients in the event that the server unexpectedly restarts.
After this function is enabled, the DHCP server stores lease information in lease.txt and conflicting IP addresses in conflict.txt (both data files are saved to the DHCP folder). New data files overwrite earlier data files.
The time displayed in the lease.txt and conflict.txt files is the UTC time rather than the system time, and you do not need to pay attention to time zone information.
To view information about the DHCP database, run the display dhcp server database command.
Procedure
- Enter the system view.
system-view
- Enable the DHCP server to automatically save IP address allocation information.
dhcp server database enable
By default, the DHCP server does not automatically save IP address allocation information.
- Specify the interval at which the DHCP server saves IP address allocation information.
dhcp server database write-delay interval
By default, IP address allocation information is saved every 3600 seconds in data files. The new data files overwrite the earlier data files.
- Enable the DHCP server to recover IP address allocation information from the data files upon a restart.
dhcp server database recover
By default, the DHCP server is disabled from recovering IP address allocation information from the data files upon a restart.
(Optional) Configuring IP Address Conflict Detection
Context
IP address conflict detection uses ICMP to determine whether an IP address to be allocated conflicts with other IP addresses that are already allocated to clients. After this function is configured, a DHCP server sends an ICMP Echo Request message in which the source address is the IP address of the DHCP server and the destination address is the pre-allocated IP address for IP address conflict detection, before sending a DHCP Offer message to a client.
- If the DHCP server does not receive any ICMP Echo Reply message within the detection period (Number of detections x Maximum wait time for each conflict detection), this IP address is not used by any client. The DHCP server allocates the IP address to the client by sending a DHCP Offer message.
- If the DHCP server receives an ICMP Echo Reply message within the detection period (Number of detections x Maximum wait time for each conflict detection), this IP address is being used by a client. The DHCP server lists this IP address as a conflicting IP address and waits for the next DHCP Discover message to select another available IP address.
If the detection time is too long, clients may fail to obtain IP addresses. You are advised to set the detection time to less than 8 seconds.
Procedure
- Enter the system view.
system-view
- Specify the number of IP address conflict detections before IP address allocation.
dhcp server ping packet number
By default, the number of IP address conflict detections before IP address allocation is 2.
- Specify the maximum wait time for each conflict detection.
dhcp server ping timeout milliseconds
By default, the maximum wait time for each conflict detection is 500 milliseconds.
(Optional) Configuring a DHCP Server to Dynamically Allocate IP Addresses to BOOTP Clients
Context
If you have BOOTP clients on your network and you want them to dynamically obtain IP addresses through DHCP, configure the DHCP server to service these clients.
Procedure
- Enter the system view.
system-view
- Enable the DHCP server to respond to BOOTP requests.
dhcp server bootp
By default, a DHCP server responds to a BOOTP request.
- Enable the DHCP server to dynamically allocate IP addresses
to BOOTP clients.
dhcp server bootp automatic
By default, a DHCP server does not dynamically allocate IP addresses to BOOTP clients.
(Optional) Forcing a DHCP Server to Reply with a DHCP NAK Message
Context
When a DHCP client goes online in two steps, the IP address requested by the DHCP client is in the IP address pool, but no lease record of the DHCP client is found in the address pool. For example, after obtaining an IP address from another DHCP server, a wireless user roams to the current DHCP server and the original IP address is in the address pool of the current DHCP server. Alternatively, the address pool is reset and the original user needs to go online again. In this case, when receiving a DHCP Request message from the DHCP client, the DHCP server keeps silent and does not reply the DHCP client with a DHCP NAK message. The DHCP client can apply for an IP address to go online again in four steps only after the two steps for the client to go online time out. As a result, the DHCP client is slow in obtaining an IP address. To force the DHCP server to reply with a DHCP NAK message, you can run the dhcp server force response command, so that the DHCP client can quickly enter the four-step process for going online and apply for an IP address again.
(Optional) Configuring the DHCP Rate Limiting Function
Context
To prevent an attacker from sending a large number of DHCP messages, you can configure the DHCP rate limiting function on the device to limit the rate of DHCP messages from clients. The device can send only a specified number of DHCP messages in a certain period of time and discards excess DHCP messages.
You are advised to configure DHCP message rate limiting on user-side devices. If the device functions as the DHCP server and directly connects to DHCP clients, configure rate limiting on the device; if the device functions as the DHCP server and connects to a DHCP relay agent or DHCP snooping device, configure rate limiting on the DHCP relay agent or DHCP snooping device.
You can configure rate limiting in the system, VLAN, or interface view. The configuration takes effect in the interface view, VLAN view, and system view in descending order of priority.
(Optional) Configuring Option Parameters to Be Filled in the sname and file Fields
Context
If the DHCP server is configured with many Option parameters, because the Options field of a DHCP packet contains a maximum of 1200 bytes, by default, the Option parameters that exceed the Options field length are not filled in a DHCP response packet. To solve this problem, configure the Option parameters that exceed the Options field length to be filled in the empty sname and file fields of a DHCP response packet.
If both the sname and file fields are not empty, these Option parameters cannot be filled in a DHCP response packet. If either the sname or file field is empty, these parameters are filled in the empty field. If both the sname and file fields are empty, these parameters are filled in the file field first. When the file field becomes full, the remaining parameters are filled in the sname field.
This function is supported only in V300R019C13 and later versions.
Procedure
- Run system-view
The system view is displayed.
- Run dhcp server overload enable
The Option parameters that exceed the Options field length are filled in the empty sname and file fields.
By default, the Option parameters that exceed the Options field length are not filled in the sname and file fields
Configuring an Address Pool
Creating an Address Pool
(Optional) Excluding IP Addresses from an Address Pool
Context
To prevent a DHCP server from allocating specific IP addresses, exclude these IP addresses from the address pool.
You do not need to exclude the gateway address configured using the gateway-list or dhcp server gateway-list command from being automatically allocated. The device automatically adds the gateway address into the list of IP addresses that cannot be automatically allocated.
You do not need to exclude the IP address of a server's interface connecting to a client from being automatically allocated. The device automatically sets the interface IP address to the Conflict status during address allocation.
(Optional) Configuring Fixed IP Addresses in an Address Pool
Context
A DHCP server leases IP addresses to clients. When the lease expires, the clients must apply for new IP addresses. To ensure stability, certain clients require fixed IP addresses. In this case, configure the DHCP server to allocate fixed IP addresses to these clients. The MAC addresses of these clients are then bound to fixed IP addresses. When such a client applies to the DHCP server for an IP address, the DHCP server searches the binding entries for the MAC address of the client and allocates the matched IP address to the client. DHCP static allocation prevents manual configuration errors and facilitates unified management.
- Ensure that the bound IP address is not configured as the IP address that cannot be allocated.
- IP addresses that are used can also be statically bound to MAC addresses or unbound from MAC addresses. When an IP address is statically bound to a MAC address, ensure that the MAC address to be bound is the same as the MAC address of the user who actually uses the IP address.
- After an IP address is bound to a MAC address, the IP address does not expire. After an automatically allocated IP address is statically bound to a MAC address, the lease time of the IP address becomes unlimited. After the static binding between the IP address and the MAC address is deleted, the lease time of the IP address becomes the same as that configured in the address pool.
Function |
Scenario |
Implementation |
---|---|---|
DHCP static allocation |
Some clients (such as servers and PCs) require fixed IP addresses from a DHCP server. |
The MAC addresses of these clients are bound to fixed IP addresses. When such a client applies to the DHCP server for an IP address, the DHCP server searches the binding entries for the MAC address of the client and allocates the matched IP address to the client. |
IPSG |
Attacks including IP address spoofing and ARP spoofing need to be prevented:
|
The mapping between IP addresses and MAC addresses is set up on a device. When receiving an ARP Request packet, the device searches for the mapped MAC address based on the source IP address of the packet and compares the mapped MAC address with the source MAC address in the packet header. If the two MAC addresses are different from each other, the device considers the packet invalid and discards it. |
Static ARP |
The mapping between IP addresses and MAC addresses is manually configured in the following scenarios:
|
The mapping between IP addresses and MAC addresses is set up on a device. When receiving an ARP Request packet, the device searches for the MAC address mapped to the IP address in the packet and responds with an ARP Reply packet. Static ARP entries are manually configured and maintained. These entries are neither aged nor overwritten by dynamic ARP entries, and therefore improve communication security. |
(Optional) Configuring an Address Lease Time
Context
The default lease time in an address pool is 1 day. An administrator can change an address lease time based on network requirements. IP addresses in the same address pool use the same lease time, and different address pools can have different address leases specified. After the lease of an address pool is changed, newly allocated IP addresses use the new lease. The IP addresses that have been allocated before the lease is changed still use the old lease before the old lease is updated and use the new lease after the old lease is updated.
BOOTP clients do not support Option 51 (the IP address lease option). The lease of IP addresses allocated to BOOTP clients is unlimited, and these IP addresses will not be reclaimed by DHCP servers.
The IP addresses statically allocated to clients are always valid, without being limited by address lease time.
(Optional) Configuring Automatic Reclaim of Conflicting IP Addresses in an Address Pool
Context
When a DHCP server allocates IP addresses to clients, IP address conflict may occur because IP addresses of some hosts have been manually configured. In this case, the DHCP server considers these IP addresses as conflicting IP addresses, and allocates available IP addresses from the conflicting IP addresses to clients only after available IP addresses in the address pool are used up. To reclaim conflicting IP addresses promptly, the administrator can enable automatic reclaim and specify the reclaim interval.
(Optional) Configuring the Logging Function for IP Address Allocation
Context
Configuring the DHCP server to log IP address allocation provides you with records that may facilitate maintenance and diagnostics.
- With this logging function enabled, if a large number of DHCP clients request IP addresses from the DHCP server, the server frequently records logs. The server performance may therefore be affected.
- IP address allocation logs are recorded in the AM module. To view log information, the information center must be enabled. In addition, default settings for log output vary depending on various factors including the log level and output direction.
For example, the level of logs indicating that an IP address is successfully allocated, an IP address is successfully renewed, and an IP address is successfully released is informational, and these logs are not recorded in the log buffer by default. You can run the info-center source AM channel 4 log level informational command to change the level of the logs to be recorded in the log buffer. You can then run the display logbuffer command to check the preceding logs.
(Optional) Configuring a Gateway Address for Clients
Context
If a gateway address for clients is configured on the DHCP server, clients obtain the gateway address from the DHCP server and automatically generate a default route to the gateway address. Then the clients can access the hosts on other network segments. If the DHCP server is configured with Option 121 to allocate classless static routes to clients, the clients generate routes based on only the static routes and does not generate a default route to the gateway address. To load balance traffic and improve network reliability, configure multiple gateway addresses. A maximum of eight gateway addresses can be configured for each address pool.
In the scenario where both VRRP and DHCP are configured, if a VRRP group functions as the DHCP server, configure the gateway address of clients as the virtual IP address of the VRRP group.
If the DHCP server and clients are on the same network segment and the DHCP server functions as the gateway of clients, you do not need to configure a gateway address for clients.
Procedure
- Configure a gateway address in the interface address pool view.
- Configure a gateway address in the global address pool view.
- Configure a gateway address in the DHCP Option template view.
Enter the system view.
system-view
Create a DHCP Option template and enter the DHCP Option template view.
dhcp option template template-name
By default, no DHCP Option template is created.
To allocate network parameters except IP addresses to static clients, configure a DHCP Option template. Network parameters configured in the DHCP Option template view take effect only for static clients. For static clients, if a network parameter is configured in both the DHCP Option template view and global address pool view, only the configuration in the DHCP Option template view takes effect.
To allocate only IP addresses to static clients (for details, see (Optional) Configuring Fixed IP Addresses in an Address Pool), you do not need to configure a DHCP Option template.
Specify a gateway address that the DHCP server sends to clients.
gateway-list ip-address &<1-8>
By default, no egress gateway address is configured.
If you need to configure other items in the DHCP Option template view, complete them first before performing the following steps.
- (Optional) Return to the system view.
quit
- (Optional) Enter the global address pool view.
ip pool ip-pool-name
- (Optional) Bind a DHCP Option
template to static clients.
static-bind ip-address ip-address mac-address mac-address option-template template-name
(Optional) Configuring a Configuration File for a DHCP Client
Context
DHCP can be used to deliver configuration files to clients that require them for startup. You can save the configuration files on the DHCP server or specify the IP address of a dedicated file server. When a configuration file exists on a dedicated file server, the DHCP server needs to specify the IP address of the file server for clients. You can also specify an IP address for the file server by configuring user-defined options for clients.
If the startup configuration file is saved on a file server, the route between the DHCP client and file server must be reachable.
Procedure
- Configure a configuration file based on an interface address pool.
- Configure a configuration file based on a global address pool.
Enter the system view.
system-view
Enter the global address pool view.
ip pool ip-pool-name
Specify the name of the configuration file.
bootfile bootfile
By default, the name is not configured.
Specify the name of the server that hosts the configuration file.
sname sname
By default, the name of the server is not configured.
Specify the IP address of the file server that hosts the configuration file.
next-server ip-address
By default, the file server IP address is not configured.
- In the DHCP Option template view:
Enter the system view.
system-view
Create a DHCP Option template and enter the DHCP Option template view.
dhcp option template template-name
By default, no DHCP Option template is created.
To allocate network parameters except IP addresses to static clients, configure a DHCP Option template. Network parameters configured in the DHCP Option template view take effect only for static clients. For static clients, if a network parameter is configured in both the DHCP Option template view and global address pool view, only the configuration in the DHCP Option template view takes effect.
To allocate only IP addresses to static clients (for details, see (Optional) Configuring Fixed IP Addresses in an Address Pool), you do not need to configure a DHCP Option template.
Specify the name of the configuration file.
bootfile bootfile
By default, the name of the startup configuration file for DHCP clients is not configured.
Specify the name of the server that hosts the configuration file.
sname sname
By default, the name of the server from which a DHCP client obtains the startup configuration file is not configured.
(Optional) Specify the name of the server that hosts the configuration file.
next-server ip-address
By default, the server IP address is not configured for the client after the client automatically obtains the IP address.
If you need to configure other items in the DHCP Option template view, complete them first before performing the following steps.
- (Optional) Return to the system view.
quit
- (Optional) Enter the global address pool view.
ip pool ip-pool-name
- (Optional) Bind a DHCP Option
template to static clients.
static-bind ip-address ip-address mac-address mac-address option-template template-name
(Optional) Configuring User-defined Options
Context
- Based on the options in DHCP Discovery messages
The device inserts an option configured using the dhcp server option (based on an interface address pool) or option (based on a global address pool) command into DHCP Reply messages to be sent to a client only when the client requests this option.
- By forcibly appending the option field
The device inserts an option configured using the dhcp server force insert option (based on an interface address pool) or force insert option (based on a global address pool) command into DHCP Reply messages to be sent to a client regardless of whether the client requests this option.
Procedure
- Configure user-defined options based on an interface address pool.
- Configure user-defined options based on a global address pool.
In the global address pool view:
- Enter the system view.
system-view
(Optional) Enable the DHCP server to trust Option 82.
dhcp server trust option82
By default, the device is enabled to trust Option 82.
- Enter the global address pool view.
ip pool ip-pool-name
(Optional) Force the DHCP server to insert a specified option field into DHCP Reply messages.
force insert option code &<1-254>
By default, the DHCP server does not forcibly insert a specified option field into DHCP Reply messages.
Configure user-defined options.
option code [ sub-option sub-code ] { ascii ascii-string | hex hex-string | cipher cipher-string | ip-address ip-address &<1-8> }
By default, no user-defined option is configured.
If an option carries a password, the option code in ascii or hex type is insecure. Therefore, you are advised to set the option code type to cipher. For security purposes, use a password that is at least sixeight characters long and contains at least two types of the following: lowercase letters, uppercase letters, digits, and special characters.
Not all options can be configured using the preceding command. The following table lists the options and their commands.Table 3-8 Commands for configuring optionsOption
Configuration Command
Description
Option1
mask-length in the network (IP address pool view) ip-address [ mask { mask | mask-length } ]
Subnet mask
Option3
gateway-list ip-address &<1-8>
Gateway address
Option6
dns-list ip-address &<1-8>
DNS server IP address
Option15
domain-name domain-name
Domain name suffix
Option44
nbns-list ip-address &<1-8>
NetBIOS server IP address
Option46
netbios-type { b-node | h-node | m-node | p-node }
NetBIOS node type
Option50
N/A
Requested IP address
Option51
lease { day day [ hour hour [ minute minute ] ] | unlimited }
IP address lease
Option52
N/A
Additional option
Option53
N/A
DHCP message type
Option54
N/A
Server identifier
Option55
N/A
Parameter request list
Option57
N/A
Maximum length of a DHCP message
Option58
N/A
Lease renewal time (T1), which is 50% of the lease time
Option59
N/A
Lease renewal time (T2), which is 87.5% of the lease time
Option61
N/A
Client identifier
Option82
N/A
Relay agent information
Option120
sip-server { ip-address ip-address &<1-2> | list domain-name &<1-2> }
SIP server IP address
Option121
option121 ip-address { ip-address mask-length gateway-address } &<1-8>
A group of classless routes
Option184
option184 { as-ip ip-address | fail-over ip-address dialer-string | ncp-ip ip-address | voice-vlan vlan-id }
Voice parameters
- Enter the system view.
In the DHCP Option template view:
- Enter the system view.
system-view
Create a DHCP Option template and enter the DHCP Option template view.
dhcp option template template-name
By default, no DHCP Option template is created.
To allocate network parameters except IP addresses to static clients, configure a DHCP Option template. Network parameters configured in the DHCP Option template view take effect only for static clients. For static clients, if a network parameter is configured in both the DHCP Option template view and global address pool view, only the configuration in the DHCP Option template view takes effect.
To allocate only IP addresses to static clients (for details, see (Optional) Configuring Fixed IP Addresses in an Address Pool), you do not need to configure a DHCP Option template.
(Optional) Force the DHCP server to insert a specified option field into DHCP Reply messages.
force insert option code &<1-254>
By default, the DHCP server does not forcibly insert a specified option field into DHCP Reply messages.
Configure user-defined options.
option code [ sub-option sub-code ] { ascii ascii-string | hex hex-string | cipher cipher-string | ip-address ip-address &<1-8> }
By default, no user-defined option is configured.
If an option carries a password, the option code in ascii or hex type is insecure. Therefore, you are advised to set the option code type to cipher. For security purposes, use a password that is at least sixeight characters long and contains at least two types of the following: lowercase letters, uppercase letters, digits, and special characters.
Not all options can be configured using the preceding command. See Table 3-8 for the list of options and their commands.
Configure a classless static route to be allocated to clients.
option121 ip-address { ip-address mask-length gateway-address } &<1-8>
By default, no classless static route to be allocated to DHCP clients is configured.
Configure Option 184.
option184 { as-ip ip-address | fail-over ip-address dialer-string | ncp-ip ip-address | voice-vlan vlan-id }
By default, the Option 184 field is not configured.
If you need to configure other items in the DHCP Option template view, complete them first before performing the following steps.
- (Optional) Return to the system view.
quit
- (Optional) Enter the global address pool view.
ip pool ip-pool-name
- (Optional) Bind a DHCP Option
template to static clients.
static-bind ip-address ip-address mac-address mac-address option-template template-name
- Enter the system view.
(Optional) Configuring DNS Configurations Allocated by a DHCP Server
Context
If DHCP clients on your network use DNS and you want them to receive DNS configurations through DHCP, configure the DHCP server to provide DNS configurations.
The DNS server IP address, DNS domain name suffix, and NetBIOS server IP address in the address pool can be statistically specified or automatically obtained. The NetBIOS node type can only be statically specified. If the address pool contains the configurations that are statistically specified and automatically obtained, the statistically specified configuration takes precedence.
If the configuration is to be automatically obtained, the device as the DHCP server also needs to function as the DHCP client (the DHCP client function is configured on the interface connected to the remote DHCP server). The device obtains the DNS server IP address, DNS domain name suffix, and NetBIOS server IP address from the remote DHCP server, and then uses the import function of the address pool to allocate the information to the downlink client. For example, the DHCP server of a company needs to obtain the uniform DNS server IP address, DNS domain name suffix, and NetBIOS server IP address from the carrier, and allocate the information to the downlink client. In this case, the configuration can be automatically obtained.
Procedure
- Based on an interface address pool
- Based on a global address pool in the global address pool
view
- In the DHCP Option template
view
- Enter the system view.
system-view
Create a DHCP Option template and enter the DHCP Option template view.
dhcp option template template-name
By default, no DHCP Option template is created.
To allocate network parameters except IP addresses to static clients, configure a DHCP Option template. Network parameters configured in the DHCP Option template view take effect only for static clients. For static clients, if a network parameter is configured in both the DHCP Option template view and global address pool view, only the configuration in the DHCP Option template view takes effect.
To allocate only IP addresses to static clients (for details, see (Optional) Configuring Fixed IP Addresses in an Address Pool), you do not need to configure a DHCP Option template.
- Configure the DNS server IP address and DNS domain name suffix to be allocated to DHCP clients.
Configure the DNS server IP address to be allocated to DHCP clients.
dns-list ip-address &<1-8>
By default, no DNS server IP address is configured.
Each address pool can be configured with a maximum of eight DNS server IP addresses.
Configure the DNS domain name suffix to be allocated to DHCP clients.
domain-name domain-name
By default, no DNS domain name suffix is configured.
If you need to configure other items in the DHCP Option template view, complete them first before performing the following steps.
- (Optional) Return to the system view.
quit
- (Optional) Enter the global address pool view.
ip pool ip-pool-name
- (Optional) Bind a DHCP Option
template to static clients.
static-bind ip-address ip-address mac-address mac-address option-template template-name
- Enter the system view.
(Optional) Configuring NetBIOS Configurations Allocated by a DHCP Server
Context
If DHCP clients on your network use NetBIOS and you want them to receive NetBIOS configurations through DHCP, configure the DHCP server to provide NetBIOS configurations.
The DNS server IP address, DNS domain name suffix, and NetBIOS server IP address in the address pool can be statistically specified or automatically obtained. The NetBIOS node type can only be statically specified. If the address pool contains the configurations that are statistically specified and automatically obtained, the statistically specified configuration takes precedence.
If the configuration is to be automatically obtained, the device as the DHCP server also needs to function as the DHCP client (the DHCP client function is configured on the interface connected to the remote DHCP server). The device obtains the DNS server IP address, DNS domain name suffix, and NetBIOS server IP address from the remote DHCP server, and then uses the import function of the address pool to allocate the information to the downlink client. For example, the DHCP server of a company needs to obtain the uniform DNS server IP address, DNS domain name suffix, and NetBIOS server IP address from the carrier, and allocate the information to the downlink client. In this case, the configuration can be automatically obtained.
Procedure
- Based on an interface address pool
- Based on a global address pool in the global address pool view
- In the DHCP Option template view
- Enter the system view.
system-view
Create a DHCP Option template and enter the DHCP Option template view.
dhcp option template template-name
By default, no DHCP Option template is created.
To allocate network parameters except IP addresses to static clients, configure a DHCP Option template. Network parameters configured in the DHCP Option template view take effect only for static clients. For static clients, if a network parameter is configured in both the DHCP Option template view and global address pool view, only the configuration in the DHCP Option template view takes effect.
To allocate only IP addresses to static clients (for details, see (Optional) Configuring Fixed IP Addresses in an Address Pool), you do not need to configure a DHCP Option template.
- Configure the NetBIOS server IP address and NetBIOS node type to be allocated to DHCP clients.
Configure the NetBIOS server IP address to be allocated to DHCP clients.
nbns-list ip-address &<1-8>
By default, no NetBIOS server IP address is configured.
Each address pool can be configured with a maximum of eight NetBIOS server IP addresses.
Configure a NetBIOS node type to be allocated to DHCP clients.
netbios-type { b-node | h-node | m-node | p-node }
By default, no NetBIOS node type is configured.
If you need to configure other items in the DHCP Option template view, complete them first before performing the following steps.
- (Optional) Return to the system view.
quit
- (Optional) Enter the global address pool view.
ip pool ip-pool-name
- (Optional) Bind a DHCP Option
template to static clients.
static-bind ip-address ip-address mac-address mac-address option-template template-name
- Enter the system view.
(Optional) Configuring a SIP Server Address to Be Allocated by the DHCP Server
Context
When you configure a SIP server IP address in an address pool, the DHCP server specifies the SIP server IP address when allocating IP addresses to DHCP clients.
Procedure
- Configure a SIP server address in an interface address pool.
- Configure a SIP server address in a global address pool.
- Configure a SIP server address in the DHCP Option template view.
- Enter the system view.
system-view
Create a DHCP Option template and enter the DHCP Option template view.
dhcp option template template-name
By default, no DHCP Option template is created.
To allocate network parameters except IP addresses to static clients, configure a DHCP Option template. Network parameters configured in the DHCP Option template view take effect only for static clients. For static clients, if a network parameter is configured in both the DHCP Option template view and global address pool view, only the configuration in the DHCP Option template view takes effect.
To allocate only IP addresses to static clients (for details, see (Optional) Configuring Fixed IP Addresses in an Address Pool), you do not need to configure a DHCP Option template.
Configure the SIP server IP address to be allocated to DHCP clients.
sip-server { ip-address ip-address &<1-2> | list domain-name &<1-2> }
By default, no SIP server IP address is configured in the DHCP Option template view.
If you need to configure other items in the DHCP Option template view, complete them first before performing the following steps.
- (Optional) Return to the system view.
quit
- (Optional) Enter the global address pool view.
ip pool ip-pool-name
- (Optional) Bind a DHCP Option
template to static clients.
static-bind ip-address ip-address mac-address mac-address option-template template-name
- Enter the system view.
(Optional) Associating an IP Address Pool with NQA
Context
As shown in Figure 3-10 and Figure 3-11, the router functions as the backup DHCP server. You can associate the IP address pool on the router with NQA test instances to check the DHCP server status (including the link and DHCP server function). This can improve network reliability. When the DHCP server is working properly, the IP address pool on the router is locked, and PC1 and PC2 obtain IP addresses through the DHCP server. When NQA detects that the DHCP server is faulty, the IP address pool on the router is unlocked and assigns an IP address to PC3 that is newly online. When NQA detects that the DHCP server fault is rectified, the IP address pool on the router is locked again, and PC4 that is newly online obtains an IP address through the DHCP server.
This function is configured only for a global address pool.
When the DHCP server is faulty, PC3 obtains an IP address from the router; when the DHCP server is recovered, the DHCP function is switched back to the DHCP server. At this time, if the IP address lease of PC3 has expired, the lease renewal will fail. After PC3 goes offline temporarily, it re-obtains an IP address from the DHCP server. In addition, the two IP addresses obtained by PC3 are different because the IP address pools on the DHCP server and router have different address ranges.
Procedure
- Configure and start NQA test instances.
An IP address pool can be associated with NQA test instances of the DHCP and ICMP types. NQA test instances of the DHCP type are used to test whether the DHCP server function is normal; those of the ICMP type are used to test whether routes to the DHCP server are reachable. When the device uses NQA test instances of the ICMP type, it cannot detect the status of the DHCP server function. Therefore, the device cannot detect the situation in which the route is reachable but the DHCP server function is unavailable, and users cannot go online.
- Configure and start an NQA test instance of the DHCP type.
Enter the system view.
system-view
Create an NQA test instance and enter the test instance view.
nqa test-instance admin-name test-name
By default, no NQA test instance is configured.
Set the NQA test instance type to DHCP.
test-type dhcp
By default, no test type is configured for an NQA test instance.
Specify the source interface to send DHCP messages.
source-interface interface-type interface-number
By default, no source interface is configured for an NQA test instance.
Set the automatic test interval for the NQA test instance.
frequency interval
By default, no automatic test interval is set. The system performs the test only once.
Start the NQA test instance.
start
An NQA test instance can be started immediately, at a specified time, or after a specified delay.
Start the test instance immediately.
start now [ end { at [ yyyy/mm/dd ] hh:mm:ss | delay { seconds second | hh:mm:ss } | lifetime { seconds second | hh:mm:ss } } ]
Start the test instance at a specified time.
start at [ yyyy/mm/dd ] hh:mm:ss [ end { at [ yyyy/mm/dd ] hh:mm:ss | delay { seconds second | hh:mm:ss } | lifetime { seconds second | hh:mm:ss } } ]
Start the test instance after a specified delay.
start delay { seconds second | hh:mm:ss } [ end { at [ yyyy/mm/dd ] hh:mm:ss | delay { seconds second | hh:mm:ss } | lifetime { seconds second | hh:mm:ss } } ]
- Exit from the NQA test instance view.
quit
Before using the test instance of the DHCP type, ensure that the DHCP server provides the address pool for the network segment of the source interface (specified running the source-interface interface-type interface-number command). You can use the source interface to simulate a DHCP client to send a DHCP request, and determine the DHCP server status depending on whether an IP address can be obtained.
- Configure and start an NQA test instance of the ICMP type.
- Enter the system view.
system-view
- Create an NQA test instance and enter the test instance view.
nqa test-instance admin-name test-name
By default, no NQA test instance is configured.
- Set the test type to ICMP.
test-type icmp
By default, no test type is configured for an NQA test instance.
- Configure the destination address.
destination-address ipv4 ipv4-address
By default, no test destination address is configured.
- Set the automatic test interval for the NQA test instance.
frequency interval
By default, no automatic test interval is set. The system performs the test only once.
- Start the NQA test instance.
start
An NQA test instance can be started immediately, at a specified time, or after a specified delay.
Start the test instance immediately.
start now [ end { at [ yyyy/mm/dd ] hh:mm:ss | delay { seconds second | hh:mm:ss } | lifetime { seconds second | hh:mm:ss } } ]
Start the test instance at a specified time.
start at [ yyyy/mm/dd ] hh:mm:ss [ end { at [ yyyy/mm/dd ] hh:mm:ss | delay { seconds second | hh:mm:ss } | lifetime { seconds second | hh:mm:ss } } ]
Start the test instance after a specified delay.
start delay { seconds second | hh:mm:ss } [ end { at [ yyyy/mm/dd ] hh:mm:ss | delay { seconds second | hh:mm:ss } | lifetime { seconds second | hh:mm:ss } } ]
- Exit from the NQA test instance view.
quit
- To persistently detect the DHCP server status, you need to perform periodical test for NQA test instances. Therefore, run the frequency interval command to set the automatic test interval for NQA test instances.
- This section only mentions basic configuration parameters of the DHCP and ICMP NQA test instances. For details on how to configure other parameters, see Configuring DHCP Test and Configuring ICMP Test in the Huawei AR Series V300R019 Configuration Guide-Network Management and Monitoring.
- Enter the global address pool view.
ip pool ip-pool-name
- Configure the IP addresses that are not automatically allocated in the address pool.
excluded-ip-address start-ip-address [ end-ip-address ]
By default, all IP addresses in an address pool can be automatically allocated to clients.
The IP addresses assigned by the backup DHCP server cannot overlap with those assigned by the DHCP server, which prevents repeated assignment of an IP address. Therefore, you need to run the excluded-ip-address start-ip-address [ end-ip-address ] command to exclude the IP addresses that are repeated with those of the remote DHCP service.
- Associate the IP address pool the NQA test instance. The device determines whether to lock the address pool according to the test result of the NQA test instance.
lock track nqa admin-name test-name
By default, no IP address pool is locked.
When the NQA test instance type is not DHCP and ICMP, the association between the IP address pool and NQA do not take effect. In this case, the IP address pool is locked.
Verifying the DHCP Server Configuration
Procedure
- Check IP address allocation information in address pools using the following commands:
Interface address pool:
display ip pool [ interface interface-pool-name [ start-ip-address [ end-ip-address ] | all | conflict | expired | used ] ]
Global address pool:
display ip pool [ name ip-pool-name [ start-ip-address [ end-ip-address ] | all | conflict | expired | used [ user-type { dhcp | pppoe | l2tp | ipsec | ssl-vpn | ppp } ] ] ]
- Run the display dhcp server database command to view the path for storing the DHCP database.
- Run the display dhcp option template [ name template-name ] command to view the configuration of a DHCP Option template.
- Run the display ip pool import all command to view the DNS and NetBIOS configurations that the address pool automatically obtains and allocates to the DHCP clients.
- Run the display dhcp server configuration command to check configurations about the DHCP server.
- Enabling DHCP
- Enabling the DHCP Server Function
- (Optional) Configuring DHCP Data Restoration
- (Optional) Configuring IP Address Conflict Detection
- (Optional) Configuring a DHCP Server to Dynamically Allocate IP Addresses to BOOTP Clients
- (Optional) Forcing a DHCP Server to Reply with a DHCP NAK Message
- (Optional) Configuring the DHCP Rate Limiting Function
- (Optional) Configuring Option Parameters to Be Filled in the sname and file Fields
- Configuring an Address Pool
- Creating an Address Pool
- (Optional) Configuring the Range of IP Addresses in an Address Pool
- (Optional) Excluding IP Addresses from an Address Pool
- (Optional) Configuring Fixed IP Addresses in an Address Pool
- (Optional) Configuring an Address Lease Time
- (Optional) Configuring Automatic Reclaim of Conflicting IP Addresses in an Address Pool
- (Optional) Configuring the Alarm Function for IP Address Exhaustion
- (Optional) Configuring the Logging Function for IP Address Allocation
- (Optional) Configuring a Gateway Address for Clients
- (Optional) Configuring a Configuration File for a DHCP Client
- (Optional) Configuring User-defined Options
- (Optional) Configuring DNS Configurations Allocated by a DHCP Server
- (Optional) Configuring NetBIOS Configurations Allocated by a DHCP Server
- (Optional) Configuring a SIP Server Address to Be Allocated by the DHCP Server
- (Optional) Associating an IP Address Pool with NQA
- Verifying the DHCP Server Configuration