Linux

如何強制 Linux 從 DHCP 伺服器重新獲取新的 IP 地址?

  • January 26, 2022

環境是Debian,儘管答案將適用於所有發行版。

你也可以使用這個命令:

dhclient -r interface

interface您要為其獲取新地址的設備在哪裡。

dhclient -r eth0

-r標誌強制dhclient首先釋放您擁有的任何租約,然後您可以使用此命令請求新的租約:

dhclient eth0

來自man dhclient

  -r     Tell  dhclient  to  release the current lease it has from the 
         server.  This is not required by the DHCP protocol, but some 
         ISPs require their clients to notify the server if they wish 
         to release an assigned IP address.

引用自:https://serverfault.com/questions/42799