Real-Time Updating Dumb AP Associated Stations!

This method will update your Dumb AP devices hostnames in Real-Time!
No cronjob or whatsoever.

  • Run this SSH commands on your Main router:
mkdir /root/.ssh
dropbearkey -t rsa -f ~/.ssh/id_dropbear
  • Copy the full key (without Fingerprint) to the Dumb AP System > Administration > SSH-Keys

  • Run this command once on Main router to add it as trusted host (PuTTy) :

scp /tmp/dhcp.leases root@<dumb-ap-ip>:/tmp/dhcp.leases
  • Create script in /etc/hotplug.d/dhcp and chmod +x the file :

# cat /tmp/dhcp.leases | ssh <dumb-ap-ip> "cat > /tmp/dhcp.leases"
# scp /tmp/dhcp.leases root@<dumb-ap-ip>:/tmp/dhcp.leases

logger "File '/tmp/dhcp.leases' transferred from <main-router-ip> to <dump-ap-ip>"


  • You can use:
    cat /tmp/dhcp.leases | ssh <dumb ap ip> "cat > /tmp/dhcp.leases"
    scp /tmp/dhcp.leases root@<dumb ap ip>:/tmp/dhcp.leases
    Not both!
    Different command, same result.
    (Remove # where it's necessary)

  • Don't forget to edit <main-router-ip> and <dumb-ap-ip> .

Enjoy :slight_smile:


I was with you until

What command would that be?

chmod +x /etc/hotplug.d/dhcp/<scriptfilename>

To make the script file executable.

1 Like

From my point of view, this method has a few disadvantages.
All dhcp leases are displayed on the Dumb AP in the overview, including those that actually have nothing to do with the Dumb AP.
In addition, no information is displayed about hosts that are entered as static hosts in the dhcp configuration, but are statically entered on the host.
It would therefore make sense to also transfer the /etc/ethers to the Dumb AP and to filter out only those entries from the /tmp/dhcp.leases of the main router that really connected.

First transfer dhcp.leases from main router to dhcp.leases.all on Dumb AP.
Create an extended ethers file on main router, including ip adresses.
Transfer to Dumb-AP also.

# provice /etc/ethers for dumb-APs                                                                                                           
STATIC_DATE=$(date -r $STATIC +"%Y-%m-%d %H:%M:%S")                                                                                          
ETHERS_DATE=$(date -r $ETHERS +"%Y-%m-%d %H:%M:%S")                                                                                          
if [ "$STATIC_DATE" != "$ETHERS_DATE" ]; then                                                                                                
        # date of DHCP config is newer then processed file
        rm $ETHERS                                                                                                                           
        # process DHCP config line by line
        while IFS= read -r line || [ -n "$line" ]                                                                                            
                # echo "LINE: $line"                                                                                                         
                # get Key Value                                                                                                              
                KEY="$(echo ${line} | cut -d' ' -f2 )"                                                                                       
                if [ "$KEY" == "host" ]; then                                                                                                
                        VAL="$(echo ${line} | cut -d' ' -f3 | cut -d\' -f2 )"                                                                
                        if [ "$KEY" == "name" ]; then                                                                                        
                                if [ "$KEY" == "ip" ]; then                                                                                  
                                   if [ "$KEY" == "mac" ]; then                                                                              
                if [ "$NAM" != "" ] && [ "$MAC" != "" ] && [ "$IP" != "" ]; then                                                             
                        echo "$MAC $NAM $IP" >> $ETHERS                                                                                      
        done < $STATIC                                                                                                                       
        # set date of ethers file to date of DHCP config
        touch -d "$STATIC_DATE" $ETHERS                                                                                                      
        rm -f /tmp/scp_ethers.log                                                                                                                
        # tranfer newly created file to Dumb-AP's                                                                                            
        logger "transfer file '/tmp/ethers' to all Dumb-AP's"                                                                       
        scp .....

Finaly create a filtered /tmp/dhcp.leases on Dumb-AP


# Shows MAC, IP address and any hostname info for all connected wifi devices

rm -rf /tmp/dhcp.leases

# list all wireless network interfaces
# (for universal driver; see wiki article for alternative commands)
for interface in `iwinfo | grep ESSID | cut -f 1 -s -d" "`
  # for each interface, get mac addresses of connected stations/clients
  maclist=`iwinfo $interface assoclist | grep dBm | cut -f 1 -s -d" "`
  # for each mac address in that list...
  for mac in $maclist
    line="$(cat /tmp/dhcp.leases.all | grep -i $mac)"
    # ... show the mac address:
    if [ "$line" != "" ]; then
      echo "$line" >> /tmp/dhcp.leases
      # create dhcp like line for other devices  
      line="$(cat /tmp/ethers | grep -i $mac )"
      name="$(echo $line | cut -d' ' -f2 )"
      ip="$(echo $line | cut -d' ' -f3 )"
      # 0000000000 means unlimited
      echo "000000000 $mac $ip $name *" >> /tmp/dhcp.leases

Not perfect but it seeme a little bit better to me ...

I removed the dhcp section from my Dumb AP luci overview. (Useless section for Dumb AP)
You can check this out:

And I see all my static leases on both Main router and Dumb AP...

Nice idea
The solution depends on what you want to achieve... :slightly_smiling_face:

How are the static leases/hostnames propagated from the router to the AP?

I tried renaming those files and rebooted my WAP, but every device is listed as '?'.

What do you mean you tried renaming those files?

Your simple and useful tip is to rename those .js files and you've also stated that you see all your static leases on your Dumb AP.

The tip is for hiding dhcp section in luci overview.
You see '?' under associated stations. Am I right ?

Yes. All the hostnames are '?'

You see the logs in your syslog?

File '/tmp/dhcp.leases' transferred from <main-router-ip> to <dump-ap-ip>"

Thanks. I got things working.

Good, I hope you'll find it useful

How could I include the hostnames of devices that happen to have a static ip? They lack hostnames because they don't request a dhcp lease.

You can't. Only static leases.

The only way I know of, is to define them in dhcp static leases.
It does'nt matter that they never will do a dhcp request...

However, it is advantageous if they are recorded in the list, because then the IP cannot be accidentally assigned twice.