答案1
iwlist
和是无线工具的一部分iwconfig
,现已弃用。
您可以列出您的设备iw dev
使用 WiFi 站时,您可以获取当前链接的 RSSI 值,如下所示(wlan0 是通常的默认 Wi-Fi 设备,但取决于驱动程序和配置):
$ iw dev wlan0 link
Connected to 9c:4e:20:c8:ee:9e (on wlan0)
SSID: CORP1
freq: 5240
RX: 7306266 bytes (6124 packets)
TX: 776491 bytes (4117 packets)
signal: -75 dBm
tx bitrate: 39.0 MBit/s MCS 4
列出可用的 WiFi 信号:
$ ip link set wlan0 up
$ iw dev wlan0 scan
...
BSS 9c:4e:20:c8:ee:9d(on wlan0)
TSF: 0 usec (0d, 00:00:00)
freq: 5240
beacon interval: 102 TUs
capability: ESS Privacy RadioMeasure (0x1011)
signal: -75.00 dBm
last seen: 765 ms ago
SSID: CORP1
...
答案2
您可以使用 2 个命令来获取 RSSI 值。
您可以先cat /proc/net/wireless
在那里提交并获取结果。这两种方法中使用的资源最少
$ /bin/cat /proc/net/wireless
Inter-| sta-| Quality | Discarded packets | Missed | WE
face | tus | link level noise | nwid crypt frag retry misc | beacon | 22
wlo1: 0000 70. -31. -256 0 0 0 0 25 0
另一种选择是使用iwconfig/iwlist
(我的无线接口是wlo1,因此替换为适当的接口名称)
$ /sbin/iwconfig wlo1
wlo1 IEEE 802.11 ESSID:"COD PUBLIC WIRELESS"
Mode:Managed Frequency:5.745 GHz Access Point: 40:E3:D6:63:BC:B0
Bit Rate=866.7 Mb/s Tx-Power=22 dBm
Retry short limit:7 RTS thr:off Fragment thr:off<br>
Power Management:on
Link Quality=67/70 Signal level=-43 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:27 Missed beacon:0
$ iwlist wlo1 scanning
wlo1 Scan completed :
Cell 01 - Address: 40:E3:D6:63:BC:B0
Channel:149
Frequency:5.745 GHz
Quality=70/70 Signal level=-38 dBm
Encryption key:off
ESSID:"COD PUBLIC WIRELESS"
Bit Rates:12 Mb/s; 24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
Mode:Master
Extra:tsf=00000075dccaa121
Extra: Last beacon: 81624ms ago
IE: Unknown: 0013434F44205055424C494320574952454C455353
IE: Unknown: 010598B048606C
IE: Unknown: 030195
IE: Unknown: 2D1AEF091BFFFFFFFF00000000000000000000000000000000000000
IE: Unknown: 3D1695050400000000000000000000000000000000000000
IE: Unknown: 4A0E14000A002C01C800140005001900
IE: Unknown: 7F080100080000000040
IE: Unknown: BF0CB1798B33AAFF0000AAFF0000
IE: Unknown: C005019B000000
IE: Unknown: DD180050F2020101800003A4000027A4000042435E0062322F00