Sharing DHCP metadata between OpenWrt "nodes"?

I've more or less finished building my revamped network which now includes a 'main' node and several 'secondary' nodes. The main node is running the usual routing functions, while the secondary nodes act as dump APs - no DHCP, firewall, just a bonded interface spanning all ethernet ports and WiFi interfaces.

For management purposes (mostly debugging possible issues), I use the secondary nodes' LuCI to see which clients are connected to which node. But since there's no DHCP server running on those nodes, the device list lacks almost all details - all I can see is the IP address.

I'm looking for a way to give access to the DHCP metadata on the main node (which is available via e.g. the RPC API, which I use to integrate with HomeAssistant) to the secondary nodes. Is there any built in way to do this?

All nodes are running recent SNAPSHOTs.

Associated stations list in AP, how to show host names? - #6 by smtylr

1 Like

According to comments on that post, the fping solution doesn't work since 19.07.05. It would also limit the device discovery to boot time, if I understand it right.

If they don't clearly state the reason, it could be their own mistake.

1 Like

I'm using a cgi script on the dumb AP to display client info on the core rpi4 via something like;

curl http://<AP_ADDR>/cgi-bin/

which is basically

for wNIC in $(iwinfo | cut -d' ' -f1 | tr -s '\t' ' ' | grep -v '^$'); do
	echo "############# iw dev $wNIC station dump $(iwinfo $wNIC info | grep 'Mode:')"
	iw dev $wNIC station dump | grep -oE '[[:xdigit:]]{2}(:[[:xdigit:]]{2}){5}'

lookup the results in dhcp.leases etc. and your done

At that point it's just easier to use the UBUS RPC API to query the devices from the main node and dump them into the appropriate file...

1 Like

Or even easier, regularly scp /tmp/dhcp.leases (and /tmp/hosts/odhcpd) off the main router onto the secondary ones. These files are parsed by LuCI to get host details.

If setting up ssh keys etc. is too much hassle, you could even symlink those files into /www on the main router (and ensure that follow_symlinks is 1 in uhttpd config), then fetch http://mainrouter/dhcp.leases every minute with wget


Yeah, I'd rather avoid SSH access. And I think I could use the JSON-RPC API to grab said files from the main router, and put them in the appropriate place using a Cron job on the secondary nodes.