OpenWrt Forum Archive

Topic: List associated wireless clients?

The content of this topic has been archived on 21 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I've searched this forum and Google but I can't figure out how to ---> List the wireless clients that are currently associated with my access point (ASUS WL-500G Premium V2). 

As a work around I am using the /var/dhcp.leases file but that is really just showing me the clients that requested an IP lease (wired and wireless).  I need to see the wireless clients associated with the AP.

I found these suggestions in the forum, but I don't think they apply to my router.  I do not have these commands.

For atheros: wlanconfig athX list sta
For mac80211: iw wlan0 station dump

# dmesg | grep -i 802.11
wl0: Broadcom BCM4318 802.11 Wireless Controller 4.150.10.5

Any hints???

wl assoclist ?

Broadcom proprietary: wl assoclist + wl sta_info macaddr
Atheros proprietary: wlaconfig ath0 list sta
mac80211: iw dev wlan0 station dump

@obsy & @jow - Thanks, I was missing the 'wl' package.

Works great now.  I can even lookup the dhcp client name (if sent by the client)

root@GuestAP:~#  wl sta_info `wl assoclist | awk '{print $2}'` && grep -i `wl assoclist | awk '{print $2}'` /var/dhcp.leases | awk '{print "\t DHCP IP:"$3"  DHCP NAME:"$4}'    
 STA 00:23:6C:99:99:99:
     rateset [ 1 2 5.5 6 9 11 12 18 24 36 48 54 ]
     idle 0 seconds
     in network 32542 seconds
     state: AUTHENTICATED ASSOCIATED
     flags 0x1b: BRCM WME
     DHCP IP:10.10.10.153  DHCP NAME:parkers_macbook

One step further... A quick bash script to list associated clients.

#! /bin/ash
for x in `wl assoclist | awk '{print $2}'`
do
 echo "------------------------------------------------------"
 wl sta_info $x
 echo -e "\t ---"
 grep $x /proc/net/arp | awk '{print "\t IP: "$1" (from ARP table)"}'
 grep -i $x /var/dhcp.leases | awk '{print "\t IP: "$3" (from DHCP Lease)\n\t NAME: "$4" (from DHCP Lease)"}'
done
 echo "------------------------------------------------------"

Gives me output like this...

root@GuestAP:/usr/sbin# ./check-wifi-assoc.sh 
------------------------------------------------------
 STA 00:14:51:88:88:88:
     rateset [ 1 2 5.5 6 9 11 12 18 24 36 48 54 ]
     idle 1 seconds
     in network 671 seconds
     state: AUTHENTICATED ASSOCIATED
     flags 0x18:
     ---
     IP: 10.10.10.5 (from ARP table)  <---someone connected without DHCP
------------------------------------------------------
 STA 00:23:6C:99:99:99:
     rateset [ 1 2 5.5 6 9 11 12 18 24 36 48 54 ]
     idle 0 seconds
     in network 36177 seconds
     state: AUTHENTICATED ASSOCIATED
     flags 0x1b: BRCM WME
     ---
     IP: 10.10.10.153 (from ARP table)  <---someone connected with DHCP
     IP: 10.10.10.153 (from DHCP Lease) <---so we have DHCP IP
     NAME: parkers_macbook (from DHCP Lease) <---and DHCP Name
------------------------------------------------------

The discussion might have continued from here.