Re: dhcp ip in use, can it be revoked?

From: prg (rdgentry1_at_cablelynx.com)
Date: 01/17/05


Date: 17 Jan 2005 07:38:45 -0800


Ittay wrote:
> hi,
>
> i have a client that requests an ip by dhcp, and then uses it to do
> NFS mounts. if the dhcp is configured to expire the IP after a while,
> what will happen? (assuming i don't have any daemon to renew the
> lease).

May depend on what you mean by "daemon". dhclient? dhcp server?

The dhclient runs as a root daemon from the startup scripts. Can you
gracefully stop it? Don't know. If I were admin of a net where
someone tried such a thing (in order to keep an IP lease), I would
refuse them _all_ future lease attempts till after a visit to the
woodshed. Such IP hanky-panky might even be considered a fireable
offense.

In normal operation the following sequence roughly proceeds

Say the lease was issued for 10 hours.

After 5 hours, the client will try to renew the lease. If the server
is down or can't be contacted, the client just goes on about its way.
But the clock keeps ticking ... 5 hours remaining.

After 8.75 hours, the client will try again and if no lease offered,
start worrrying ;-0

After 9.5 hours (?), try once again and if no renewal ... You get the
picture.

The above sequence is illustrative only of how the client tries to
renew it's lease in a manner that maintains its IP and provides for
temporary dhcp server troubles. See rebind below.

A part of the lease the client receives includes certain date/time
values. My current lease includes:
/var/lib/dhclient-eth0-leases << a RH quirk
lease {
interface "eth0";
fixed-address xxx.xxx.210.33;
option subnet-mask xxx.xxx.248.0;
option routers xxx.xxx.208.1;
option dhcp-lease-time 54907;
option ien116-name-servers xx.xxx.0.4,xx.xxx.0.5;
option dhcp-message-type 5;
option domain-name-servers xx.xxx.0.4,xx.xxx.0.5;
option dhcp-server-identifier xx.xxx.3.45;
option broadcast-address 255.255.255.255;
renew 1 2005/1/17 21:36:05;
rebind 2 2005/1/18 03:36:57; << begin trying to renew
expire 2 2005/1/18 05:31:21; << here's the one that cuts you off
}

$ man dhclient.conf
The rebind statement defines the time at which the dhcp client should
begin to try to contact any dhcp server in order to renew its lease.

The expire statement defines the time at which the dhcp client must
stop using a lease if it has not been able to contact a server in order
to renew it.

At expiry the client will check for any _unexpired_previous_ leases
which it can attempt to renew.

When all the leases are expired, the client begins all over, just as at
boot time, attempting to acquire a lease.

"If the client is unable to obtain a lease, the client's TCP/IP stack
will not function and network errors will occur." See:
http://www.j51.com/~sshay/tcpip/dhcp/dhcp.htm
or google:
dhcp client lease expire

The lesson: make sure a dhcp server is always available ;-)
hth,
prg
email above disabled



Relevant Pages

  • Re: dhclient in 6.0
    ... Not really, no, except when DHCP options appear to turn off IPv4LL, or ... I think it's pretty obvious you have a rogue client ... if there was a prior lease matching the ... Ironically, ISC DHCP was built from this mindset, from what I read. ...
    (freebsd-stable)
  • Re: dhclient in 6.0
    ... if no lease can be obtained. ... I think it's pretty obvious you have a rogue client ... machine in the DHCP dynamic pool range for whatever reasons... ... currently exist any unbounded buffer utilizations. ...
    (freebsd-stable)
  • Re: often need to stop and start DNS service....
    ... > exactly is the "lease" and how do I fix this or what do I ... The client is ALLOWED to use that address until the lease ... If the ISP is re-initializing the cable modem, ... won't "renew" automatically even though the IP is now useless. ...
    (microsoft.public.win2000.dns)
  • Re: Two DHCP setup in mix windows 2003 network.
    ... and DHCP server... ... lease of 7 days does not mean the client will hold to that IP address ... client in DHCP database. ...
    (microsoft.public.windows.server.setup)
  • Re: Two DHCP setup in mix windows 2003 network.
    ... and DHCP server... ... lease of 7 days does not mean the client will hold to that IP address ... client in DHCP database. ...
    (microsoft.public.windows.server.setup)