[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to make dhclient reread its config? (Debian 10)



Reco wrote:
> 
> On Wed, Aug 26, 2020 at 10:56:30AM +0700, Victor Sudakov wrote:
> > There seems to be no dhclient service in systemd, and I don't find
> > any info about signalling dhclient with "kill -HUP" etc.
> 
> There is no need for "dhclient" service in systemd, as there's
> "networking" service for that. Restarting the latter is probably a bad
> idea in your case.

Not that bad, and actually thank you for this idea. I've just tried 
`systemctl restart networking` on a host I have emergency console access
to, and it went well: the host became inaccessible for 4-5 seconds and
then got back online, and even TCP connections (including my ssh
session) were not dropped.

> 
> 
> > "dhclient -x" or "dhclient -r" bring the network down (I've actually
> > confirmed that on a test host), and I loathe to risk it on a remote box.
> 
> As they should. Both "-x" and "-r" run dhclient scripts before dhclient
> exists, and this involves deconfiguring an appropriate network
> interface.
> 
> 
> > A reboot seems too radical.
> > 
> > Any ideas please?
> 
> Try this (note to the certain list readers - it's dangerous, do not try
> it at home unless you have a console access):
> 
> # ip -o a l dev eth0
> 2: eth0    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic eth0...
> ...
> # pgrep -fa dhc
> 355 /sbin/dhclient -4 -v -i -pf /run/dhclient.eth0.pid ...
> # pkill -9 -f dhclient
> # ip -o a l dev eth0 # note that the IPs stay
> 2: eth0    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic eth0...
> ...
> # ifup --force eth0
> Internet Systems Consortium DHCP Client 4.4.1 ...
> 
> Basically, by sending SIGKILL to dhclient you leave your current
> interface configuration as is, and by running dhclient again (via ifup
> in this case) you apply your dhclient.conf changes.

Thanks, Reco, if ever `systemctl restart networking` fails me, I'll do
this manual thing.

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/

Attachment: signature.asc
Description: PGP signature


Reply to: