1.设置无线网卡:
#sudo nano /etc/network/interfaces
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopbackiface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
# sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="603"
psk="6666--3333"
key_mgmt=WPA-PSK
priority=2
}
network={
ssid="6032"
psk="6666--3333"
key_mgmt=WPA-PSK
priority=1
}
If a wpa_supplicant.conf
file is placed into the /boot/
directory, this will be moved to the /etc/wpa_supplicant/
directory the next time the system is booted, overwriting the network settings; this allows a Wifi configuration to be preloaded onto a card from a Windows or other machine that can only see the boot partition.
意思简单来说呢就是把配置好的 wpa_supplicant.conf
文件放在 boot 分区(烧录SD卡完后,在Windows 中只能看见一个 boot 分区),那么启动树莓派的时候会自动连接上WiFi