dhclient release a lease?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

dhclient release a lease?

quartz-2
How do I get dhclient to release its DHCP lease?

I want to be clear that I'm not interested in having it RENEW the lease
but RELEASE it- in other words send the signal to the DHCP server "I'm
going bye-bye, go ahead and put this IP address back in your free pool".

Other versions of dhclient on other OSs have commandline arguments that
activate this behavior, or will accept SIGHUP or some other variant
signal, but I can't figure out how to make this happen on openbsd.

Reply | Threaded
Open this post in threaded view
|

Re: dhclient release a lease?

quartz-2
> Currently there is no facility in dhclient(8) to issue RELEASE
> messages. I had no recollection of adding such a thing, and a
> quick

> confirmed there is no DHCPRELEASE related code.

Ergh. OK thanks, that's super annoying that it's not there.

>Which
> signal(s) are used elsewhere to trigger RELEASE? Goggle is not
> coughing up an obvious answer. :-)

It varies, IIRC on at least on other linux or bsd distro sending HUP
took a more literal approach ("hang up and leave") and sent a DHCP
release before nuking its lease cache, and I'm pretty sure somewhere
else you could send "SIGUSR2" or something.

Reply | Threaded
Open this post in threaded view
|

Re: dhclient release a lease?

Rob Schmersel
On Mon, 14 May 2018 19:36:12 -0400
Quartz <[hidden email]> wrote:

> > Currently there is no facility in dhclient(8) to issue RELEASE
> > messages. I had no recollection of adding such a thing, and a
> > quick  
>
> > confirmed there is no DHCPRELEASE related code.  
>
> Ergh. OK thanks, that's super annoying that it's not there.
>
> >Which
> > signal(s) are used elsewhere to trigger RELEASE? Goggle is not
> > coughing up an obvious answer. :-)  
>
> It varies, IIRC on at least on other linux or bsd distro sending HUP
> took a more literal approach ("hang up and leave") and sent a DHCP
> release before nuking its lease cache, and I'm pretty sure somewhere
> else you could send "SIGUSR2" or something.
>

On Red Hat/Debian  (and derivatives) they use dhclient which has a -r
switch to release the lease. From the man page:

-r     Release  the  current  lease and stop the running DHCP client as
previously recorded in the PID file. When shutdown via this method
dhclient-script will be executed with the specific  reason  for
calling the  script set.  The client normally doesn't release the
current lease as this is not required by the DHCP protocol but some
cable ISPs require their clients to notify the server if they wish  to
release an assigned IP address.