树莓派WiFi设置静态IP

ifconfig查看网络接口:

此处选择wlan0

编辑/etc/network/interfaces

修改或添加以下内容:

auto wlan0
 iface wlan0 inet manual
 wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

注意不能写成iface wlan0 inet dhcp,否则dhcpcd不会生效。

编辑/etc/dhcpcd.conf

在文件末尾添加以下内容:

interface wlan0
 static ip_address=192.168.1.100/24
 static routers=192.168.1.1
 static domain_name_servers=192.168.1.1

修改wlan0为你的网络接口,ip_address为你的IP地址,routers为你的网关,domain_name_servers为你的dns。

完成后重启系统即可。

上一篇
下一篇