Querying Connected WiFi Clients in OpenWrt 10.03: CLI and LUCI Methods


3 views

When administering an OpenWrt 10.03 router, monitoring connected wireless clients is crucial for both security and network management. The stable 10.03 "Backfire" release provides several reliable methods to achieve this.

The most straightforward approach is through the iwinfo utility. SSH into your router and execute:

iwinfo wlan0 assoclist

Replace wlan0 with your actual wireless interface name if different. This returns output like:

Assoclist XX:XX:XX:XX:XX:XX
    signal: -67 dBm
    rx rate: 300000 kbit/s, 40MHz
    tx rate: 300000 kbit/s

For more detailed information, use the wl command (Broadcom chipsets) or iw command (Atheros):

wl assoclist
# or
iw dev wlan0 station dump

To correlate MAC addresses with IP assignments:

cat /tmp/dhcp.leases | awk '{print $2,$3,$4}'

This outputs active leases in the format:

XX:XX:XX:XX:XX:XX 192.168.1.100 hostname

Create a monitoring script (/usr/bin/wificlients):

#!/bin/sh
echo "Active WiFi Clients:"
iwinfo wlan0 assoclist | awk '/Assoclist/ {print $2}'
echo "\nDHCP Assignments:"
cat /tmp/dhcp.leases | awk '{print $2" - "$3" ("$4")"}'

Make it executable:

chmod +x /usr/bin/wificlients

For GUI users:

  1. Navigate to Status → Wireless
  2. The "Associated Stations" section shows connected devices
  3. Click "Scan" to refresh the list in real-time

In OpenWrt 10.03, the most straightforward way to list connected WiFi clients is through the iw command. This method provides MAC addresses and signal strength information:

iw dev wlan0 station dump

Replace wlan0 with your actual wireless interface name, which you can find using:

iwconfig

If your OpenWrt installation has the Luci web interface enabled:

  1. Access the web interface at http://[router-ip]
  2. Navigate to Status > Wireless
  3. Connected clients are displayed with their MAC addresses, IP addresses, and connection statistics

For a list that includes IP addresses (though not exclusively wireless clients):

cat /tmp/dhcp.leases

This outputs a formatted list containing:

lease_time mac_address ip_address hostname

Here's a Bash script to monitor connected WiFi clients periodically:

#!/bin/sh

INTERFACE="wlan0"
LOG_FILE="/var/log/wifi_clients.log"

while true; do
    TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
    echo "=== Scan at $TIMESTAMP ===" >> $LOG_FILE
    iw dev $INTERFACE station dump >> $LOG_FILE
    sleep 300
done

For enterprise monitoring, you can use SNMP (if SNMP is configured):

snmpwalk -v2c -c public localhost .1.3.6.1.2.1.2.2.1.1