You can use: cat /tmp/dhcp.leases | ssh <dumb ap ip> "cat > /tmp/dhcp.leases" -OR- 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> .
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.
#!/bin/sh
# provice /etc/ethers for dumb-APs
STATIC="/etc/config/dhcp"
ETHERS="/tmp/ethers"
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" ]
do
# echo "LINE: $line"
# get Key Value
KEY="$(echo ${line} | cut -d' ' -f2 )"
if [ "$KEY" == "host" ]; then
NAM=""
MAC=""
IP=""
else
VAL="$(echo ${line} | cut -d' ' -f3 | cut -d\' -f2 )"
if [ "$KEY" == "name" ]; then
NAM="$VAL"
else
if [ "$KEY" == "ip" ]; then
IP="$VAL"
else
if [ "$KEY" == "mac" ]; then
MAC="$VAL"
fi
fi
fi
fi
if [ "$NAM" != "" ] && [ "$MAC" != "" ] && [ "$IP" != "" ]; then
echo "$MAC $NAM $IP" >> $ETHERS
NAM=""
MAC=""
IP=""
fi
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 .....
fi
Finaly create a filtered /tmp/dhcp.leases on Dumb-AP
#!/bin/sh
# 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" "`
do
# 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
do
line="$(cat /tmp/dhcp.leases.all | grep -i $mac)"
# ... show the mac address:
if [ "$line" != "" ]; then
echo "$line" >> /tmp/dhcp.leases
else
# 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
fi
done
done
Not perfect but it seeme a little bit better to me ...