安裝USB無線網卡
執行lsub確認Raspberry Pi已經抓到USB無線網路卡。範例為Buffalo WLI-UC-GNM無線網卡。
> lsusb
執行結果:
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.確實抓到網卡(Ralink RT8070相容驅動程式)。
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 0411:01a2 BUFFALO INC. (formerly MelCo., Inc.) WLI-UC-GNM Wireless LAN Adapter [Ralink RT8070]
編輯網路介面設定檔案
> vi /etc/network/interfaces
auto lo iface lo inet loopback # 設定Ethernet網卡以DHCP取得IP iface eth0 inet dhcp # 設定Ethernet網卡以DHCP取得IP allow-hotplug wlan0 iface wlan0 inet dhcp # 強制網卡以WPA2方式與Wi-Fi AP連線 wpa 2 # 設定Wi-Fi AP 之SSID與密碼 wpa-ssid <<YOUR_SSID>> wpa-psk <<YOUR_WPA2_PSK_PASSWORD>>
重新啟動networking
> service networking restart
確認網卡已配置IP
> ifconfig -a
wlan0 Link encap:Ethernet HWaddr 10:6f:00:00:00:00
inet addr:192.168.1.7 Bcast:192.168.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3458 errors:0 dropped:0 overruns:0 frame:0
TX packets:2583 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:602575 (588.4 KiB) TX bytes:1077331 (1.0 MiB)
已經配置 192.168.1.7 給 wlan0 無線網卡介面
#