I came across an issue with DHCP today. The customer was reporting that none of their machines could access the network. A quick look and it was easy to see that the machiens were not getting IP address information.

So jump onto the router and issue the commands:

R1# terminal monitor
R1# debug ip dhcp server events

The first line tells the cisco device to send STDOUT (console logging) to the VTY screen so you can see it. The second line is issuing a debug command to enable tracking for DHCP related 'events' like DHCP bindings, releases etc.

Here is the debug output for my session:

*Feb 29 11:29:06.168: DHCPD: Sending notification of DISCOVER:
*Feb 29 11:29:06.168:   DHCPD: htype 1 chaddr a1b2.ba3c.75c8
*Feb 29 11:29:06.168:   DHCPD: remote id 020a00000a78010102000000
*Feb 29 11:29:06.168:   DHCPD: circuit id 00000000
*Feb 29 11:29:06.168: DHCPD: Seeing if there is an internally specified pool class:
*Feb 29 11:29:06.168:   DHCPD: htype 1 chaddr a1b2.ba3c.75c8
*Feb 29 11:29:06.168:   DHCPD: remote id 020a00000a78010102000000
*Feb 29 11:29:06.168:   DHCPD: circuit id 00000000
*Feb 29 11:29:06.168: DHCPD: subnet [10.120.0.1,10.120.1.254] in address pool GLOBAL_POOL is empty.
*Feb 29 11:29:06.168: DHCPD: Sending notification of ASSIGNMENT FAILURE:
*Feb 29 11:29:06.168:   DHCPD: htype 1 chaddr a1b2.ba3c.75c8
*Feb 29 11:29:06.168:   DHCPD: remote id 020a00000a78010102000000
*Feb 29 11:29:06.168:   DHCPD: circuit id 00000000
*Feb 29 11:29:06.168: DHCPD: Sending notification of ASSIGNMENT_FAILURE:
*Feb 29 11:29:06.168:  DHCPD: due to: POOL EXHAUSTED
*Feb 29 11:29:06.168:   DHCPD: htype 1 chaddr a1b2.ba3c.75c8
*Feb 29 11:29:06.168:   DHCPD: remote id 020a00000a78010102000000
*Feb 29 11:29:06.168:   DHCPD: circuit id 00000000

Notice the POOL_EXHAUSTED output? Sure enough the customer had used up all their addresses in the pool. Now normally DHCP addresses are issued with an expiry timestamp called a 'lease time'. The default is usually 3 days. My customer had a fast turn around of kit and needed to reduce the lease time to something more like about 4hrs.

So first off all lets go into EXEC mode:

R1# configure terminal

OK now we need to set the new lease time. Lets go into the existing pool:

R1(config)#ip dhcp pool GLOBAL_POOL

Right so we need to set the lease time to 4 hours. The configuration statement we need is 'lease' and the two timeout numbers are firstly in 'DAYS and then 'HOURS'. So we need '0days 4hours'

R1(dhcp-config)#lease 0 4

So how can we check the new lease period is working? In the wisdom of IOSI cannot find any tool to show me this except looking at the running configuration as well as perhaps also the inferred lease expiration in the 'show ip dhcp bindings' command.


Anyway now we've set the new DHCP expiration period we can refresh the existing pool to allow the customer to see new addresses:

R1#clear ip dhcp bind *

Now lets check teh DEBUG, are we getting leases now?

*Feb 29 11:38:39.924:   DHCPD: htype 1 chaddr a1b2.ba3c.75c8
*Feb 29 11:38:39.924:   DHCPD: remote id 020a00000a78010102000000
*Feb 29 11:38:39.924:   DHCPD: circuit id 00000000
*Feb 29 11:38:39.924: DHCPD: Seeing if there is an internally specified pool class:
*Feb 29 11:38:39.924:   DHCPD: htype 1 chaddr a1b2.ba3c.75c8
*Feb 29 11:38:39.924:   DHCPD: remote id 020a00000a78010102000000
*Feb 29 11:38:39.924:   DHCPD: circuit id 00000000
*Feb 29 11:38:39.924: DHCPD: Found previous server binding
*Feb 29 11:38:41.048: DHCPD: Sending notification of ASSIGNMENT:
*Feb 29 11:38:41.052:  DHCPD: address 10.1.0.14 mask 255.255.254.0
*Feb 29 11:38:41.052:   DHCPD: htype 1 chaddr a1b2.ba3c.75c8
*Feb 29 11:38:41.052:   DHCPD: lease time remaining (secs) = 14400

I see an ASSIGNMENT now - all looks good. Lets just check the DHCP bindings now to see if we have a lesser lease period.

R1#  show ip dhcp bind
Bindings from all pools not associated with VRF:
IP address          Client-ID/              Lease expiration        Type
                    Hardware address/
                    User name
10.1.0.14          01a1.b2ba.3c75.c8       Feb 29 2012 03:54 PM    Automatic

OK I know you can't tell but I am sure the 4 hours change is working....trust me ;-)

All the best
Rich
© 2011 defaultrouteuk.com

Cisco, IOS, CCNA, CCNP, CCIE are trademarks of Cisco Systems Inc.
JunOS, JNCIA, JNCIP, JNCIE are registered trademark of Juniper Networks Inc.