树莓派设置WIFI

启动设置WIFI

新建 wpa_supplicant.conf

1
2
3
4
5
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
ssid="路由名称"
psk="密码"
}

重启电脑

扫描WiFi

1
sudo iwlist wlan0 scan | grep ESSID

设置静态IP

编辑/etc/network/interfaces
sudo vi /etc/network/interfaces

找到allow-hotplug wlan0一栏
修改为

1
2
3
4
iface wlan0 inet static
address 192.168.0.118
gateway 192.168.0.1
netmask 255.255.255.0

注意,如果/etc/network/interfaces有如下提示:

1
2
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

需要在/etc/dhcpcd.conf配置静态IP

1
2
3
4
interface eth0
static ip_address=192.168.1.4/24 # /24表示掩码为 255.255.255.0
static routers=192.168.1.1
static domain_name_servers=114.114.114.114 114.114.115.115

本站采用「署名 4.0 国际」进行许可。