樹莓派IoT 學習3 修改靜態ip

設置樹莓派靜態ip,只需在 /etc/dhcpcd.conf下添加:
interfaceeth0
staticip_address=192.168.1.105/24
staticrouters=192.168.1.1
staticdomain_name_servers=8.8.8.8
 
interfacewlan0
staticip_address=192.168.1.106/24
staticrouters=192.168.1.1
staticdomain_name_servers=8.8.8.8

如果在/etc/network/interface中添加了如下內容會出現連不上外網的現象:

auto lo

iface lo inet loopback

iface eth0 inet static

address 192.168.1.105

netmask 255.255.255.0

gateway 192.168.1.1

那麼在 /etc/dhcpcd.conf會出現:

interfaceeth0
staticip_address=192.168.1.105/24
staticrouters=192.168.1.1
staticdomain_name_servers=
static domain_search=
將其修改爲如下內容,則聯網使用正常
interfaceeth0
staticip_address=192.168.1.105/24
staticrouters=192.168.1.1
staticdomain_name_servers=8.8.8.8
#static domain_search=

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章