DHCPv4 server

Introduction to DHCPv4

The Dynamic Host Configuration Protocol (DHCP) is a network protocol that enables a server to automate assignment of IP addresses to hosts. A DHCP server can be configured to provide other network information like IP addresses of TFTP servers, DNS server, boot file name and vendor specific options. Commonly there are two types of address assignments, dynamic and manual. The lease of dynamic addresses is renewed periodically; manual leases are permanently assigned to hosts. With this feature, you can configure multiple pools of IP addresses for IP address assignment and tracking.

IP pools

A DHCP server is configured with IP pools. The server is then instructed to use IP addresses falling into the specified range of IP while offering leases. Multiple IP pools are configured to not have duplicate or overlapping IP subnets. You can also configure a DHCP server with multiple IP ranges within an IP subnet; this confines the allocatable IP addresses within the configured IP pool.

An IP pool will be claimed valid only if it is either:

  • Dynamic pool – Has a network address, subnet mask and IP range(s)

  • Static pool – Should have a static IP-to-MAC binding.

The DHCP server will discard the invalid and incomplete pools and will only operate on the valid IP pools. The DHCP server will require at least one valid pool to start.

DHCP options

On a DHCP server, an IP pool is configured with various options. These options signify additional information about the network. Options are supported with explicit commands such as boot-file. Option codes that correspond to explicit commands can not be configured with a generic option command; the generic option command requires an option code and TLV.


[NOTE: ]

NOTE: RFC 2132 defines various network information that a client may request when trying to get the lease.


BootP support

The DHCP server also functions as BootP server. A manual binding configured in a static IP Pool may either service a BootP client request or a DHCP client request.

Authoritative server and support for DHCP inform packets

The server message DHCPinformmay be received when the server is already configured for static IPv4 addresses so that the server can to get configuration parameters dynamically.


[NOTE: ]

NOTE: From RFC 2131 states that if a client has obtained a network address through some other means (e.g., manual configuration), it may use a DHCPinform request message to obtain other local configuration parameters. Servers receiving a DHCPinform message construct a DHCPACK message with any local configuration parameters appropriate for the client without: allocating a new address, checking for an existing binding, filling in yiaddr or including lease time parameters.


Authoritative pools

To process the DHCPINFORM packets received from a client within the given IP pool, a DHCP server has to be configured as authoritative for that IP pool. The server is the sole authority for this IP pool so when a client requests an IP address lease where the server is authoritative, and the server has no record of that IP address, the server will respond with DHCPNAK message which indicates that the client should no longer use that IP address. Any DHCPINFORM packet received for a non-authoritative pool will be ignored by the DHCP server.

The authoritative command has no effect when configured on a static pool or an incomplete pool without a network statement. In such cases, the server intentionally not send an error message.

A CLI toggle is provided under the pool context that will allow the authoritative configuration.


[NOTE: ]

NOTE: The authoritative command requires a network statement to be configured on a pool.


Authoritative dummy pools

A dummy pool, without the range statement, can be configured and made authoritative. A dummy pool allows static-bind entries which do not have matching dynamic pools with network statements to be configured. By creating a dummy pool on a DHCP server, the support for DHCPinform packets will not be actively serving the client on this pool. No active leases or resource consumption will be sent to the DHCP server when this option is used.

Dummy pools help the DHCP server learn the network topology.

Example

dhcp-server pool dummy192
network 192.168.10.0 255.255.255.255
option 1…
option 2…
:
option n…
authoritative
exit

Change in server behavior

Making the server authoritative for an IP pool changes how the server processes DHCP REQUEST packets.

Table XX exhibits the behavior on the receiving DHCP REQUEST and DHCP inform packets from DHCP clients residing on either authoritative and non-authoritative pools.

Authoritative and non-authoritative pools

  Authoritative Pool Non-authoritative pool
When a DHCP client sending.. For Own IP For IP belonging to different client Unknown IP falling outside the range For Own IP For IP belonging to different client Unknown IP falling outside the range
DHCP INFORM send ACK send ACK send ACK DROP DROP DROP
DHCP REQUEST send ACK send NACK send NACK send ACK DROP DROP

DHCPv4 configuration commands

Enable/disable the DHCPv4 server

Syntax

[no]dhcp-server [enable | disable]

To enable/disable the DHCPv4 server in a switch.

  • Enable the DHCPv4 server on the device. The no form of this command will remove all DHCPv4 server configurations.

  • Disable the DHCPv4 server on the device. The no form of this command will remove all DHCPv4 server configurations.

The default is disabled.

Configuring the DHCP address pool name

Use the following command in the global configuration mode to configure the DHCP address pool name and enter the DHCP pool context.

Maximum of 128 pools are supported.

Syntax

[no]dhcp-server pool < pool-name>

Configure the DHCPv4 server IP address pool with either a static IP or a network IP range.

pool

DHCPv4 server IP address pool.

ASCII-STR

Enter an ASCII string.

authoritative

Configure the DHCP server authoritative for a pool.

bootfile-name

Specify the boot file name which is used as a boot image.

default-router

List of IP addresses of the default routers.

dns-server

List of IP addresses of the DNS servers.

domain-name

Configure the DNS (Domain Name System) domain name for translation of hostnames to IP addresses.

lease

Lease period of an IP address.

netbios-name-server

List of IP addresses of the NetBIOS (WINS) name servers.

netbios-node-type

NetBIOS node type for a Microsoft DHCPv4 client.

network

Subnet IP and mask of the DHCPv4 server address pool.

option

Raw DHCPv4 server options.

range

Range of IP addresses for the DHCPv4 server address pool.

static-bind

Static binding information for the DHCPv4 server address pool.

tftp-server

Configure a TFTP server for the DHCPv4 server address pool.

Validations

Validation

Error/Warning/Prompt

Configuring pool when maximum Number of pools already configured.

Maximum number of pools (128) has already been reached

Configuring Pool with a name that exceeds the maximum length requirement.

String %s too long. Allowed length is 32 characters.

Trying to delete non existing pool

The specified address pool does not exist.

Only alphanumeric characters, numerals and underscore is allowed in the pool name. Violating this would throw the following error message.

Invalid name. Only alphanumeric characters and hyphen are allowed.

Trying to delete existing pool or adding new pool when DHCP server enabled.

DHCP server should be disabled before changing the configuration.

Authoritative

Syntax

[no]authoritative

authoritative

Configure the DHCP server authoritative for a pool.

The DHCP server is the sole authority for the network configured under this pool. When the DHCP server is configured as authoritative, the server will respond with DHCP ACK or NACK as appropriate for all the received DHCP REQUEST and DHCP INFORM packets belonging to the subnet.

Non-authoritative DHCP INFORM packets received from the clients on a non-authoritative pool will be ignored.

Specify a boot file for the DHCP client

Syntax

[no]bootfile-name<filename>

Specify the boot file name to be used as the boot image.

Configure a default router for a DHCP client

Syntax

[no]default-router <IP-ADDR-STR> [IP-ADDR2 IP-ADDR8]

Configure the DHCP pool context to the default router for a DHCP client. List all of the IP addresses of the default routers.

Two IP addresses must be separated by a comma.

Maximum of eight default routers can be configured.

Configure the DNS IP servers

Syntax

[no]dns-server <IP-ADDR> [IP-ADDR2 IP-ADDR8]

Configure the DHCP pool context to the DNS IP servers that are available to a DHCP client. List of IP addresses of the DNS servers.

Two IP addresses must be separated by comma.

Maximum of eight DNS servers can be configured.

Configure a domain name

Syntax

[no]domain-name <name>

Configure the DNS domain name for translation of hostnames to IP addresses.

Configure lease time

Syntax

[no]lease [DD:HH:MM | infinite]

DD:HH:MM

Enter lease period.

Lease

Lease period of an IP address.

Configure the lease time for an IP address in the DHCP pool. Lease time is infinite for static pools.

The default lease period is one day.

Configure the NetBIOS WINS servers

Syntax

[no]netbios-name-server <IP-ADDR-STR> [IP-ADDR2 IP-ADDR8]

Configure the DHCP pool for the NetBIOS WINS servers that are available to a Microsoft DHCP client. List all IP addresses of the NetBIOS(WINS) name servers. The Windows Internet Naming Service (WINS) is a name resolution service that Microsoft DHCP clients use to correlate host names to IP addresses within a general grouping of networks.

Two IP addresses must be separated by a comma.

Maximum of 8 NetBIOS (WINS) name servers can be configured.

Configure the NetBIOS node type

Syntax

[no]netbios-node-type [ broadcast | hybrid | mixed | peer-to-peer ]

broadcast

Broadcast node.

hybrid

Hybrid node.

mixed

Mixed node.

peer-to-peer

Peer to peer node.

Configure the DHCP pool mode to the NetBIOS node type for a Microsoft DHCP. The NetBIOS node type for Microsoft DHCP clients can be one of four settings: broadcast, peer-to-peer, mixed, or hybrid.

Configure subnet and mask

Syntax

[no]network <ip-addr/mask-lenght>

ip-addr/mask-length

Interface IP address/mask.

Configure the DHCPv4 server pool subnet and mask for the DHCP server address pool.

Range is configured to enable pool.

Configure DHCP server options

Syntax

[no]option <CODE> {ascii <ascii-string>|hex <hex-string>|ip <IP-ADDR-STR>[IP-ADDR2 … IP-ADDR8]}

ascii

Specify ASCII string as option code value.

hex

Specify hexadecimal string as option code value.

ip

Specify one or more IP addresses as option code value.

ip-addr-str

Specify IP address.

ascii-str

Enter an ASCII string.

hex-str

Specify Hexadecimal string.

Configure the raw DHCP server options.

Configure the range of IP address

Syntax

[no]range <IP-ADDR>[<IP-ADDR>]

range

Range of IP addresses for the DHCPv4 server address pool.

ip-addr

Low IP address.

High IP address.

Configure the DHCP pool to the range of IP address for the DHCP address pool.

Configure the static binding information

Syntax

[no]static-bind ip<IP-ADDR/MASK-LENGTH> mac <MAC-ADDR>

ip

Specify client IP address.

static-bind

Static binding information for the DHCPv4 server address pool.

ip-addr / mask-length

Interface IP address or mask.

mac

Specify client MAC address.

mac-addr

Enter a MAC address.

Configure static binding information for the DHCPv4 server address pool. Manual bindings are IP addresses that have been manually mapped to the MAC addresses of hosts that are found in the DHCP database. Manual bindings are just special address pools. There is no limit on the number of manual bindings but you can only configure one manual binding per host pool.

Configure the TFTP server domain name

Syntax

[no]tftp-server [server-name <server-name> | server-ip < ip-address >]

tftp-server

Configure a TFTP server for the DHCPv4 server address pool.

server-name

TFTP server name for the DHCPv4 server address pool.

Configure the TFTP server domain name for the DHCP address pool.

Configure the TFTP server address

Syntax

[no]tftp-server server-ip <ip-address>

server-ip

TFTP server IP addresses for the DHCPv4 server address pool.

ip-addr

Specify TFTP server IP address.

Configure the TFTP server address for the DHCP address pool.

Change the number of ping packets

Syntax

[no]dhcp-server ping [packets <0-10>|timeout <0-10>]

ping

Specify DHCPv4 ping parameters.

packets

Specify number of ping packets.

<0-10>

Number of ping packets (0 disables ping).

Specify, in the global configuration context, the number of ping packets the DHCP server will send to the pool address before assigning the address. The default is two packets.

Change the amount of time

Syntax

[no]dhcp-server ping timeout <1-10>

timeout

Ping timeout.

<1-10>

Ping timeout in seconds.

Amount of time the DHCPv4 server must wait before timing out a ping packet. The default is one second.

Configure DHCP Server to save automatic bindings

Syntax

[no]dhcp-server database [file ASCII-STR] [delay<15-86400>][timeout <0-86400>]

delay

Seconds to delay writing to the lease database file.

file

URL Format: "tftp://<ip-address>/<filename>".

database

Specifies DHCPv4 database agent and the interval between database updates and database transfers.

timeout

Seconds to wait for the transfer before failing.

ascii-str

Database URL.

<15-86400>

Delay in seconds.

<0-86400>

Timeout in seconds.

Specifies DHCPv4 database agent and the interval between database updates and database transfers.

Configure a DHCP server to send SNMP notifications

Syntax

[no]snmp-server enable traps dhcp-server

dhcp-server

Traps for DHCP-Server.

Configure a DHCP server to send SNMP notifications to the SNMP entity. This command enables or disables event traps sent by the switch.

Enable conflict logging on a DHCP server

Syntax

[no]dhcp-server conflict-logging

conflict-logging

Enable DHCPv4 server address conflict logging.

Enable conflict logging on a DHCP server. Default is disabled.

Enable the DHCP server on a VLAN

Syntax

[no]dhcp-server

dhcp-server

Enable DHCPv4 server on a VLAN.

Enable DHCPv4 server on a VLAN. DHCPv4 client or DHCPv4 relay cannot co-exist with DHCPv4 server on a VLAN.

Clear commands

Syntax

clear dhcp-server conflicts [ip-addr]

dhcp-server

Clears theDHCPv4 server information.

ip-addr

Specify the IP address whose conflict is to be cleared.

Reset DHCPv4 server conflicts database. If IP address is specified, reset only that conflict.

Reset all DHCP server and BOOTP counters

Syntax

clear dhcp-server statistics

statistics

Reset DHCPv4 server and BOOTP counters.

Reset all DHCP server and BOOTP counters

Delete an automatic address binding

Syntax

clear dhcp-server binding ip-addr

binding

Reset DHCPv4 server automatic address bindings.

ip-addr

Specify IP address of the binding is to be cleared.

Delete an automatic address binding from the DHCP server database.

Show commands

Display the DHCPv4 server address bindings

Syntax

show dhcp-server binding

dhcp-server

Show DHCPv4 server global configuration information for the device.

binding

Show DHCPv4 server IP binding information for the device.

Display the DHCPv4 server address bindings on the device.

Display address conflicts

Syntax

show dhcp-server conflicts

conflicts

Show DHCPv4 server conflicts information for the device.

Display address conflicts found by a DHCPv4 server when addresses are offered by a client.

Display DHCPv4 server database agent

Syntax

show dhcp-server database

Database

Show DHCPv4 server database information for the device.

Display DHCPv4 server database agent information.

Display DHCPv4 server statistics

Syntax

show dhcp-server statistics

statistics

Show DHCPv4 server statistics information for the device.

Display DHCPv4 server statistics.

Display the DHCPv4 server IP pool information

Syntax

show dhcp-server pool <pool-name>

Pool

Show DHCPv4 server pool information for the device.

Display the DHCPv4 server IP pool information.

Display DHCPv4 server global configuration information

Syntax

show dhcp-server

dhcp-server

Show DHCPv4 server global configuration information for the device.

Display DHCPv4 server global configuration information.

Event log

Event Log Messages

Event Log Messages

Events Debug messages
DHCP server is enabled globally. DHCP server is enabled globally.

DHCP server is enabled globally.

Warnings - One or more incomplete pool configurations are found during the server startup.

A dynamic pool is considered invalid, if network IP or subnet mask is not configured. A static pool is considered incomplete, if network IP, subnet mask or MAC address is not configured.

DHCP server is enabled globally.

Warning -One or more incomplete pool configurations are found during the server startup.

DHCP server failed to start. The reason for failure is printed as the argument. DHCP server failed to start: %s "with a manual binding.
DHCP server is disabled globally. DHCP server is disabled globally.
The DHCP server configurations are deleted. The DHCP server configurations are deleted
   
Decline from client when server assigns an illegal Ipv6 address. %s: Decline offer from %x (server) of %x because the address is illegal.
DHCP server is enabled on a specific VLAN. DHCP server is enabled on VLAN %d
DHCP server is disabled on a specific VLAN. DHCP server is disabled on VLAN %d
Ping check is enabled and configured with specified retry count and timeout values Ping-check configured with retry count = %d, timeout = %d
Ping check is disabled Ping-check is disabled
Conflict-logging is enabled Conflict-logging is enabled
Conflict-logging is disabled. Conflict-logging is disabled.
A specific IP address is removed from the conflict logging database. IP address %s is removed from the conflict-logging database.
All IP addresses are removed from the conflict-logging database. "All IP addresses are removed from the conflict-logging database
Dynamic binding for a specific IP address is freed. Dynamic binding for IP address %s is freed
All the dynamic IP bindings are freed. All the dynamic IP bindings are freed
Remote binding database is configured for a specific URL. Remote binding database is configured at %s
Remote biding database is disabled. Remote binding database is disabled
Binding database is read from the specified URL at the specified time Binding database read from %s at %s
Failed to read the remote binding from the specified URL. Failed to read the remote binding database at %s
Binding database is written to the specified URL at the specified time. Binding database written to %s at %s
Failed to write the binding database to the specified URL. The reason for failure is printed as argument. Failed to write the binding database to %s. Error: %s
Invalid bindings are found in the database at the specified URL. Invalid binding database at %s
The specified VLAN does not have a matching IP pool configured.This occurs when the DHCP-server is enabled on the specified VLAN, but no IP pool is configured with a network IP matching the VLAN network IP. VLAN %d does not have a matching IP pool
Binding database is replicated to standby management module. Binding database is replicated to standby management module
DHCP server is listening for DHCP packetsThis message is displayed when DHCP server is enabled globally and DHCP server is enabled on at-least one VLAN. DHCP server is listening for DHCP packets
DHCP server is disabled on all the VLANs. Server is no longer listening for DHCP packets. DHCP server is disabled on all the VLANs. Server is no longer listening for DHCP packets
The specified IP is not offered to the DHCP client, as it is already in use. IP address %s is not offered, as it is already in use
No IP addresses available on the specified pool. No IP addresses to offer from pool %s
High threshold reached for the specified pool. Count of Active bindings and Free bindings are printed as arguments. High threshold reached for pool %s. Active bindings: %d, Free bindings: %d
Low threshold reached for the specified pool. Count of Active bindings and Free bindings are printed as arguments. Low threshold reached for pool %s. Active bindings: %d, Free bindings: %d
No active VLAN with an IP address is available to read binding database from the configured URL. No active Vlan with an IP address available to read binding database