2014/09/29

Setting raspberry pi network

1. Use wpa_cli command connect to ssid


打這個 command 進入 wpa command line interface, (提示符號會變成 ">")

$ wpa_cli

掃瞄目前的wifi訊號, 並且列出結果
> scan
OK
> scan_result
bssid / frequency / signal level / flags / ssid
e4:71:85:04:98:f4       2442    100     [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][ESS]    Almond-0326_nomap_5F-7
<3>CTRL-EVENT-SCAN-RESULTS

加入網路ssid, psk是密碼
> add_network
0
> set_network 0 ssid "MYSSID"
> set_network 0 psk "passphrase"
> enable_network 0
<2>CTRL-EVENT-CONNECTED - Connection to 00:00:00:00:00:00 completed (reauth) [id=0 id_str=]

如果是open network
> set_network 0 key_mgmt NONE

把config存起來
> save_config
OK

這些動作會存在
/etc/wpa_supplicant/wpa_supplicant.conf

其它常用的command

status (看看目前的狀態)
help (查看參數與指令)
terminate (關閉wpa_supplicant)
interface (查看有那些無線網卡介面)
list_networks (查看wpa_supplicant.conf檔裡的設定)
select_network (選擇不同的AP,id為AP代號0,1,2,3...)
enable_network 
disable_network 
remove_network (刪除AP資訊)
reconfigure (重新讀取wpa_supplicant.conf設定內容)
save_config (儲存寫入到wpa_supplicant.conf中,否責變更無效)
disconnect (斷線)
reconnect (重新連線)
scan (掃描附近的AP)
scan_results (印出附近AP的相關資訊)


2. search raspberry pi in subnet


用nmap就可以掃, 在windows底下要安裝

假如電腦的ip是 192.168.1.100/24
那麼就下這個command
nmap -sn 192.168.1.0/24

掃出來的結果裡, 可能有
Starting Nmap 6.40 ( http://nmap.org ) at 2014-03-10 12:46 GMT
Nmap scan report for hpprinter (192.168.1.2)
Host is up (0.00044s latency).
Nmap scan report for Gordons-MBP (192.168.1.4)
Host is up (0.0010s latency).
Nmap scan report for ubuntu (192.168.1.5)
Host is up (0.0010s latency).
Nmap scan report for raspberrypi (192.168.1.8)
Host is up (0.0030s latency).
Nmap done: 256 IP addresses (4 hosts up) scanned in 2.41 seconds

可以看到裡面有raspberrypi

沒有留言:

張貼留言