dhclient
在配置文件 ( )上编辑一些配置后,/etc/dhcp/dhclient.conf
更改似乎没有任何效果,直到我重新启动计算机。由于dhclient
在后台运行,我相信该进程需要重新启动才能再次实际读取配置文件并应用所述更改。
实现这一目标的最佳方法是什么?
在dhclient
手册页上我找到了以下选项:
-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.
如果我理解正确,这个选项将杀死dhclient
,从而使其释放租约并在启动时再次读取配置文件(我不确定是否会像调用一样简单dhclient &
)。
检查进程树,我还注意到dhclient
是 的子进程network-manager
。使用新配置重新开始运行会sudo service network-manager restart
是一种更干净的方式吗?dhclient
答案1
重新激活连接。
例如通过nmcli connection up $NAME
NetworkManager 或任何其他客户端。
您通常不会重新启动 NetworkManager。