Troubleshoot DHCP

I am not going to get into a long discussion of DHCP. I run the DNS/DHCP servers at work and have a pretty good idea of how it all works. Even though the basics are the same, BIND is a different animal than IOS.

The DCHP process from debug messages
–> DHCPD: DHCPDISCOVER received from client
<– DHCPD: Sending DHCPOFFER to client
–> DHCPD: DHCPREQUEST received from client
<– DHCPD: Sending DHCPACK to client

And the actual debug output.

R4#debug ip dhcp server packet 
DHCP server packet debugging is on.
R4#
*Apr 28 22:51:33.407: DHCPD: DHCPDISCOVER received from client 0063.6973.636f.2d30.3030.342e.6464.3639.2e66.6430.312d.4661.302f.30 through relay 10.2.1.1.
*Apr 28 22:51:33.407: DHCPD: Allocate an address without class information (10.2.1.0)
R4#
*Apr 28 22:51:35.407: DHCPD: Sending DHCPOFFER to client 0063.6973.636f.2d30.3030.342e.6464.3639.2e66.6430.312d.4661.302f.30 (10.2.1.7).
*Apr 28 22:51:35.407: DHCPD: unicasting BOOTREPLY for client 0004.dd69.fd01 to relay 10.2.1.1.
*Apr 28 22:51:35.411: DHCPD: DHCPREQUEST received from client 0063.6973.636f.2d30.3030.342e.6464.3639.2e66.6430.312d.4661.302f.30.
*Apr 28 22:51:35.411: DHCPD: No default domain to append - abort update
*Apr 28 22:51:35.411: DHCPD: Sending DHCPACK to client 0063.6973.636f.2d30.3030.342e.6464.3639.2e66.6430.312d.4661.302f.30 (10.2.1.7).
*Apr 28 22:51:35.411: DHCPD: unicasting BOOTREPLY for client 0004.dd69.fd01 to relay 10.2.1.1.

DHCP Message Table

Message

Use
DHCPDISCOVER

Host is querying available servers, sent to broadcast address 255.255.255.255 on UDP port 67.
DHCPOFFER

Server responds on UDP port 68.
DHCPREQUEST

Client broadcasts to a specific DHCP server requesting the offered parameters from that server
DHCPDECLINE

Message sent from the client to the server that the address is already in use.
DHCPACK

The server sends configuration parameters including network address to a client.
DHCPNAK

The server sends a refusal to the client for request for configuration.
DHCPRELEASEClient tells a server it is giving up an address and the remaining lease.
DHCPINFORM

A client already has an IP address but is requesting other configuration paramets that the DHCP server is configured to deliver such as DNS or Winbind addresses.

IOS DHCP Server Configuration
The lease command is in days. Also, the excluded-address field can be a range low to high, for instance the snippet below will exclude the range of .1 to .50 on the 10.2.1.x subnet.

ip dhcp excluded-address 10.2.1.1 10.2.1.50

DHCP Server configuration:

no ip dhcp use vrf connected
ip dhcp excluded-address 10.2.1.1
ip dhcp excluded-address 10.2.1.2
ip dhcp excluded-address 10.2.1.254
!
ip dhcp pool vlan10
   network 10.2.1.0 255.255.255.0
   default-router 10.2.1.1 
   lease 5

DHCP Helper Address
DHCP uses broadcast address because the client does not have an IP address with which to communicate. Routers do not forward broadcasts, therefore routers need to set up to forward DHCP traffic, the IP helper-address command also forwards the following protocols:
TFTP
Domain Name System (DNS)
Internet Time Service (ITS)
NetBIOS name server
NetBIOS datagram server
BootP
TACACS

interface Vlan10
 ip address 10.2.1.1 255.255.255.0
 ip helper-address 10.1.4.5

An IOS router as a DHCP client:

interface FastEthernet0/0
 ip address dhcp

DHCP Troubleshooting
show ip dhcp conflict
show ip dhcp binding

R4#sh ip dhcp binding
Bindings from all pools not associated with VRF:
IP address          Client-ID/	 	    Lease expiration        Type
		    Hardware address/
		    User name
10.2.1.5            0063.6973.636f.2d30.    May 06 2010 11:16 AM    Automatic
                    3064.302e.6262.6566.
                    2e36.3463.312d.4661.
                    302f.30
10.2.1.8            0063.6973.636f.2d30.    May 07 2010 07:09 PM    Automatic
                    3030.342e.6464.3639.
                    2e66.6430.312d.4661.
                    302f.30

clear ip dhcp binding *
This is not necessarily the best command to run on a production router because you clear the addresses the router knows it has given out.
clear ip dhcp conflict *
debug ip dhcp server packet
See the listing above.
debug ip dhcp server events

R4#debug ip dhcp server events 
DHCP server event debugging is on.
R4#
*May  2 19:07:21.660: DHCPD: checking for expired leases.
R4#
*May  2 19:07:59.764: DHCPD: Sending notification of TERMINATION:
*May  2 19:07:59.764:  DHCPD: address 10.2.1.7 mask 255.255.255.0
*May  2 19:07:59.764:  DHCPD: reason flags: RELEASE 
*May  2 19:07:59.764:   DHCPD: htype 1 chaddr 0004.dd69.fd01
*May  2 19:07:59.764:   DHCPD: lease time remaining (secs) = 315841
*May  2 19:07:59.764: DHCPD: returned 10.2.1.7 to address pool vlan10.
R4#
*May  2 19:09:04.224: DHCPD: Sending notification of DISCOVER:
*May  2 19:09:04.224:   DHCPD: htype 1 chaddr 0004.dd69.fd01
*May  2 19:09:04.224:   DHCPD: remote id 020a00000a01040500000000
*May  2 19:09:04.224:   DHCPD: circuit id 00000000
*May  2 19:09:04.224: DHCPD: Seeing if there is an internally specified pool class:
*May  2 19:09:04.224:   DHCPD: htype 1 chaddr 0004.dd69.fd01
*May  2 19:09:04.224:   DHCPD: remote id 020a00000a01040500000000
*May  2 19:09:04.224:   DHCPD: circuit id 00000000
R4#
*May  2 19:09:06.224: DHCPD: Adding binding to radix tree (10.2.1.8)
*May  2 19:09:06.224: DHCPD: Adding binding to hash tree
*May  2 19:09:06.224: DHCPD: assigned IP address 10.2.1.8 to client 0063.6973.636f.2d30.3030.342e.6464.3639.2e66.6430.312d.4661.302f.30.
*May  2 19:09:06.228: DHCPD: Sending notification of ASSIGNMENT:
*May  2 19:09:06.228:  DHCPD: address 10.2.1.8 mask 255.255.255.0
*May  2 19:09:06.228:   DHCPD: htype 1 chaddr 0004.dd69.fd01
*May  2 19:09:06.228:   DHCPD: lease time remaining (secs) = 432000
R4#
*May  2 19:09:21.660: DHCPD: checking for expired leases.

sh ip dhcp pool

R4#sh ip dhcp pool 

Pool vlan10 :
 Utilization mark (high/low)    : 100 / 0
 Subnet size (first/next)       : 0 / 0 
 Total addresses                : 254
 Leased addresses               : 1
 Pending event                  : none
 1 subnet is currently in the pool :
 Current index        IP address range                    Leased addresses
 10.2.1.10            10.2.1.1         - 10.2.1.254        1

Additional Source:
Document ID: 27470

This entry was posted in Linux, Routing. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s