生活随笔
收集整理的這篇文章主要介紹了
树莓派命令行配置无线网络和SSH远程登陆
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
無線網(wǎng)絡(luò)配置
查找可用的網(wǎng)絡(luò)
pi@raspberrypi:~ $
sudo iwlist wlan0 scanwlan0 Scan completed
: Cell 01 - Address: 9C:B2:B2:C9:AB:B6Channel:1Frequency:2.412 GHz
( Channel 1
) Quality
= 44/70 Signal level
= -66 dBm Encryption key:offESSID:
"CHEN-OPEN" Bit Rates:1 Mb/s
; 2 Mb/s
; 5.5 Mb/s
; 11 Mb/s
; 18 Mb/s24 Mb/s
; 36 Mb/s
; 54 Mb/sBit Rates:6 Mb/s
; 9 Mb/s
; 12 Mb/s
; 48 Mb/sMode:MasterExtra:tsf
= 0000000000000000Extra: Last beacon: 162520ms agoIE: Unknown: 00044348454EIE: Unknown: 010882848B962430486CIE: Unknown: 030101IE: Unknown: 2A0100IE: Unknown: 32040C121860IE: Unknown: 2D1A210017FF00000000000000000080010000000000000000000000IE: Unknown: 3D1601080400000000000000000000000000000000000000IE: Unknown: 7F080400008001000040IE: Unknown: DD1E00904C0408BF0C3250800FFEFF0000FEFF0000C0050001000000C3020002IE: Unknown: DD090010180201101C0000IE: Unknown: DD180050F2020101800003A4000027A4000042435E0062322F00Cell 02 - Address: 9C:3A:9A:82:CA:61Channel:3Frequency:2.422 GHz
( Channel 3
) Quality
= 39/70 Signal level
= -71 dBm Encryption key:onESSID:
"test-link" Bit Rates:1 Mb/s
; 2 Mb/s
; 5.5 Mb/s
; 11 Mb/s
; 6 Mb/s9 Mb/s
; 12 Mb/s
; 18 Mb/sBit Rates:24 Mb/s
; 36 Mb/s
; 48 Mb/s
; 54 Mb/sMode:MasterExtra:tsf
= 0000000000000000Extra: Last beacon: 100ms agoIE: Unknown: 00027366IE: Unknown: 010882848B960C121824IE: Unknown: 030103IE: Unknown: 050400010100IE: Unknown: 0706434E20010D1EIE: Unknown: 2A0100IE: Unknown: 32043048606CIE: Unknown: 2D1AAD011BFFFF0000000000000000000001000000000406E6A70C00IE: Unknown: 3D1603080400000000000000000000000000000000000000IE: Unknown: 4A0E14000A002C01C800140005001900IE: Unknown: 7F080100000000000040IE: Unknown: DD180050F2020101000003A4000027A4000042435E0062322F00IE: Unknown: DD0A02115A01020100000002IE: Unknown: DD0E02115A0101019C3A9A02CA610000IE: Unknown: DD0A02115A01030100000000IE: Unknown: DD0A02115A01040100000000IE: Unknown: DD0900037F01010000FF7FIE: WPA Version 1Group Cipher
: TKIPPairwise Ciphers
( 2
) : CCMP TKIPAuthentication Suites
( 1
) : PSKIE: IEEE 802.11i/WPA2 Version 1Group Cipher
: TKIPPairwise Ciphers
( 2
) : CCMP TKIPAuthentication Suites
( 1
) : PSK
修改配置文件
pi@raspberrypi:~ $
sudo vi /etc/wpa_supplicant/wpa_supplicant.conf
文件內(nèi)容為
country=GB ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1
如果連接連接開放網(wǎng)絡(luò),在文件末尾添加
network={ ssid=“CHEN-OPEN” key_mgmt=NONE }
如果連接連接加密網(wǎng)絡(luò),在文件末尾添加
network={ ssid=“test-link” key_mgmt=WPA-PSK psk=“12345678” }
查看連接是否成功 修改上述文件后,一般情況下會(huì)自動(dòng)進(jìn)行連接. 如果顯示IP地址則表示連接成功
pi@raspberrypi:~ $
ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr b8:27:eb:c6:a9:85 inet addr:192.168.43.59 Bcast:192.168.43.255 Mask:255.255.255.0inet6 addr: 2409:8920:610:d61:314e:7d16:36dd:1d36/64 Scope:Globalinet6 addr: fe80::ff30:bce8:b49d:b9a8/64 Scope:LinkUP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1RX packets:534 errors:0 dropped:0 overruns:0 frame:0TX packets:468 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000 RX bytes:43155
( 42.1 KiB
) TX bytes:113503
( 110.8 KiB
)
手動(dòng)連接 如果不顯示IP,則表示自動(dòng)連接不成功。此時(shí)可以手動(dòng)進(jìn)行連接,查看輸出的錯(cuò)誤詳情 (下面這個(gè)是成功情況下的回顯)
pi@raspberrypi:~ $
sudo wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -i wlan0Successfully initialized wpa_supplicant
ctrl_iface exists and seems to be
in use - cannot override it
Delete
'/var/run/wpa_supplicant/wlan0' manually
if it is not used anymore
Failed to initialize control interface
'DIR=/var/run/wpa_supplicant GROUP=netdev' .
You may have another wpa_supplicant process already running or the
file was
left by an unclean termination of wpa_supplicant
in which case you will need
to manually remove this
file before starting wpa_supplicant again.
SSH遠(yuǎn)程登陸配置
在sd卡的boot分區(qū)中添加空文件ssh即可
總結(jié)
以上是生活随笔 為你收集整理的树莓派命令行配置无线网络和SSH远程登陆 的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔 網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔 推薦給好友。