開啟終端機, 用 ifconfig 查詢網路介面, 只有 loopback (lo) 而已, 沒有 wlan0 :
pi@raspberrypi:~ $ ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 9 bytes 524 (524.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 9 bytes 524 (524.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
花了一整晚研究這問題, 測試了網上各種解決辦法都沒有效, 奇怪, Buster 在 Pi Zero W 上沒問題, 難道這是 P3 A+ 板子的問題? 我找到下面這篇台灣樹莓派論壇的教學文章, 說 2018 年新版 Raspbian 作業系統的無線網路設定檔 /etc/wpa_supplicant/wpa_supplicant.conf 中拿掉了 WiFi 的國家設定 :
# [教學] 啟用 Pi 3B+的WiFi
我檢視此檔原始內容只有兩行 :
pi@raspberrypi:~ $ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
切到最右邊 "在地化", 按 "設定 WiFi 國家", 在下拉式選單中選擇國家為台灣, 按確定即可 :
也可以在終端機下 sudo raspi-config 去設定 :
pi@raspberrypi:~ $ sudo raspi-config
選 "Localization Options" :
選 "Change WiFi Country" :
選擇 "TW Taiwan" 按確定即可 :
再次檢查 /etc/wpa_supplicant/wpa_supplicant.conf 就會出現國家設定了 :
pi@raspberrypi:~ $ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=TW
pi@raspberrypi:~ $ sudo cat /etc/network/interfaces
# 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.d
auto lo
iface lo inet loopback
要加上如下內容 :
allow-hotplug wlan0
auto wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
pi@raspberrypi:~ $ sudo cat /etc/network/interfaces
# 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.d
auto lo
iface lo inet loopback
allow-hotplug wlan0
auto wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
存檔後重開機就可以看到 wlan0 了, 可以在桌面右上角選取無線基地台, 設定 SSID 與密碼, 也可以參考下面這篇去修改無線網路設定檔 /etc/wpa_supplicant/wpa_supplicant.conf, 在 network 參數中加入 ssid 與 psk 密碼 :
# Raspberry Pi 3 'No Wireless Interface Found'
pi@raspberrypi:~ $ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=TW
network={
ssid="TonyNote8"
psk="123456"
}
# [教學] 啟用 Pi 3B+的WiFi
# RPI 3 B+ No wireless interfaces found
# Raspberry Pi 的基礎 - 使用 Wi-Fi 無線網卡連上網路
# Raspberry Pi Wi-Fi & Bluetooth Setup - How to Configure your Pi 4 Model B, 3 Model B and 3 Model B+ Connectivity
沒有留言:
張貼留言