Re: Re-exec dhclient without stopping network?
Hi.
On Wed, Feb 24, 2016 at 08:54:50PM +1300, Richard Hector wrote:
> Anyone know if/how I can restart dhclient without stopping the network?
>
> It's the only process left holding open the old libc after the
> upgrade, and I'd rather avoid restarting the network (or rebooting),
> since I'm working remotely.
>
> This is on a wheezy box. It shouldn't be using dhcp, really, but
> that's an issue for another day ...
Short version (assuming that you're using stock isc-dhcp-client and your
network interface is called eth0):
pkill -9 -f dhclient
ifup --force eth0
Long version:
Sending a SIGKILL to dhclient will force it to terminate, but won't
leave it time to deconfigure a network interface. Hence your network
interface configuration should be leaved as is.
Forcing a network interface into UP state with ifupdown(1) will launch a
fresh version of dhclient, which should try to reuse existing lease file
at /var/lib/dhcp/dhclient.eth0.leases. And by reusing said lease file
dhclient should ask DHCP server for the same client IP.
Of course, if you're trying to do it over a network connection, it would
be a good idea to do the whole sequence in a screen(1) (or tmux), and to
add a timed reboot just in case. I.e:
pkill -9 -f dhclient
ifup --force eth0
sleep 1800
reboot
If all goes well you would be able to re-attach to a existing screen
session, and cancel the reboot.
If anything goes wrong - you'll have your host alive and kicking after
30 minutes of waiting.
Reco
Reply to: