返回列表 發帖

Raspberry Pi —— 怎样从network interface 从DHCP client 变为 static IP

本帖最後由 角色 於 2019-2-7 22:20 編輯

怎样把interface从DHCP client改为static IP,以前有【1,2】,现在我们主要改动/etc/dhcpcd.conf

原来的conf:
  1. ...
  2. # Example static IP configuration:
  3. #interface eth0
  4. #static ip_address=192.168.0.10/24
  5. #static ip6_address=fd51:42f8:caae:d92e::ff/64
  6. #static routers=192.168.0.1
  7. #static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1
  8. ...
複製代碼
, 我们可以改为:
  1. # For Raspberry Pi 3b server
  2. interface eth0
  3. static ip_address=192.168.55.20/24
  4. static routers=192.168.55.1
  5. static domain_name_servers=192.168.55.1 8.8.8.8
複製代碼
.

我们不用reboot device,reload上面信息:
  1. systemctl restart dhcpcd
複製代碼
,

还有别的指令,如:
  1. systemctl stop dhcpcd
  2. systemctl start dhcpcd
複製代碼
.

References:
【1】http://www.telecom-cafe.com/foru ... =Raspberry%2Bstatic
【2】http://www.telecom-cafe.com/foru ... =Raspberry%2Bstatic

返回列表