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.

1 Like

The idea to use hotplug is great!

I'll provide some information how it worked for me, in case anyone has the same trouble.

I tried to do the same when a device is connected or disconnected to the main router. The correct path for this case is not in dhcp but in iface:

-rw-r--r-- 1 root root [...] /etc/hotplug.d/iface/30-iface-dumbap

As you can see, chmod +x is not necessary. Just look at the other files in hotplug.

Maybe iface is wrong, it's probably too much. But it's good for testing. If you click on disconnect at a device in one router, the device should immediately connect to the other router/dumbap and trigger the hotplug/iface event.

Also because of my ssh settings I had to modify the scp line to define the port and the identity file:

scp -P 2020 -i /root/.ssh/id_dropbear_dumbap /tmp/dhcp.leases root@dumbap:/tmp/dhcp.leases
logger -t hotplug "File '/tmp/dhcp.leases' transferred from main to dumbap triggered by iface"

After running this setup for half an hour, I'm noticing way too many log entries with logread | grep hotplug, from 1 to 7 events per minute. I guess there's a host with major connection stability issues :face_with_diagonal_mouth:

Again, I want to emphasize using iface instead of dhcp to populate the dhcp.leases file is only useful for debugging!

Can this be working together with ip neigh show command to list IPv6 SLAAC clients as well?

I'm not very familar with ipv6.
Active DHCPv6 leases are stored in /tmp/hosts/ohdcp and can be transferred to a Dumb-AP too. Just as ipv4 leases.
But an adress given by SLAAC is not equal to DHCPv6!
Maybe you can fake an entry. But the content meaning will be wrong ...