Configuring The Cisco IOS DHCP Server: Finding Feature Information
Configuring The Cisco IOS DHCP Server: Finding Feature Information
Configuring The Cisco IOS DHCP Server: Finding Feature Information
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.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
1
Configuring the Cisco IOS DHCP Server
Information About the Cisco IOS DHCP Server
• The Cisco DHCP server and the relay agent services 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 3850 Switches)
2
Configuring the Cisco IOS DHCP Server
DHCP Server Address Allocation Using Option 82
82, the Cisco IOS DHCP relay agent can include additional information about itself when forwarding
client-originated DHCP packets to a DHCP server. The Cisco IOS DHCP server can also use option 82 to
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 VLAN’s 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.
When you enable option 82 on a device, the following sequence of events occurs:
1 The host (DHCP client) generates a DHCP request and broadcasts it on the network.
2 When the device receives the DHCP request, it adds the option 82 information in the packet. The option
82 information contains the device MAC address (the remote ID suboption) and the port identifier,
vlan-mod-port, from which the packet is received (the circuit ID suboption).
3 The device adds the IP address of the relay agent to the DHCP packet.
4 The device forwards the DHCP request that includes the option 82 field to the DHCP server.
5 The DHCP server receives the packet. If the server is option 82 capable, it uses the remote ID, the circuit
ID, or both to assign IP addresses and implement policies, such as restricting the number of IP addresses
that can be assigned to a single remote ID or circuit ID. The DHCP server echoes the option 82 field in
the DHCP reply.
6 The DHCP server unicasts the reply to the device if the request is relayed to the server by the device. The
device verifies that it originally inserted the option 82 data by inspecting remote ID and possibly circuit
ID fields. The device removes the option 82 field and forwards the packet to the interface that connects
to the DHCP client that sent the DHCP request.
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.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
3
Configuring the Cisco IOS DHCP Server
How to Configure the Cisco IOS DHCP Server
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.
Note 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 during a switchover are
lost when a device reboots. Possible false conflicts can occur causing the address to be removed from the
address pool.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
4
Configuring the Cisco IOS DHCP Server
Configuring a DHCP Database Agent or Disabling Conflict Logging
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
Example:
Device# configure terminal
Step 3 Do one of the following: Configures a DHCP server to save automatic bindings
on a remote host called a database agent.
• ip dhcp database url [timeout seconds | write-delay
seconds] or
Example:
Device(config)# ip dhcp database
ftp://user:[email protected]/router-dhcp timeout
80
Example:
Device(config)# no ip dhcp conflict logging
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
5
Configuring the Cisco IOS DHCP Server
Excluding IP Addresses
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.
SUMMARY STEPS
1. enable
2. configure terminal
3. ip dhcp excluded-address low-address [high-address]
4. end
DETAILED STEPS
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
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
6
Configuring the Cisco IOS DHCP Server
Configuring DHCP Address Pools
Cisco DHCP server software supports advanced capabilities for IP address allocation. See the Configuring
DHCP Address Allocation Using Option 82 section for more information.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
7
Configuring the Cisco IOS DHCP Server
Configuring DHCP Address Pools
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.
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
Example:
Device# configure terminal
Step 3 ip dhcp pool name 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 3850 Switches)
8
Configuring the Cisco IOS DHCP Server
Configuring DHCP Address Pools
Step 5 utilization mark low percentage-number [log] (Optional) Configures the low utilization mark of the current address
pool size.
Example: • The log keyword enables the logging of a system message. A
Device(dhcp-config)# utilization mark system message will be generated for a DHCP pool when the pool
low 70 log utilization falls below the configured low utilization threshold.
Step 6 network network-number [mask | Specifies the subnet network number and mask of the DHCP address
/prefix-length] [secondary] pool.
Example:
Device(dhcp-config)# network 172.16.0.0
/16
Step 7 domain-name domain Specifies the domain name for the client.
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: • One IP address is required; however, you can specify up to eight
Device(dhcp-config)# dns server IP addresses in one command.
172.16.1.103 172.16.2.103
• Servers should be listed in order of preference.
Step 9 bootfile filename (Optional) Specifies the name of the default boot image for a DHCP
client.
Example: • The boot file is used to store the boot image for the client. The
Device(dhcp-config)# bootfile xllboot boot image is generally the operating system that the client uses
to load.
Step 10 next-server address [address2 ... address8] (Optional) Configures the next server in the boot process of a DHCP
client.
Example: • One address is required; however, you can specify up to eight
Device(dhcp-config)# next-server addresses in one command line.
172.17.1.103 172.17.2.103
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
9
Configuring the Cisco IOS DHCP Server
Configuring DHCP Address Pools
Step 11 netbios-name-server address [address2 ... (Optional) Specifies the NetBIOS WINS server that is available to a
address8] Microsoft DHCP client.
• One address is required; however, you can specify up to eight
Example: addresses in one command line.
Device(dhcp-config)# netbios-name-server
172.16.1.103 172.16.2.103 • Servers should be listed in order of preference.
Step 12 netbios-node-type type (Optional) Specifies the NetBIOS node type for a Microsoft DHCP
client.
Example:
Device(dhcp-config)# netbios-node-type
h-node
Step 13 default-router address [address2 ... address8] (Optional) Specifies the IP address of the default device for a DHCP
client.
Example: • The IP address should be on the same subnet as the client.
Device(dhcp-config)# default-router
172.16.1.100 172.16.1.101 • One IP address is required; however, you can specify up to eight
IP addresses in one command line. These default devices are listed
in order of preference; that is, address is the most preferred device,
address2 is the next most preferred device, and so on.
• When a DHCP client requests an IP address, the device—acting
as a DHCP server—accesses the default device list to select
another device that the DHCP client will use as the first hop for
forwarding messages. After a DHCP client has booted, the client
begins sending packets to its default device.
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 lease {days [hours [minutes]] | infinite} (Optional) Specifies the duration of the lease.
• The default is a one-day lease.
Example:
• The infinite keyword specifies that the duration of the lease is
Device(dhcp-config)# lease 30
unlimited.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
10
Configuring the Cisco IOS DHCP Server
Configuring DHCP Address Pools
Example:
Device(dhcp-config)# end
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
11
Configuring the Cisco IOS DHCP Server
Configuring DHCP Address Pools
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
Example:
Device# configure terminal
Step 3 ip dhcp pool name 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 3850 Switches)
12
Configuring the Cisco IOS DHCP Server
Configuring DHCP Address Pools
Step 5 utilization mark low percentage-number (Optional) Configures the low utilization mark of the current address pool
[log] size.
• The log keyword enables logging of a system message. A system
Example: message is generated for a DHCP pool when the pool utilization
Device(dhcp-config)# utilization mark falls below the configured low utilization threshold.
low 70 log
Step 6 network network-number [mask | Specifies the subnet network number and mask of the primary DHCP
/prefix-length] address pool.
Example:
Device(dhcp-config)# network 172.16.0.0
/16
Step 7 domain-name domain Specifies the domain name for the client.
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: • One IP address is required; however, you can specify up to eight
Device(dhcp-config)# dns server IP addresses in one command.
172.16.1.103 172.16.2.103
• Servers should be listed in the order of preference.
Step 9 bootfile filename (Optional) Specifies the name of the default boot image for a DHCP
client.
Example: • The boot file is used to store the boot image for the client. The boot
Device(dhcp-config)# bootfile xllboot image is generally the operating system image that the client loads.
Step 10 next-server address [address2 ... address8] (Optional) Configures the next server in the boot process of a DHCP
client.
Example: • One IP address is required; however, you can specify up to eight
Device(dhcp-config)# next-server IP addresses in one command line.
172.17.1.103 172.17.2.103
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
13
Configuring the Cisco IOS DHCP Server
Configuring DHCP Address Pools
Step 11 netbios-name-server address [address2 ... (Optional) Specifies the NetBIOS Windows Internet Naming Service
address8] (WINS) server that is available to a Microsoft DHCP client.
• One address is required; however, you can specify up to eight
Example: addresses in one command line.
Device(dhcp-config)#
netbios-name-server 172.16.1.103 • Servers should be listed in order of preference.
172.16.2.103
Step 12 netbios-node-type type (Optional) Specifies the NetBIOS node type for a Microsoft DHCP client.
Example:
Device(dhcp-config)# netbios-node-type
h-node
Step 13 default-router address [address2 ... address8] (Optional) Specifies the IP address of the default device for a DHCP
client.
Example: • The IP address should be on the same subnet as the client.
Device(dhcp-config)# default-router
172.16.1.100 172.16.1.101 • One IP address is required; however, you can specify a up to eight
IP addresses in one command line. These default devices are listed
in order of preference; that is, address is the most preferred device,
address2 is the next most preferred device, and so on.
• When a DHCP client requests for an IP address, the device—acting
as a DHCP server—accesses the default device list to select another
device that the DHCP client uses as the first hop for forwarding
messages. After a DHCP client has booted, the client begins sending
packets to its default device.
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 lease {days [hours] [minutes] | infinite} (Optional) Specifies the duration of the lease.
• The default is a one-day lease.
Example:
• The infinite keyword specifies that the duration of the lease is
Device(dhcp-config)# lease 30
unlimited.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
14
Configuring the Cisco IOS DHCP Server
Configuring DHCP Address Pools
Step 17 override default-router address [address2 (Optional) Specifies the default device list that is used when an IP address
... address8] is assigned to a DHCP client from a particular secondary subnet.
• If the subnet-specific override value is configured, this override
Example: value is used when assigning an IP address from the subnet; the
Device(config-dhcp-subnet-secondary)# network-wide default device list is used only to set the gateway
override default-router 10.10.0.100 device for the primary subnet.
10.10.0.101
• If this subnet-specific override value is not configured, the
network-wide default device list is used when assigning an IP
address from the subnet.
• See Example: Configuring a DHCP Address Pool with Multiple
Disjoint Subnets section for a sample configuration.
Step 18 override utilization high percentage-number (Optional) Sets the high utilization mark of the subnet size.
• This command overrides the global default setting specified by the
Example: utilization mark high command.
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
Example: utilization mark low command.
Device(config-dhcp-subnet-secondary)#
override utilization low 40
Example:
Device(config-dhcp-subnet-secondary)#
end
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
15
Configuring the Cisco IOS DHCP Server
Configuring DHCP Address Pools
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
The following is the incorrect configuration:
!
ip dhcp pool dhcp_1
network 172.16.1.0 255.255.255.0
lease 1 20 30
accounting default
!
ip dhcp pool dhcp_2
network 172.16.2.0 255.255.255.0
lease 1 20 30
accounting default
!
ip dhcp pool dhcp_3
network 172.16.3.0 255.255.255.0
lease 1 20 30
accounting default
!
ip dhcp pool dhcp_4
network 172.16.4.0 255.255.255.0
lease 1 20 30
accounting default
!
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
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
16
Configuring the Cisco IOS DHCP Server
Configuring DHCP Address Pools
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 2 show ip dhcp pool [name] (Optional) Displays information about DHCP address pools.
Example:
Device# show ip dhcp pool
Step 3 show ip dhcp binding [address] (Optional) Displays a list of all bindings created on a specific DHCP
server.
Example: • Use the show ip dhcp binding command to display the IP
Device# show ip dhcp binding addresses that have already been assigned. Verify that the
address pool is not exhausted. If necessary, recreate the pool
to create a larger pool of addresses.
• Use the show ip dhcp binding command to display the lease
expiration date and time of the IP address of the host.
Step 4 show ip dhcp conflict [address] (Optional) Displays a list of all IP address conflicts.
Example:
Device# show ip dhcp conflict
Step 5 show ip dhcp database [url] (Optional) Displays recent activity on the DHCP database.
Example:
Device# show ip dhcp database
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
17
Configuring the Cisco IOS DHCP Server
Configuring Manual Bindings
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 3850 Switches)
18
Configuring the Cisco IOS DHCP Server
Configuring Manual Bindings
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
Example:
Device# configure terminal
Step 3 ip dhcp pool pool-name Creates a name for the DHCP server address pool and enters DHCP pool
configuration mode.
Example:
Device(config)# ip dhcp pool pool1
Step 4 host address [mask | /prefix-length] Specifies the IP address and subnet mask of the client.
• There is no limit to the number of manual bindings you can configure.
Example: However, you can configure only one manual binding per host pool.
Device(dhcp-config)# host 172.16.0.1
Step 5 client-identifier unique-identifier Specifies the unique identifier for DHCP clients.
• This command is used for DHCP requests.
Example:
• DHCP clients require client identifiers. You can specify the unique
Device(dhcp-config)#
client-identifier 01b7.0813.8811.66 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 3850 Switches)
19
Configuring the Cisco IOS DHCP Server
Configuring Manual Bindings
Note The identifier specified here is considered for a DHCP client that
sends a client identifier in the packet.
Step 6 hardware-address hardware-address Specifies a hardware address for the client.
[protocol-type | hardware-number]
• This command is used for BOOTP requests.
Example: Note The hardware address specified here is considered for a DHCP client
Device(dhcp-config)# that does not send a client identifier in the packet.
hardware-address b708.1388.f166
ethernet
Step 7 client-name name (Optional) Specifies the name of the client using any standard ASCII
character.
Example: • The client name should not include the domain name. For example, the
Device(dhcp-config)# client-name name client1 should not be specified as client1.cisco.com.
client1
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:
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
20
Configuring the Cisco IOS DHCP Server
Configuring DHCP Static Mapping
Just like automatic bindings, manual (or static) bindings from the static mapping text file are also displayed
by using the show ip dhcp binding command.
Perform this task to create the static mapping text file. You will input your addresses in the text file, which
is stored in the DHCP database for the DHCP server to read. There is no limit to the number of addresses that
can be stored in the file. The file format has the following elements:
• Database version number
• End-of-file designator
• Hardware type
• Hardware address
• IP address
• Lease expiration
• Time the file was created
See the following table for more details about the format of the text file.
The following is a sample static mapping text file:
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
21
Configuring the Cisco IOS DHCP Server
Configuring DHCP Static Mapping
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.
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.
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 3850 Switches)
22
Configuring the Cisco IOS DHCP Server
Configuring DHCP Static Mapping
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
Example:
Device# configure terminal
Step 3 ip dhcp pool name Assigns a name to a DHCP pool and enters DHCP configuration
mode.
Example: Note If you have already configured the IP DHCP pool name
Device(config)# ip dhcp pool pool1 using the ip dhcp pool command and the static file URL
using the origin file command, you must perform a fresh
read using the no service dhcp command and the service
dhcp command.
Step 4 origin file url 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
Example:
Device(dhcp-config)# end
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
23
Configuring the Cisco IOS DHCP Server
Configuring DHCP Static Mapping
Examples
The following sample output from the show ip dhcp binding command displays address bindings that are
configured:
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
24
Configuring the Cisco IOS DHCP Server
Customizing DHCP Server Operation
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
Example:
Device# configure terminal
Step 3 ip dhcp ping packets number (Optional) Specifies the number of ping packets the DHCP server
sends to a pool address before assigning the address to a requesting
Example: client.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
25
Configuring the Cisco IOS DHCP Server
Configuring a Remote Device to Import DHCP Server Options from a Central DHCP Server
Step 4 ip dhcp ping timeout milliseconds (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 ip dhcp bootp ignore (Optional) Allows the DHCP server to selectively ignore and not reply
to received BOOTP requests.
Example: • The ip dhcp bootp ignore command applies to all DHCP pools
Device(config)# ip dhcp bootp ignore configured on the device. BOOTP requests cannot be selectively
ignored on a per-DHCP pool basis.
Example:
Device(config)# end
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
26
Configuring the Cisco IOS DHCP Server
Configuring a Remote Device to Import DHCP Server Options from a Central DHCP Server
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
Example:
Device# configure terminal
Step 3 ip dhcp pool name 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 dns-server address [address2 ... address8] (Optional) Specifies the IP address of a DNS server that is
available to a DHCP client.
Example: • One IP address is required; however, you can specify up
Device(dhcp-config)# dns server 172.16.1.103 to eight IP addresses in one command line.
172.16.2.103
• Servers should be listed in the order of preference.
Example:
Device(dhcp-config)# end
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
27
Configuring the Cisco IOS DHCP Server
Configuring a Remote Device to Import DHCP Server Options from a Central DHCP Server
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
Example:
Device# configure terminal
Step 3 ip dhcp pool pool-name Creates a name for the DHCP server address pool and enters
DHCP pool configuration mode.
Example:
Device(config)# ip dhcp pool pool1
Step 4 network network-number [mask | /prefix-length] Specifies the subnet network number and mask of the
DHCP address pool.
Example:
Device(dhcp-config)# network 172.30.0.0 /16
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
28
Configuring the Cisco IOS DHCP Server
Configuring DHCP Address Allocation Using Option 82
Step 6 exit Exits DHCP pool configuration mode and enters global
configuration mode.
Example:
Device(dhcp-config)# exit
Step 7 interface type number Configures an interface and enters interface configuration
mode.
Example:
Device(config)# interface FastEthernet 0/0
Step 8 ip address dhcp Specifies that the interface acquires an IP address through
DHCP.
Example:
Device(config-if)# ip address dhcp
Example:
Device(config-if)# end
Step 10 show ip dhcp import Displays the options that are imported from the central
DHCP server.
Example:
Device# show ip dhcp import
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
29
Configuring the Cisco IOS DHCP Server
Configuring DHCP Address Allocation Using Option 82
SUMMARY STEPS
1. enable
2. configure terminal
3. ip dhcp use class
4. end
DETAILED STEPS
Example:
Device# configure terminal
Step 3 ip dhcp use class Controls DHCP classes that are used for address allocation.
• This functionality is enabled by default.
Example:
• Use the no form of this command to disable this functionality
Device(config)# ip dhcp use class
without deleting the DHCP class configuration.
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 3850 Switches)
30
Configuring the Cisco IOS DHCP Server
Configuring DHCP Address Allocation Using Option 82
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
Example:
Device# configure terminal
Step 3 ip dhcp class class-name Defines a DHCP class and enters DHCP class configuration mode.
Example:
Device(config)# ip dhcp class CLASS1
Step 4 relay agent information Enters relay agent information option configuration mode.
• If you omit this step, the DHCP class matches any relay agent
Example: information option, whether the relay agent information
Device(dhcp-class)# relay agent option value is available or not.
information
Step 5 relay-information hex pattern [*] [bitmask (Optional) Specifies a hexadecimal value for full relay information
mask] option.
• The pattern argument creates a pattern that is used to match
Example: the DHCP class.
Device(dhcp-class-relayinfo)#
relay-information hex • If you omit this step, no pattern is configured and it is
01030a0b0c02050000000123 considered a match to any relay agent information option
value, but the relay information option must be available in
the DHCP packet.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
31
Configuring the Cisco IOS DHCP Server
Configuring DHCP Address Allocation Using Option 82
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
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
32
Configuring the Cisco IOS DHCP Server
Configuring a Static Route with the Next-Hop Dynamically Obtained Through DHCP
Example:
Device# configure terminal
Step 3 ip dhcp pool name Configures a DHCP address pool on a Cisco IOS DHCP server
and enters DHCP pool configuration mode.
Example: • Multiple pools can be configured with the same class,
Device# ip dhcp pool ABC eliminating the need to configure the same pattern in multiple
pools.
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 Associates a class with a pool and enters DHCP pool class
configuration mode.
Example: • This command also creates a DHCP class if the DHCP class
Device(dhcp-config)# class CLASS1 is not yet defined.
Step 6 address range start-ip end-ip (Optional) Sets an address range for the DHCP class in a DHCP
server address pool.
Example: • If this command is not configured for a class, the default
Device(dhcp-pool-class)# address range value is the entire subnet of the pool. Each class in the DHCP
10.0.20.1 10.0.20.100 pool is examined for a match in the order configured.
Example:
Device(dhcp-pool-class)# end
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
33
Configuring the Cisco IOS DHCP Server
Configuring a Static Route with the Next-Hop Dynamically Obtained Through DHCP
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.
Note • 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.
• 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
Example:
Device# configure terminal
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
34
Configuring the Cisco IOS DHCP Server
Clearing DHCP Server Variables
Example:
Device(config)# end
Step 5 show ip route (Optional) Displays the current state of the routing table.
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 2 clear ip dhcp binding {address | *} Deletes an automatic address binding from the DHCP database.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
35
Configuring the Cisco IOS DHCP Server
Configuration Examples for the Cisco IOS DHCP Server
Step 3 clear ip dhcp conflict {address | *} Clears an address conflict from the DHCP database.
• Specifying the address argument clears the conflict for a
Example: specific IP address, whereas specifying an asterisk (*) clears
Device# clear ip dhcp conflict conflicts for all addresses.
172.16.1.103
Step 4 clear ip dhcp server statistics Resets all DHCP server counters to 0.
Example:
Device# clear ip dhcp server statistics
Server A
Server B
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
36
Configuring the Cisco IOS DHCP Server
Example: Configuring DHCP Address Pools
ip dhcp pool B
network 10.0.20.0 255.255.255.0
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
37
Configuring the Cisco IOS DHCP Server
Example: Configuring a DHCP Address Pool with Multiple Disjoint Subnets
In the following example, one DHCP address pool named pool3 is created; the primary subnet is 172.16.0.0/16,
one secondary subnet is 172.16.1.0/24, and the other secondary subnet is 172.16.2.0/24.
• When IP addresses in the primary subnet are exhausted, the DHCP server inspects the secondary subnets
in the order in which the subnets were added to the pool.
• When the DHCP server allocates an IP address from the secondary subnet 172.16.1.0/24, the server uses
the subnet-specific default device list that consists of IP addresses 172.16.1.100 and 172.16.1.101.
However, when the DHCP server allocates an IP address from the subnet 172.16.2.0/24, the server uses
the pool-wide list that consists of the four IP addresses from 172.16.0.100 to 172.16.0.103.
• Other attributes from the primary subnet 172.16.0.0/16—such as the domain name, DNS server, NetBIOS
name server, and NetBIOS node type—are inherited in both the secondary subnets.
• DHCP clients are granted 30-day leases on IP addresses in the pool. All addresses in each subnet, except
the excluded addresses, are available to the DHCP server for assigning to clients.
The table below lists the IP addresses for the devices in the DHCP address pool that consists of three disjoint
subnets.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
38
Configuring the Cisco IOS DHCP Server
Example: Configuring Manual Bindings
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
39
Configuring the Cisco IOS DHCP Server
Example: Configuring Static Mapping
no service dhcp
service dhcp
ip dhcp pool abcpool
origin file tftp://10.1.0.1/staticfilename
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.
version 12.2
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname Router
!
ip subnet-zero
!
ip dhcp bootp ignore
!
ip dhcp pool ABC
network 192.168.1.0 255.255.255.0
default-router 192.168.1.3
lease 2
!
ip dhcp pool DEF
network 10.0.18.0 255.255.255.0
!
ip cef
!
interface FastEthernet0/0
no ip address
shutdown
duplex half
!
interface Ethernet1/0
ip address 10.0.18.68 255.255.255.0
duplex half
!
interface Ethernet1/1
ip address 192.168.1.1 255.255.255.0
ip helper-address 172.16.1.1
duplex half
!
interface Ethernet1/2
shutdown
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
40
Configuring the Cisco IOS DHCP Server
Example: Importing DHCP Options
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
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
41
Configuring the Cisco IOS DHCP Server
Example: Configuring DHCP Address Allocation Using Option 82
Remote Device
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
42
Configuring the Cisco IOS DHCP Server
Example: Configuring a Static Route with the Next-Hop Dynamically Obtained Through DHCP
DHCP commands: complete command syntax, Cisco IOS IP Addressing Services Command
command mode, command history, defaults, usage Reference
guidelines, and examples
DHCP relay agent configuration “Configuring the Cisco IOS DHCP Relay Agent”
module
DHCP server on-demand address pools “Configuring the DHCP Server On-Demand Address
Pool Manager” module
DHCP client configuration “Configuring the Cisco IOS DHCP Client” module
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
43
Configuring the Cisco IOS DHCP Server
Feature Information for the Cisco IOS DHCP Server
RFCs
RFCs Title
RFC 951 Bootstrap Protocol (BOOTP)
Technical Assistance
Description Link
The Cisco Support and Documentation website http://www.cisco.com/cisco/web/support/index.html
provides online resources to download documentation,
software, and tools. Use these resources to install and
configure the software and to troubleshoot and resolve
technical issues with Cisco products and technologies.
Access to most tools on the Cisco Support and
Documentation website requires a Cisco.com user ID
and password.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
44
Configuring the Cisco IOS DHCP Server
Feature Information for the Cisco IOS DHCP Server
DHCP Server Multiple Subnet Cisco IOS XE Release 3.2SE The DHCP Server Multiple
Subnet feature enables
multiple subnets to be
configured under the same
DHCP address pool.
The following commands
were introduced or modified:
network(DHCP), override
default-router.
DHCP Server Option to Ignore all Cisco IOS XE Release 3.2SE The DHCP Server Option to
BOOTP Requests Ignore all BOOTP Requests
feature allows the Cisco IOS
DHCP server to selectively
ignore and not reply to
received Bootstrap Protocol
(BOOTP) request packets.
The following command was
introduced or modified: ip
dhcp bootp ignore.
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
45
Configuring the Cisco IOS DHCP Server
Feature Information for the Cisco IOS DHCP Server
IP Addressing: DHCP Configuration Guide, Cisco IOS XE Release 3SE (Catalyst 3850 Switches)
46