為了省事蓬衡,我買了EP-N8508GS無線網(wǎng)卡寇钉,因為能面去編譯驅(qū)動的麻煩。
測試驅(qū)動
確認你的Kernel支持那些無線網(wǎng)卡:
$ find /lib/modules/`uname -r`/kernel/drivers/net/wireless -name "*.ko"
/lib/modules/3.12.35+/kernel/drivers/net/wireless/rtl8192cu/8192cu.ko
/lib/modules/3.12.35+/kernel/drivers/net/wireless/rtl818x/rtl8187/rtl8187.ko
查看識別的usb設備:
pi@raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
注意最后一行的Realtek設備就是無線網(wǎng)卡.
查看Kernel載入的模塊:
$ lsmod
8192cu 550797 0
leds_gpio 2079 0
led_class 4118 1 leds_gpio
上面的8192cu就是我的無線網(wǎng)卡的芯片型號.
執(zhí)行命令: sudo iwlist wlan0 scan
, 看看能否手動掃描周圍的ESSID.
無線配置
修改配置文件: sudo vim /etc/network/interfaces
, 如果需要自動IP, 增加如下:
# wifi (dhcp config) :
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
如果需要固定IP, 增加的內(nèi)容如下:
auto wlan0
iface wlan0 inet static
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
address 192.168.1.12
netmask 255.255.255.0
gateway 192.168.1.1
編輯/etc/wpa_supplicant/wpa_supplicant.conf
, 增加如下幾行:
network={
ssid="ssid1"
psk="密碼"
}
network={
ssid="ssid2"
psk="密碼"
}
這里存的是明文密碼, 如果需要存儲加密后的密碼, 執(zhí)行命令wpa_passphrase ssid password
, 替換上面的psk密碼.
wpa_supplicant.conf里面更多參數(shù)詳情, 請參考man手冊鏈接, 上面的配置能應付大多數(shù)路由器了.
重啟wlam0
重啟無線網(wǎng)卡: sudo ifdown wlan0
and then sudo ifup wlan0
然后運行ifconfig wlan0
查看無線網(wǎng)卡是否獲能夠取到了IP.
DONE.