How do I get a list of the connected wifi clients in OpenWrt 10.03?

I'm looking to be able to view the connected clients within the OpenWrt 10.03 software.


Solution 1:

Like explained here - OpenWrt logging: how to find out "wifi deauthentication" - it depends on the wireless driver you're using.

  • iw dev wlan0 station dump --> for nl80211/mac80211 compatible drivers
  • wlc assoclist --> for proprietary broadcom-wl driver

In case of iw you naturally need to replace wlan0 with the interface that has hostapd (AP daemon) running on it.


Update

We're about to see 15.05.1 soon and since quite a few releases ago there is also libiwinfo: a great little abstraction layer to all major backend interfaces (currently Broadcom, Madwifi, nl80211 and wext). This is now the recommended way of getting information from the wireless subsystem.

It comes with a command-line utility (package iwinfo):

iwinfo wlan0 assoclist

There's also Lua bindings (package libiwinfo-lua) if you're scripting:

require("iwinfo")
iface = "wlan0"
t = iwinfo.type(iface)
clients = iwinfo[t].assoclist(iface)
for k,v in pairs(clients) do print(k, v.signal) end
--> 00:xx:xx:xx:xx:xx   -44
--> 0A:xx:xx:xx:xx:xx   -67
--> ....

There is even an ubus interface to iwinfo if you're up to something clever (package rpcd, docs).