手上有2B,也刚好有个3B的板载无线没反应坏掉了,就学如何安装USB 无线网卡
EDUP EP-8508GS
确认你的Kernel支持那些无线网卡:这款是我的网卡 realtek/rtl818x/rtl8187/rtl8187.ko
$ find /lib/modules/`uname -r`/kernel/drivers/net/wireless -name "*.ko"
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/ath/ath9k/ath9k_common.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/ath/ath9k/ath9k_htc.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/ath/ath9k/ath9k_hw.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/ath/ath9k/ath9k.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/ath/ath6kl/ath6kl_core.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/ath/ath6kl/ath6kl_usb.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/ath/ar5523/ar5523.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/ath/carl9170/carl9170.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/ath/ath.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/broadcom/brcm80211/brcmutil/brcmutil.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/broadcom/b43legacy/b43legacy.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/broadcom/b43/b43.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/mac80211_hwsim.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/marvell/libertas_tf/libertas_tf_usb.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/marvell/libertas_tf/libertas_tf.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/marvell/libertas/libertas.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/marvell/libertas/libertas_sdio.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/marvell/libertas/usb8xxx.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/marvell/mwifiex/mwifiex.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/marvell/mwifiex/mwifiex_sdio.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/mediatek/mt7601u/mt7601u.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/zydas/zd1201.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/zydas/zd1211rw/zd1211rw.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/rndis_wlan.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/intersil/hostap/hostap.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/intersil/p54/p54common.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/intersil/p54/p54usb.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/atmel/at76c50x-usb.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8187.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/realtek/rtl8192cu/8192cu.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/realtek/rtlwifi/rtlwifi.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/realtek/rtlwifi/rtl8192c/rtl8192c-common.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/realtek/rtlwifi/rtl_usb.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rtl8192cu.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/ralink/rt2x00/rt2800usb.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/ralink/rt2x00/rt2x00usb.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/ralink/rt2x00/rt73usb.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/ralink/rt2x00/rt2x00lib.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/ralink/rt2x00/rt2500usb.ko
/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/ralink/rt2x00/rt2800lib.ko
查看识别的usb设备:
sudo lsusb
Bus 001 Device 005: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
第一行的Realtek设备就是无线网卡.
查看Kernel载入的模块:
命令:lsmod
Module Size Used by
bluetooth 365780 0
fuse 99603 3
8192cu 582281 0
sudo nano /etc/network/interfaces
# wifi (dhcp config) :
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
sudo nano/etc/wpa_supplicant/wpa_supplicant.conf
, 增加如下几行:
network={
ssid=“WIFI名称“
proto=WPA2
key_mgmt=WPA-PSK
pairwise=TKIP
group=TKIP
psk=”WIFI密码“
}
这里存的是明文密码, 如果需要存储加密后的密码, 执行命令wpa_passphrase ssid password
, 替换上面的psk密码.
wpa_supplicant.conf里面更多参数详情, 请参考man手册链接, 上面的配置能应付大多数路由器了.
重启无线网卡: sudo ifdown wlan0(关闭)
sudo ifup wlan0(启动)
然后运行ifconfig wlan0
查看无线网卡是否获能够取到了IP.
安装完成之后,创建一个配置文件,输入如下命令:
$ sudo nano /etc/wpa.conf
将下列内容复制进去:
network={
ssid="你用的WIFI的SSID"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="WIFI的密码"
}
接下来编辑网络配置文件:
sudo nano /etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa.conf <---增加此行
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf <---注释掉此行
iface default inet dhcp
保存,退出。
重启树莓派,记得拔掉网线,它将自动连上无线网络。
之后,若要换无线网,只需要编辑/etc/wpa.conf中的ssid和psk即可。