Config DHCP Server
Config DHCP Server
Cisco devices running Cisco software include Dynamic Host Configuration Protocol (DHCP) server and the
relay agent software. The Cisco IOS DHCP server is a full DHCP server implementation that assigns and
manages IP addresses from specified address pools within the device to DHCP clients. The DHCP server
can be configured to assign additional parameters such as the IP address of the Domain Name System (DNS)
server and the default device.
This module describes the concepts and the tasks needed to configure the Cisco IOS DHCP server.
Finding Feature Information, page 1
Prerequisites for Configuring the DHCP Server, page 1
Information About the Cisco IOS DHCP Server, page 2
How to Configure the Cisco IOS DHCP Server, page 4
Configuration Examples for the Cisco IOS DHCP Server, page 36
Additional References for Cisco IOS DHCP Server, page 43
Feature Information for the Cisco IOS DHCP Server, page 44
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
1
The Cisco DHCP server and the relay agent are enabled by default. Use the no service dhcp command to
disable the Cisco DHCP server and the relay agent and the service dhcp command to reenable the functionality.
Port 67 (the DHCP server port) is closed in the Cisco DHCP/BOOTP default configuration. There are two
logical parts to the service dhcp command: service enabled and service running. The DHCP service is enabled
by default, but port 67 does not open until the DHCP service is running. If the DHCP service is running, the
show ip sockets details or the show sockets detail command displays port 67 as open.
The Cisco DHCP relay agent is enabled on an interface only when you configure the ip helper-address
command. This command enables a DHCP broadcast to be forwarded to the configured DHCP server.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
2
provide additional information to properly allocate IP addresses to DHCP clients. The information sent via
option 82 is used to identify the port where the DHCP request arrives. Automatic DHCP address allocation
does not parse out the individual suboptions contained in option 82. Rather, the address allocation is done by
matching a configured pattern byte by byte.
This feature introduces a new DHCP class capability, which is a method to group DHCP clients based on
some shared characteristics other than the subnet in which the clients reside.
For example, DHCP clients are connected to two ports of a single switch. Each port can be configured to be
a part of two VLANs: VLAN1 and VLAN2. DHCP clients belong to either VLAN1 or VLAN2 and the switch
can differentiate the VLAN that a particular DHCP Discover message belongs to (possibly through Layer 2
encapsulation). Each VLAN has its own subnet and all DHCP messages from the same VLAN (same switch)
have the giaddr field set to the same value indicating the subnet of the VLAN.
Problems can occur while allocating IP addresses to DHCP clients that are connected to different ports of the
same VLAN. These IP addresses must be part of the same subnet but the range of IP addresses must be
different. In the preceding example, when a DHCP client that is connected to a port of VLAN1 must be
allocated an IP address from a range of IP addresses within the VLANs subnet, whereas a DHCP client
connecting to port 2 of VLAN1 must be allocated an IP address from another range of IP addresses. The two
range of IP addresses are part of the same subnet (and have the same subnet mask). Generally, during DHCP
address allocation, the DHCP server refers only to the giaddr field and is unable to differentiate between the
two ranges.
To solve this problem, a relay agent residing at the switch inserts the relay information option (option 82),
which carries information specific to the port, and the DHCP server inspects both the giaddr field and the
inserted option 82 during the address selection process.
The Cisco software refers to a pool of IP addresses (giaddr or incoming interface IP address) and matches the
request to a class or classes configured in the pool in the order the classes are specified in the DHCP pool
configuration.
When a DHCP address pool is configured with one or more DHCP classes, the pool becomes a restricted
access pool, which means that no addresses are allocated from the pool unless one or more classes in the pool
matches. This design allows DHCP classes to be used either for access control (no default class is configured
on the pool) or to provide further address range partitions within the subnet of the pool.
Multiple pools can be configured with the same class, eliminating the need to configure the same pattern in
multiple pools.
The following capabilities are supported for DHCP class-based address allocation:
Specifying the full relay agent information option value as a raw hexadecimal string by using the
relay-information hex command in new relay agent information configuration mode.
Support for bit-masking the raw relay information hexadecimal value.
Support for a wildcard at the end of a hexadecimal string specified by the relay-information hex
command.
If the relay agent inserts option 82 but does not set the giaddr field in the DHCP packet, the DHCP server
interface must be configured as a trusted interface by using the ip dhcp relay information trusted command.
This configuration prevents the server from dropping the DHCP message.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
3
We strongly recommend using database agents. However, the Cisco DHCP server can run without database
agents. If you choose not to configure a DHCP database agent, disable the recording of DHCP address
conflicts on the DHCP server by using the no ip dhcp conflict logging command in global configuration
mode. If there is a conflict logging but no database agent is configured, bindings are lost when a device
reboots. Possible false conflicts can occur causing the address to be removed from the address pool.
Note
SUMMARY STEPS
1. enable
2. configure terminal
3. Do one of the following:
ip dhcp database url [timeout seconds | write-delay seconds]
no ip dhcp conflict logging
4. end
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Device> enable
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
4
Step 2
Command or Action
Purpose
configure terminal
Example:
Device# configure terminal
Step 3
Example:
Device(config)# ip dhcp database
ftp://user:[email protected]/router-dhcp timeout
80
Example:
Device(config)# no ip dhcp conflict logging
Step 4
end
Example:
Device(config)# end
Excluding IP Addresses
The IP address configured on a device interface is automatically excluded from the DHCP address pool. The
DHCP server assumes that all other IP addresses in a DHCP address pool subnet are available for assigning
to DHCP clients.
You must exclude addresses from the pool if the DHCP server does not allocate those IP addresses to DHCP
clients. Consider a scenario where two DHCP servers are set up for the same network segment (subnet) for
redundancy. If DHCP servers do not coordinate their services with each other using a protocol such as DHCP
failover, each DHCP server must be configured to allocate addresses from a nonoverlapping set of addresses
in the shared subnet. See the Example: Configuring Manual Bindings section for a configuration example.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
5
SUMMARY STEPS
1. enable
2. configure terminal
3. ip dhcp excluded-address low-address [high-address]
4. end
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Device> enable
Step 2
configure terminal
Example:
Device# configure terminal
Step 3
ip dhcp excluded-address low-address [high-address] Specifies IP addresses that the DHCP server should not
assign to DHCP clients.
Example:
Device(config)# ip dhcp excluded-address
172.16.1.100 172.16.1.103
Step 4
end
Example:
Device(config)# end
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
6
DHCP defines a process by which the DHCP server knows the IP subnet in which the DHCP client resides,
and it can assign an IP address from a pool of valid IP addresses in that subnet. The process by which the
DHCP server identifies the DHCP address pool to use for a client request is described in the Configuring
Manual Bindings section.
The DHCP server identifies and uses DHCP address pools for a client request, in the following manner:
If the client is not directly connected to the DHCP server (the giaddr field of the DHCPDISCOVER
broadcast message is nonzero), the server matches the DHCPDISCOVER with the DHCP pool that has
the subnet that contains the IP address in the giaddr field.
If the client is directly connected to the DHCP server (the giaddr field is zero), the DHCP server matches
the DHCPDISCOVER with DHCP pools that contain the subnets configured on the receiving interface.
If the interface has secondary IP addresses, subnets associated with the secondary IP addresses are
examined for possible allocation only after the subnet associated with the primary IP address (on the
interface) is exhausted.
Cisco DHCP server software supports advanced capabilities for IP address allocation. See the Configuring
DHCP Address Allocation Using Option 82 section for more information.
Note
You cannot configure manual bindings within the same pool that is configured with the network DHCP
pool configuration command. To configure manual bindings, see the Configuring Manual Bindings section.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
7
SUMMARY STEPS
1. enable
2. configure terminal
3. ip dhcp pool name
4. utilization mark high percentage-number [log]
5. utilization mark low percentage-number [log]
6. network network-number [mask | /prefix-length] [secondary]
7. domain-name domain
8. dns-server address [address2 ... address8]
9. bootfile filename
10. next-server address [address2 ... address8]
11. netbios-name-server address [address2 ... address8]
12. netbios-node-type type
13. default-router address [address2 ... address8]
14. option code [instance number] {ascii string | hex string | ip-address}
15. lease {days [hours [minutes]] | infinite}
16. end
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Device> enable
Step 2
configure terminal
Example:
Device# configure terminal
Step 3
Creates a name for the DHCP server address pool and enters DHCP
pool configuration mode.
Example:
Device(config)# ip dhcp pool 1
Step 4
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
8
Step 5
Command or Action
Purpose
Example:
Device(dhcp-config)# utilization mark
low 70 log
Step 6
Example:
Device(dhcp-config)# network 172.16.0.0
/16
Step 7
domain-name domain
Example:
Device(dhcp-config)# domain-name
cisco.com
Step 8
Step 9
bootfile filename
(Optional) Specifies the name of the default boot image for a DHCP
client.
Example:
Device(dhcp-config)# bootfile xllboot
Step 10
The boot file is used to store the boot image for the client. The
boot image is generally the operating system that the client uses
to load.
next-server address [address2 ... address8] (Optional) Configures the next server in the boot process of a DHCP
client.
Example:
Device(dhcp-config)# next-server
172.17.1.103 172.17.2.103
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
9
Step 11
Step 12
Command or Action
Purpose
Example:
Device(dhcp-config)# netbios-name-server
172.16.1.103 172.16.2.103
netbios-node-type type
Example:
Device(dhcp-config)# netbios-node-type
h-node
Step 13
Step 14
option code [instance number] {ascii string (Optional) Configures DHCP server options.
| hex string | ip-address}
Example:
Device(dhcp-config)# option 19 hex 01
Step 15
Step 16
end
Example:
Device(dhcp-config)# end
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
10
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
11
SUMMARY STEPS
1. enable
2. configure terminal
3. ip dhcp pool name
4. utilization mark high percentage-number [log]
5. utilization mark low percentage-number [log]
6. network network-number [mask | /prefix-length]
7. domain-name domain
8. dns-server address [address2 ... address8]
9. bootfile filename
10. next-server address [address2 ... address8]
11. netbios-name-server address [address2 ... address8]
12. netbios-node-type type
13. default-router address [address2 ... address8]
14. option code [instance number] {ascii string | hex string | ip-address}
15. lease {days [hours] [minutes] | infinite}
16. network network-number [mask | /prefix-length] [secondary]
17. override default-router address [address2 ... address8]
18. override utilization high percentage-number
19. override utilization low percentage-number
20. end
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Device> enable
Step 2
configure terminal
Example:
Device# configure terminal
Step 3
Creates a name for the DHCP server address pool and enters DHCP pool
configuration mode.
Example:
Device(config)# ip dhcp pool 1
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
12
Command or Action
Step 4
Purpose
utilization mark high percentage-number (Optional) Configures the high utilization mark of the current address
pool size.
[log]
Example:
Device(dhcp-config)# utilization mark
high 80 log
Step 5
Step 6
Example:
Device(dhcp-config)# network 172.16.0.0
/16
Step 7
domain-name domain
Example:
Device(dhcp-config)# domain-name
cisco.com
Step 8
dns-server address [address2 ... address8] Specifies the IP address of a DNS server that is available to a DHCP
client.
Example:
Device(dhcp-config)# dns server
172.16.1.103 172.16.2.103
Step 9
bootfile filename
(Optional) Specifies the name of the default boot image for a DHCP
client.
Example:
Device(dhcp-config)# bootfile xllboot
Step 10
The boot file is used to store the boot image for the client. The boot
image is generally the operating system image that the client loads.
next-server address [address2 ... address8] (Optional) Configures the next server in the boot process of a DHCP
client.
Example:
Device(dhcp-config)# next-server
172.17.1.103 172.17.2.103
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
13
Command or Action
Purpose
If multiple servers are specified, DHCP assigns the servers to clients
in a round-robin order. The first client gets address 1, the next client
gets address 2, and so on.
If this command is not configured, DHCP uses the server specified
by the ip helper address command as the boot server.
Step 11
netbios-name-server address [address2 ... (Optional) Specifies the NetBIOS Windows Internet Naming Service
(WINS) server that is available to a Microsoft DHCP client.
address8]
Example:
Device(dhcp-config)#
netbios-name-server 172.16.1.103
172.16.2.103
Step 12
netbios-node-type type
Example:
Device(dhcp-config)# netbios-node-type
h-node
Step 13
Step 14
Example:
Device(dhcp-config)# option 19 hex 01
Step 15
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
14
Step 16
Command or Action
Purpose
Example:
Device(dhcp-config)# network 10.10.0.0
255.255.0.0 secondary
Step 17
override default-router address [address2 (Optional) Specifies the default device list that is used when an IP address
is assigned to a DHCP client from a particular secondary subnet.
... address8]
Example:
Device(config-dhcp-subnet-secondary)#
override default-router 10.10.0.100
10.10.0.101
Step 18
Example:
Device(config-dhcp-subnet-secondary)#
override utilization high 60
Step 19
override utilization low percentage-number (Optional) Sets the low utilization mark of the subnet size.
This command overrides the global default setting specified by the
utilization mark low command.
Example:
Device(config-dhcp-subnet-secondary)#
override utilization low 40
Step 20
end
Example:
Device(config-dhcp-subnet-secondary)#
end
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
15
Troubleshooting Tips
If you are using secondary IP addresses under a single loopback interface and using secondary subnets under
a DHCP pool, use one DHCP pool to configure networks for all the secondary subnets instead of using one
pool per secondary subnet. The network network-number [mask | /prefix-length] [secondary] command must
be configured under a single DHCP address pool rather than multiple DHCP address pools.
The following is the correct configuration:
!
ip dhcp pool dhcp_1
network 172.16.1.0 255.255.255.0
network 172.16.2.0 255.255.255.0 secondary
network 172.16.3.0 255.255.255.0 secondary
network 172.16.4.0 255.255.255.0 secondary
!
interface Loopback111
ip address 172.16.1.1 255.255.255.255 secondary
ip address 172.16.2.1 255.255.255.255 secondary
ip address 172.16.3.1 255.255.255.255 secondary
ip address 172.16.4.1 255.255.255.255 secondary
secondary
secondary
secondary
secondary
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
16
SUMMARY STEPS
1. enable
2. show ip dhcp pool [name]
3. show ip dhcp binding [address]
4. show ip dhcp conflict [address]
5. show ip dhcp database [url]
6. show ip dhcp server statistics [type-number]
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Device> enable
Step 2
Example:
Device# show ip dhcp pool
Step 3
Step 4
Example:
Device# show ip dhcp conflict
Step 5
Example:
Device# show ip dhcp database
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
17
Step 6
Command or Action
Purpose
Example:
Device# show ip dhcp server statistics
Note
We strongly recommend that you use database agents. However, Cisco DHCP server can function even
without database agents.
Some DHCP clients send a client identifier (DHCP option 61) in the DHCP packet. To configure manual
bindings for such clients, you must enter the client-identifier command with the hexadecimal values that
identify the DHCP client. To configure manual bindings for clients that do not send a client identifier option,
you must enter the hardware-address DHCP pool configuration command with the hexadecimal hardware
address of the client.
Depending on your release, the DHCP server sends infinite lease time to the clients for which manual bindings
are configured.
Depending on your release, the DHCP server sends lease time that is configured using the lease command to
clients for which manual bindings are configured.
Note
You cannot configure manual bindings within the same pool that is configured with the network command
in DHCP pool configuration mode. See the Configuring DHCP Address Pools section for information
about DHCP address pools and the network command.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
18
SUMMARY STEPS
1. enable
2. configure terminal
3. ip dhcp pool pool-name
4. host address [mask | /prefix-length]
5. client-identifier unique-identifier
6. hardware-address hardware-address [protocol-type | hardware-number]
7. client-name name
8. end
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Device> enable
Step 2
configure terminal
Example:
Device# configure terminal
Step 3
Creates a name for the DHCP server address pool and enters DHCP pool
configuration mode.
Example:
Device(config)# ip dhcp pool pool1
Step 4
Example:
Device(dhcp-config)# host 172.16.0.1
Step 5
client-identifier unique-identifier
Example:
Device(dhcp-config)#
client-identifier 01b7.0813.8811.66
DHCP clients require client identifiers. You can specify the unique
identifier for the client in either of the following ways:
A 7-byte dotted hexadecimal notation. For example,
01b7.0813.8811.66, where 01 represents the Ethernet media type
and the remaining bytes represent the MAC address of the DHCP
client.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
19
Command or Action
Purpose
A 27-byte dotted hexadecimal notation. For example,
7665.6e64.6f72.2d30.3032.342e.3937.6230.2e33.3734.312d.4661.302f.31.
The equivalent ASCII string for this hexadecimal value is
vendor-0024.97b0.3741-fa0/1, where vendor represents the vendor,
0024.97b0.3741 represents the MAC address of the source
interface, and fa0/1 represents the source interface of the DHCP
client.
See the Troubleshooting Tips section for information about how to
determine the client identifier of the DHCP client.
Note
Step 6
hardware-address hardware-address
[protocol-type | hardware-number]
Example:
Step 7
client-name name
Example:
Device(dhcp-config)# client-name
client1
Step 8
Device(dhcp-config)#
hardware-address b708.1388.f166
ethernet
(Optional) Specifies the name of the client using any standard ASCII
character.
The client name should not include the domain name. For example, the
name client1 should not be specified as client1.cisco.com.
Returns to privileged EXEC mode.
end
Example:
Device(dhcp-config)# end
Troubleshooting Tips
You can determine the client identifier by using the debug ip dhcp server packet command. In the following
sample output, the client is identified by the value 0b07.1134.a029:
Device# debug ip dhcp server packet
DHCPD:DHCPDISCOVER received from client 0b07.1134.a029 through relay 10.1.0.253.
DHCPD:assigned IP address 10.1.0.3 to client 0b07.1134.a029.
.
.
.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
20
Lease expiration
Infinite
Infinite
Infinite
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
21
Field
Description
*time*
Specifies the time the file was created. This field allows DHCP to differentiate
between the new and old database versions when multiple agents are configured.
The valid format of the time is mm dd yyyy hh:mm AM/PM.
*version* 2
IP address
Specifies the static IP address. If the subnet mask is not specified, a mask is
automatically assigned depending on the IP address. The IP address and the mask
is separated by a space.
Type
Specifies the hardware type. For example, type 1 indicates Ethernet. The type id
indicates that the field is a DHCP client identifier. Legal values can be found online
at http://www.iana.org/assignments/arp-parameters in the Number Hardware Type
list.
Hardware address
Lease expiration
Specifies the expiration of the lease. Infinite specifies that the duration of the lease
is unlimited.
*end*
End of file. DHCP uses the *end* designator to detect file truncation.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
22
Note
The static bindings must not be deleted when a DHCPRELEASE is received or must not be timed out by
the DHCP timer. The static bindings should be created by using the ip dhcp pool command.
SUMMARY STEPS
1. enable
2. configure terminal
3. ip dhcp pool name
4. origin file url
5. end
6. show ip dhcp binding [address]
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Device> enable
Step 2
configure terminal
Example:
Device# configure terminal
Step 3
ip dhcp pool
name
Example:
Note
Step 4
Specifies the URL that the DHCP server can access to locate the
text file.
Example:
Device(dhcp-config)# origin file
tftp://10.1.0.1/static-bindings
Step 5
end
Example:
Device(dhcp-config)# end
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
23
Step 6
Command or Action
Purpose
Example:
Device# show ip dhcp binding
Examples
The following sample output from the show ip dhcp binding command displays address bindings that are
configured:
Device# show ip dhcp binding
00:05:14:%SYS-5-CONFIG_I: Configured from console by
Bindings from all pools not associated with VRF:
IP address Client-ID/
Ls expir
Type
10.9.9.4/8 0063.7363.2d30.3036. Infinite
Static
10.9.9.1/24 0063.6973.636f.2d30. Infinite
Static
console
Hw address
User name
302e.3762.2e39.3634. 632d.4574.8892.
3036.302e.3437.3165. 2e64.6462.342d.
The following sample output displays each entry in the static mapping text file:
*time* Jan 21 2005 22:52 PM
!IP address
Type
Hardware address
Lease expiration
10.19.9.1 /24
id
0063.6973.636f.2d30.3036.302e.3437
10.9.9.4
id
0063.7363.2d30.3036.302e.3762.2e39.3634.632d Infinite
*end*
The following sample debug output shows the reading of the static mapping text file from the TFTP server:
Device# debug ip dhcp server
Loading abc/static_pool from 10.19.192.33 (via Ethernet0):
[OK - 333 bytes]
*May 26 23:14:21.259: DHCPD: contacting agent tftp://10.19.192.33/abc/static_pool (attempt
0)
*May 26 23:14:21.467: DHCPD: agent tftp://10.19.192.33/abc/static_pool is responding.
*May 26 23:14:21.467: DHCPD: IFS is ready.
*May 26 23:14:21.467: DHCPD: reading bindings from tftp://10.19.192.33/abc/static_pool.
*May 26 23:14:21.707: DHCPD: read 333 / 1024 bytes.
*May 26 23:14:21.707: DHCPD: parsing text line
*time* Apr 22 2002 11:31 AM
*May 26 23:14:21.707: DHCPD: parsing text line
*May 26 23:14:21.707: DHCPD: parsing text line
!IP address Type Hardware address Lease expiration
*May 26 23:14:21.707: DHCPD: parsing text line
10.9.9.1 /24 id 0063.6973.636f.2d30.3036.302e.3437
*May 26 23:14:21.707: DHCPD: creating binding for 10.9.9.1
*May 26 23:14:21.707: DHCPD: Adding binding to radix tree (10.9.9.1)
*May 26 23:14:21.707: DHCPD: Adding binding to hash tree
*May 26 23:14:21.707: DHCPD: parsing text line
10.9.9.4 id 0063.7363.2d30.3036.302e.3762.2e39.3634.632d
*May 26 23:14:21.711: DHCPD: creating binding for 10.9.9.4
*May 26 23:14:21.711: DHCPD: Adding binding to radix tree (10.9.9.4)
*May 26 23:14:21.711: DHCPD: Adding binding to hash tree
*May 26 23:14:21.711: DHCPD: parsing text line Infinite
*May 26 23:14:21.711: DHCPD: parsing text line
*May 26 23:14:21.711: DHCPD: parsing text line
!IP address Interface-index Lease expiration VRF
*May 26 23:14:21.711: DHCPD: parsing text line *end*
*May 26 23:14:21.711: DHCPD: read static bindings from tftp://10.19.192.33/abcemp/static_pool.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
24
SUMMARY STEPS
1. enable
2. configure terminal
3. ip dhcp ping packets number
4. ip dhcp ping timeout milliseconds
5. ip dhcp bootp ignore
6. end
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Device> enable
Step 2
configure terminal
Example:
Device# configure terminal
Step 3
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
25
Command or Action
Purpose
The default is two packets. Setting the number argument to a
value of 0 disables the DHCP server ping operation.
Step 4
(Optional) Specifies the duration the DHCP server waits for a ping
reply from an address pool.
Example:
Device(config)# ip dhcp ping timeout
850
Step 5
Example:
Step 6
end
Example:
Device(config)# end
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
26
SUMMARY STEPS
1. enable
2. configure terminal
3. ip dhcp pool name
4. network network-number [mask | /prefix-length]
5. dns-server address [address2 ... address8]
6. end
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Device> enable
Step 2
configure terminal
Example:
Device# configure terminal
Step 3
Creates a name for the DHCP server address pool and enters
DHCP pool configuration mode.
Example:
Device(config)# ip dhcp pool 1
Step 4
network network-number [mask | /prefix-length] Specifies the subnet number and mask of the DHCP address
pool.
Example:
Device(dhcp-config)# network 172.16.0.0 /16
Step 5
Step 6
end
Example:
Device(dhcp-config)# end
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
27
SUMMARY STEPS
1. enable
2. configure terminal
3. ip dhcp pool pool-name
4. network network-number [mask | /prefix-length]
5. import all
6. exit
7. interface type number
8. ip address dhcp
9. end
10. show ip dhcp import
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Device> enable
Step 2
configure terminal
Example:
Device# configure terminal
Step 3
Creates a name for the DHCP server address pool and enters
DHCP pool configuration mode.
Example:
Device(config)# ip dhcp pool pool1
Step 4
Example:
Device(dhcp-config)# network 172.30.0.0 /16
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
28
Step 5
Command or Action
Purpose
import all
Example:
Device(dhcp-config)# import all
Step 6
exit
Example:
Device(dhcp-config)# exit
Step 7
Example:
Device(config)# interface FastEthernet 0/0
Step 8
ip address dhcp
Example:
Device(config-if)# ip address dhcp
Step 9
end
Example:
Device(config-if)# end
Step 10
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
29
SUMMARY STEPS
1. enable
2. configure terminal
3. ip dhcp use class
4. end
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Device> enable
Step 2
configure terminal
Example:
Device# configure terminal
Step 3
Step 4
end
Example:
Device(config)# end
Troubleshooting Tips
If DHCP classes are configured in the pool, but the DHCP server does not use the classes, verify if the no ip
dhcp use class command was configured.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
30
Perform this task to define the DHCP class and relay agent information patterns:
SUMMARY STEPS
1. enable
2. configure terminal
3. ip dhcp class class-name
4. relay agent information
5. relay-information hex pattern [*] [bitmask mask]
6. Repeat Steps 3 through 5 for each DHCP class you need to configure.
7. end
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Device> enable
Step 2
configure terminal
Example:
Device# configure terminal
Step 3
Example:
Device(config)# ip dhcp class CLASS1
Step 4
Step 5
If you omit this step, the DHCP class matches any relay agent
information option, whether the relay agent information
option value is available or not.
(Optional) Specifies a hexadecimal value for full relay information
option.
The pattern argument creates a pattern that is used to match
the DHCP class.
Example:
Device(dhcp-class-relayinfo)#
relay-information hex
01030a0b0c02050000000123
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
31
Command or Action
Purpose
You can configure multiple relay-information hex
commands in a DHCP class.
Step 6
Step 7
end
Example:
Device(dhcp-class-relayinfo)# end
Troubleshooting Tips
Use the debug ip dhcp server class command to display the class matching results.
SUMMARY STEPS
1. enable
2. configure terminal
3. ip dhcp pool name
4. network network-number [mask | /prefix-length]
5. class class-name
6. address range start-ip end-ip
7. Repeat Steps 5 and 6 for each DHCP class you need to associate with the DHCP pool.
8. end
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Device> enable
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
32
Step 2
Command or Action
Purpose
configure terminal
Example:
Device# configure terminal
Step 3
Example:
Device# ip dhcp pool ABC
Step 4
network network-number [mask | /prefix-length] Configures the subnet and mask for a DHCP address pool on a
Cisco IOS DHCP server.
Example:
Device(dhcp-config)# network 10.0.20.0
Step 5
class class-name
Example:
Device(dhcp-config)# class CLASS1
Step 6
Step 7
Step 8
end
Example:
Device(dhcp-pool-class)# end
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
33
until after the DHCP address assignment. You cannot configure a static route with the CLI without knowing
that DHCP-supplied address.
The static routes are updated in the routing table when the default gateway is assigned by the DHCP server.
The routes remain in the routing table until the DHCP lease expires and then the routes are removed.
When a DHCP client releases an address, the corresponding static route (the route configured using the ip
route command) is automatically removed from the routing table. If the DHCP router option (option 3 of the
DHCP packet) changes during the client renewal, the DHCP default gateway changes to the new IP address
supplied after the renewal.
This feature is particularly useful for VPN deployments such as Dynamic Multipoint VPNs (DMVPNs). This
feature is useful when a nonphysical interface, such as a multipoint generic routing encapsulation (mGRE)
tunnel, is configured on a device and certain traffic must be excluded from entering the tunnel interface.
If the DHCP client is not able to obtain an IP address or the default device IP address, the static route
is not installed in the routing table.
Note
If the lease has expired and the DHCP client cannot renew the address, the DHCP IP address assigned
to the client is released and any associated static routes are removed from the routing table.
SUMMARY STEPS
1. enable
2. configure terminal
3. ip route prefix mask {ip-address | interface-type interface-number [ip-address]} dhcp [distance]
4. end
5. show ip route
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Device> enable
Step 2
configure terminal
Example:
Device# configure terminal
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
34
Command or Action
Step 3
Purpose
ip route prefix mask {ip-address | interface-type Assigns a static route for the default next-hop device when the
interface-number [ip-address]} dhcp [distance] DHCP server is accessed for an IP address.
Example:
Device(config)# ip route 192.168.1.1
255.255.255.255 192.168.2.2 dhcp
Step 4
end
Example:
Device(config)# end
Step 5
show ip route
Example:
Device# show ip route
SUMMARY STEPS
1. enable
2. clear ip dhcp binding {address | *}
3. clear ip dhcp conflict {address | *}
4. clear ip dhcp server statistics
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Device> enable
Step 2
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
35
Command or Action
Example:
Purpose
Specifying the address argument clears the automatic binding
for a specific (client) IP address, whereas specifying an asterisk
(*) clears all automatic bindings.
Step 3
Step 4
Example:
Device# clear ip dhcp server statistics
Server B
ip dhcp excluded-address 10.0.20.0 10.0.20.125
!
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
36
ip dhcp pool B
network 10.0.20.0 255.255.255.0
Pool 0 (Network
172.16.0.0)
Device
IP Address
Device
IP Address
Device
IP Address
Default devices
Default devices
172.16.1.100
Default devices
172.16.2.100
172.16.1.101
DNS server
172.16.1.102
172.16.2.101
172.16.2.102
NetBIOS name
server
172.16.1.103
172.16.2.103
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
37
Primary Subnet
(172.16.0.0/16)
First Secondary
Subnet
(172.16.1.0/24)
Second Secondary
Subnet
(172.16.2.0/24)
Device
IP Address
Device
IP Address
Device
IP Address
Default devices
172.16.0.100
Default devices
172.16.1.100
Default devices
172.16.0.100
172.16.0.101
DNS server
172.16.1.101
172.16.0.101
172.16.0.102
172.16.0.102
172.16.0.103
172.16.0.103
172.16.1.102
172.16.2.102
NetBIOS name
server
172.16.1.103
172.16.2.103
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
38
Primary Subnet
(172.16.0.0/16)
First Secondary
Subnet
(172.16.1.0/24)
Second Secondary
Subnet
(172.16.2.0/24)
The following example shows how to create a manual binding for a client named example2.abc.com that does
not send a client identifier in the DHCP packet. The MAC address of the client is 02c7.f800.0422 and the IP
address of the client is 172.16.2.253.
ip dhcp pool pool2
host 172.16.2.253
hardware-address 02c7.f800.0422 ethernet
client-name example1
Because attributes are inherited, the two preceding configurations are equivalent to the following:
ip dhcp pool pool1
host 172.16.2.254 255.255.255.0
hardware-address 02c7.f800.0422 ieee802
client-name client1
default-router 172.16.2.100 172.16.2.101
domain-name abc.com
dns-server 172.16.1.102 172.16.2.102
netbios-name-server 172.16.1.103 172.16.2.103
netbios-node-type h-node
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
39
Note
The static mapping text file can be copied to flash memory on the device and served by the TFTP process
of the device. In this case, the IP address in the original file line must be an address owned by the device
and one additional line of configuration is required on the device:tftp-server flash static-filename.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
40
duplex half
!
interface Ethernet1/3
no ip address
shutdown
duplex half
!
interface FastEthernet2/0
no ip address
shutdown
duplex half
!
ip route 172.16.1.1 255.255.255.255 e1/0
no ip http server
no ip pim bidir-enable
!
call rsvp-sync
!
mgcp profile default
!
dial-peer cor custom
!
gatekeeper
shutdown
!
line con 0
line aux 0
line vty 0 4
!
end
Central Device
!do not assign this range to DHCP clients
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
41
Remote Device
ip dhcp pool client
! Imports DHCP option parameters into DHCP server database
import all
network 172.16.2.254 255.255.255.0
!
interface FastEthernet0/0
ip address dhcp
duplex auto
speed auto
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
42
Document Title
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
43
Related Topic
Document Title
DHCP enhancements for edge-session management Configuring DHCP Enhancements for Edge-Session
Management module
DHCP options
RFCs
RFCs
Title
RFC 951
RFC 1542
RFC 2131
RFC 2132
Technical Assistance
Description
Link
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
44
Feature Name
Releases
Feature Configuration
Information
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
45
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3650 Switches)
46