记录命令行操作树莓派Wifi的方式
打开WiFi
rfkill unblock wlan
关闭WiFi
rfkill block wlan
设置可连接的WiFi
方法一(bullseye及以前版本才可用,bookworm版本)
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid="wifi_name"
psk="wifi_password"
key_mgmt=WPA-PSK
priority=4
}
其中,
wifi_name:WiFi名;
wifi_password:WiFi密码;
key_mgmt:加密方式;
priority:连接优先级,越小优先级越高,0最小;
方法二(无意中发现bookworm连WIfi会生成的文件,没尝试过)
cd /etc/NetworkManager/system-connections
vi wifi_name.nmconnection
[connection]
id=wifi_name
uuid=这个选项不清楚怎么得到
type=wifi
interface-name=wlan0
[wifi]
mode=infrastructure
ssid=wifi_name
[wifi-security]
auth-alg=open
key-mgmt=wpa-psk
psk=wifi_password
[ipv4]
method=auto
[ipv6]
addr-gen-mode=default
method=auto