電訊茶室's Archiver

角色 發表於 2019-2-7 22:08

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

[i=s] 本帖最後由 角色 於 2019-2-7 22:20 編輯 [/i]

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

原来的conf:[code]
...
# Example static IP configuration:
#interface eth0
#static ip_address=192.168.0.10/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1
...
[/code], 我们可以改为:[code]
# For Raspberry Pi 3b server
interface eth0
static ip_address=192.168.55.20/24
static routers=192.168.55.1
static domain_name_servers=192.168.55.1 8.8.8.8
[/code].

我们不用reboot device,reload上面信息:[code]
systemctl restart dhcpcd
[/code],

还有别的指令,如:[code]
systemctl stop dhcpcd
systemctl start dhcpcd
[/code].

References:
【1】[url]http://www.telecom-cafe.com/forum/viewthread.php?tid=5919&highlight=Raspberry%2Bstatic[/url]
【2】[url]http://www.telecom-cafe.com/forum/viewthread.php?tid=6948&highlight=Raspberry%2Bstatic[/url]

頁: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.