Source : 博客來
這又燃起我心中的 maker 烈火. 找出塵封已久的 Raspberry Pi Type B 主板, 將 SD 卡中當初賣家幫我灌的 NOOBS 格式化掉, 然後去官網下載最新版的 NOOBS v1.9.0 (Kernel 4.1.19 #850, 2016-03-18), 將 ZIP 檔解開後直接在 PC 中複製進去 SD 卡即可, 不用像以前那樣需用 Win32 Disk Imager 去燒錄. 參考 :
# 樹苺派的 SD 卡與作業系統安裝
作業系統裝入 SD 卡後放進樹莓派裡, 開機即會自動進行安裝. 無線上網部分我按照這本書的 3-3 節說明, 先關電源插入以前那顆可用的 Edimax N8508 無線網卡再重開機, 結果竟然一直都只顯示 IPv6 位址, 沒顯示 IPv4 位址. 第二天早上想要繼續時發現網卡非常燙, 於是關機拔出, 發現溫度高到會燙人! 我想這顆應該毀了. 只好拿出迅捷 FW150US 這顆 CP 值頗高的中國製網卡來用, 但是這顆樹莓派沒支援, 必須自己安裝驅動程式, 參考葉難這篇 :
# Raspberry Pi:USB無線網卡迅捷FW150US
但是文中所說的驅動程式已無法下載, 我又找到下面這篇 :
# Raspberry Pi無線網卡設定(rtl8188eu)
但是同樣不能用, 因為新版的 NOOBS 的 Kernel 是 4.1.19 版. 後來終於在下面這篇找到明確的解決辦法 :
# Raspberry Pi – Driver for RTL8179/8188EU
此文中與 Linux 4.1.19 版相應的 8188eu 驅動程式是 20160305 發布的這一版, 只要以下面這五個指令即可順利安裝驅動程式 :
wget https://dl.dropboxusercontent.com/u/80256631/8188eu-20160305.tar.gz
tar -zxvf 8188eu-20160305.tar.gz
sudo install -p -m 644 8188eu.ko /lib/modules/$(uname -r)/kernel/drivers/net/wireless
sudo insmod /lib/modules/$(uname -r)/kernel/drivers/net/wireless/8188eu.ko
sudo depmod -a
https://dl.dropboxusercontent.com/u/80256631/8188eu-20160305.tar.gz
wget https://www.dropbox.com/s/vs6f0w7fkkjhu2s/8188eu-20160305.tar.gz?dl=0
我先用乙太網上網, 依序執行上面五個指令來下載並安裝驅動, 執行紀錄如下 :
login as: pi
pi@192.168.2.104's password: (預設是 raspberry)
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Mar 29 19:25:40 2016
pi@raspberrypi:~ $ ifconfig (只看到乙太網卡的 192.168.2.104)
eth0 Link encap:Ethernet HWaddr b8:27:eb:97:b6:52
inet addr:192.168.2.104 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::873a:49c1:5be0:24db/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:77 errors:0 dropped:0 overruns:0 frame:0
TX packets:95 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7749 (7.5 KiB) TX bytes:15196 (14.8 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:200 errors:0 dropped:0 overruns:0 frame:0
TX packets:200 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:16656 (16.2 KiB) TX bytes:16656 (16.2 KiB)
pi@raspberrypi:~ $ lsusb (查看 USB 裝置 : 還讀不到網卡)
Bus 001 Device 004: ID 0c45:7403 Microdia Foot Switch
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. LAN9500 Ethernet 10 /100 Adapter / SMSC9512/9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@raspberrypi:~ $ uname -a (顯示 Linux 版本)
Linux raspberrypi 4.1.19+ #858 Tue Mar 15 15:52:03 GMT 2016 armv6l GNU/Linux
pi@raspberrypi:~ $ wget https://dl.dropboxusercontent.com/u/80256631/8188eu-20160305.tar.gz (下載驅動程式) --2016-03-29 19:44:43-- https://dl.dropboxusercontent.com/u/80256631/8188eu-20160305.tar.gz
Resolving dl.dropboxusercontent.com (dl.dropboxusercontent.com)... 108.160.172.5
Connecting to dl.dropboxusercontent.com (dl.dropboxusercontent.com)|108.160.172.5|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 411563 (402K) [application/octet-stream]
Saving to: ‘8188eu-20160305.tar.gz’
8188eu-20160305.tar.gz 100%[==============================================================================>] 401.92K 538KB/s in 0.7s
2016-03-29 19:44:56 (538 KB/s) - ‘8188eu-20160305.tar.gz’ saved [411563/411563]
pi@raspberrypi:~ $ tar -zxvf 8188eu-20160305.tar.gz (解壓縮)
8188eu.ko
8188eu.conf
install.sh
pi@raspberrypi:~ $ sudo install -p -m 644 8188eu.ko /lib/modules/$(uname -r)/kernel/drivers/net/wireless (安裝驅動程式)
pi@raspberrypi:~ $ sudo insmod /lib/modules/$(uname -r)/kernel/drivers/net/wireless/8188eu.ko (安裝驅動程式)
pi@raspberrypi:~ $ sudo depmod -a
pi@raspberrypi:~ $
哈哈! 沒有錯誤訊息, 這樣驅動程式就安裝成功了! 接下來必須修改網路介面設定檔 /etc/network/interfaces, 加入無線分享器的登入資訊, 用 nano 編輯此檔 :
pi@raspberrypi:~ $ sudo nano /etc/network/interfaces
編輯內容如下, 重點是 SSID 與連線密碼 :
auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "無線分享器 SSID"
wpa-psk "無線分享器連線密碼"
login as: pi
pi@192.168.2.104's password:
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Mar 29 19:48:33 2016
pi@raspberrypi:~ $ lsusb (顯示 USB 裝置)
Bus 001 Device 005: ID 0bda:8179 Realtek Semiconductor Corp. (有讀到無線網卡了)
Bus 001 Device 004: ID 0c45:7403 Microdia Foot Switch
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. LAN9500 Ethernet 10 /100 Adapter / SMSC9512/9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@raspberrypi:~ $ ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:eb:97:b6:52
inet addr:192.168.2.104 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::873a:49c1:5be0:24db/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:117 errors:0 dropped:0 overruns:0 frame:0
TX packets:123 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:11528 (11.2 KiB) TX bytes:19569 (19.1 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 08:57:00:16:88:0c
inet addr:192.168.2.105 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::a57:ff:fe16:880c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:117 errors:0 dropped:57 overruns:0 frame:0
TX packets:104 errors:0 dropped:1 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:23031 (22.4 KiB) TX bytes:17043 (16.6 KiB)
pi@raspberrypi:~ $
可見有讀到無線網卡了, 其 IP 是 912.168.2.105, 在同網域另外一台電腦 ping 這個無線網卡所獲得的 IP 有回應了 :
C:\Users\petertw89>ping 192.168.2.105
Ping 192.168.2.105 (使用 32 位元組的資料):
回覆自 192.168.2.105: 位元組=32 時間=49ms TTL=64
回覆自 192.168.2.105: 位元組=32 時間=1ms TTL=64
回覆自 192.168.2.105: 位元組=32 時間=1ms TTL=64
回覆自 192.168.2.105: 位元組=32 時間=1ms TTL=64
192.168.2.105 的 Ping 統計資料:
封包: 已傳送 = 4,已收到 = 4, 已遺失 = 0 (0% 遺失),
大約的來回時間 (毫秒):
最小值 = 1ms,最大值 = 49ms,平均 = 13ms
如果於同網域 PC 再開啟一個 putty 視窗, 連線此無線網卡的 IP, 同樣可以連線 :
login as: pi
pi@192.168.2.105's password:
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Mar 29 19:50:57 2016 from 192.168.2.110
pi@raspberrypi:~ $
使用 sudo iwlist wlan0 scan 指令可以掃描附近有哪些無線基地台 :
pi@raspberrypi:~ $ sudo iwlist wlan0 scan
wlan0 Scan completed :
Cell 01 - Address: 80:1F:02:2D:5A:XX
ESSID:"EDIMAX-tony"
Protocol:IEEE 802.11bgn
Mode:Master
Frequency:2.462 GHz (Channel 11)
Encryption key:on
Bit Rates:108 Mb/s
Extra:wpa_ie=dd160050f20101000050f20201000050f20201000050f202
IE: WPA Version 1
Group Cipher : TKIP
Pairwise Ciphers (1) : TKIP
Authentication Suites (1) : PSK
Extra:rsn_ie=30180100000fac020200000fac02000fac040100000fac020000
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : TKIP
Pairwise Ciphers (2) : TKIP CCMP
Authentication Suites (1) : PSK
IE: Unknown: DD7F0050F204104A0001101044000101103B0001031047001063041253101920061228801F022D5A9E102100001023000752544C387878781024000D45562D323030392D30322D30361042000F3132333435363738393031323334371054000800060050F20400011011000F576972656C65737320526F75746572100800020086
Quality=2/100 Signal level=34/100
Cell 02 - Address: E8:DE:27:60:1A:XX
ESSID:"TP-LINK_601A04"
Protocol:IEEE 802.11bgn
Mode:Master
Frequency:2.412 GHz (Channel 1)
Encryption key:on
Bit Rates:300 Mb/s
Extra:wpa_ie=dd160050f20101000050f20401000050f20401000050f202
IE: WPA Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
Extra:rsn_ie=30140100000fac040100000fac040100000fac020000
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
IE: Unknown: DDA50050F204104A0001101044000102103B00010310470010000102030405060708090A0B0C0D0E0F1021000754502D4C494E4B10230014544C2D57523934304E2F544C2D57523934314E4410240003352E3010420003312E301054000800060050F20400011011001A576972656C65737320526F7574657220544C2D57523934314E44100800020086103C000101104900140024E26002000101600000020001600100020001
Quality:0 Signal level:0 Noise level:0
Cell 03 - Address: 74:DA:38:15:16:XX
ESSID:"edimax.setup"
Protocol:IEEE 802.11bg
Mode:Master
Frequency:2.457 GHz (Channel 10)
Encryption key:on
Bit Rates:54 Mb/s
Extra:wpa_ie=dd160050f20101000050f20201000050f20201000050f202
IE: WPA Version 1
Group Cipher : TKIP
Pairwise Ciphers (1) : TKIP
Authentication Suites (1) : PSK
Quality:0 Signal level:0 Noise level:0
Cell 04 - Address: 9C:D6:43:65:28:XX
ESSID:"CHT Wi-Fi(HiNet)"
Protocol:IEEE 802.11bgn
Mode:Master
Frequency:2.457 GHz (Channel 10)
Encryption key:off
Bit Rates:144 Mb/s
Quality:0 Signal level:0 Noise level:0
這樣就完成迅捷 FW150US 網卡驅動程式安裝, 可以拔掉乙太網線了.
參考 :
# [基礎] 命令列設置無線網路
# Raspberry Pi 的基礎 - 使用 Wi-Fi 無線網卡連上網路
# Problem wpa_supplicant rapsberry pi 2
# 使用no-ip申請域名讓浮動IP也能架設網站
# 1.4 有線 或 無線 的DHCP 設定或固定IP設定 (學習樹苺派)
# 在 Windows 設置 Raspberry Pi (樹莓派) 遠端編輯環境
# 使用no-ip申請域名讓浮動IP也能架設網站
# 如何在無線路由器上設定 DDNS(DynDNS)
# 社區網路 DDNS 無解問題
# NOIP申請完,架設FTP
沒有留言:
張貼留言