dhclient - 應用程式設定變更而無需重新啟動

dhclient - 應用程式設定變更而無需重新啟動

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 $NAMENetworkManager 或任何其他客戶端。

您通常不會重新啟動 NetworkManager。

相關內容