树莓派设置固定IP

来源:互联网 发布:mac优酷 编辑:程序博客网 时间:2024/06/10 05:55
打开配置文件
sudo nano /etc/network/interfaces

修改IP地址
eth0-有线网卡
wlan0-无线网卡

# 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.dauto loiface lo inet loopbackiface eth0 inet staticaddress 192.168.0.120netmask 255.255.255.0gateway 192.168.0.1allow-hotplug wlan0iface wlan0 inet staticaddress 192.168.0.120netmask 255.255.255.0gateway 192.168.0.1    wpa-conf /etc/wpa_supplicant/wpa_supplicant.confallow-hotplug wlan1iface wlan1 inet manual    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

wpa_supplicant.conf文件WIFI配置
network={
    ssid="testing"
    psk="testingPassword"
}