给树莓派设置静态ip地址
树莓默认的是动态ip地址,断电或重启后,ip地址可能会变,这给管理带来很大的不方便,我们当然得为树莓设置一个静态的ip地址。方法如下
sudo nano /etc/network/interfaces更改为如下
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
auto eth0
allow-hotplug-eth0
#iface eth0 inet manual
iface eth0 inet static
address 192.168.0.3
netmask 255.255.255.0
gateway 192.168.0.1
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf其中,address这里改为你想要的,gateway就是路由器的地址
然重重启一下,reboot
完成
页:
[1]