如果有人开始使用 wifi,我可以通过 logread 看到:
Jan 23 21:04:47 router daemon.info hostapd: wlan0: STA XX:XX:XX:XX:XX:XX IEEE 802.11: authenticated
但我怎么才能看到他/她断开了连接?logread 中没有“bla-bla deauthenticated bla”行,甚至没有指向某人断开连接的内容。
我尝试谷歌搜索:
http://wiki.openwrt.org/doc/uci/system
但它没有写日志级别。
有人能帮我找出如何找出有人断开了路由器的 wifi 连接吗?当有人断开连接时,日志读取甚至没有写一行。
请帮忙!!这很重要!
谢谢!:\
答案1
您可以使用以下命令之一轮询关联客户端的列表:
iw dev wlan0 station dump
--> 对于nl80211/mac80211
兼容的驱动程序wlc assoclist
--> 对于专有broadcom-wl
驱动程序iwinfo wlan0 assoclist
--> 用于主干libiwinfo
中可用的抽象OpenWrt
从你的日志来看,hostapd
第一个应该有效。示例输出:
root@OpenWrt ~ # iw dev wlan0 station dump
Station 00:13:02:xx:xx:xx (on wlan0)
inactive time: 0 ms
rx bytes: 21835
rx packets: 152
tx bytes: 19772
tx packets: 100
tx retries: 6
tx failed: 0
signal: -43 dBm
signal avg: -44 dBm
tx bitrate: 36.0 MBit/s
此外,hostapd 还会报告断开连接(例如,如果从命令行运行 - 肯定有办法将其放入日志中):
root@OpenWrt ~ # hostapd -P /var/run/wifi-phy0.pid /var/run/hostapd-phy0.conf
Using interface wlan0 with hwaddr 94:0c:6d:xx:xx:xx and ssid 'marvin'
wlan0: STA 00:13:02:xx:xx:xx IEEE 802.11: authenticated
wlan0: STA 00:13:02:xx:xx:xx IEEE 802.11: associated (aid 1)
AP-STA-CONNECTED 00:13:02:xx:xx:xx
wlan0: STA 00:13:02:xx:xx:xx WPA: pairwise key handshake completed (RSN)
(...)
AP-STA-DISCONNECTED 00:13:02:xx:xx:xx
hostapd
或者,您也可以使用以下方法通过其控制插座进行连接wpa-cli
:
root@OpenWrt ~ # wpa_cli -p /var/run/hostapd-phy0
wpa_cli v0.8.x
Copyright (c) 2004-2010, Jouni Malinen <[email protected]> and contributors
This program is free software. You can distribute it and/or modify it
under the terms of the GNU General Public License version 2.
Alternatively, this software may be distributed under the terms of the
BSD license. See README and COPYING for more details.
Selected interface 'wlan0'
Interactive mode
>
(...here client connects...)
<3>AP-STA-CONNECTED 00:13:02:xx:xx:xx
(...and here disconnects...)
<3>AP-STA-DISCONNECTED 00:13:02:xx:xx:xx