Wi-Fi signal strength in OpenWRT

7,651

Solution 1

Yes, it’s quite simple, actually: iw dev wlan0 station dump. Here’s the relevant documentation..

Some guy on OpenWrt’s forums made a script that lists associated stations and also looks up IP addresses and host names for these stations. I adapted it to use iw instead of the outdated wl command:

#! /bin/ash
ifaces="wlan0 wlan1"

for iface in $ifaces
do
  echo $iface
  stations=`iw dev $iface station dump | grep Station | awk '{print $2}'`

  for sta in $stations
  do
    echo "------------------------------------------------------"
    iw dev $iface station get $sta
    echo -e "\t ---"
    grep $sta /proc/net/arp | awk '{print "\t IP: "$1" (from ARP table)"}'
    grep -i $sta /var/dhcp.leases | awk '{print "\t IP: "$3" (from DHCP Lease)\n\t NAME: "$4" (from DHCP Lease)"}'
  done
  echo "------------------------------------------------------"
done

Please note that my router has two wireless NICs, which your router may not have. Adjust the ifaces variable accordingly.

Solution 2

I'm using my OpenWRT router as a repeater and I used Daniel's post to write this script to keep updating me on the WiFi signal strength of my already connected base station while setting up my antenna line of sight. (use Ctrl+c to stop execution)

#!/bin/bash
iface="wlan0"
while true
do
    clear
    iw dev $iface station dump | grep 'signal:\|beacon signal'
    let "x++"
    echo Read Count: $x
    sleep 1
done
Share:
7,651

Related videos on Youtube

megha
Author by

megha

Updated on September 18, 2022

Comments

  • megha
    megha over 1 year

    Is there a way to retrieve signal strengths on all the devices connected in a wireless network in OpenWRT? I want to check signal strength of devices connected to the router. My router has OpenWRT kernel.