There is likely an easy way to do this, I just can't find it ... :-(. I have my OpenWrt router configured in "AP mode" ... meaning bridging WAN and LAN, and DHCP disabled (handle that upstream). The associated (wireless) stations only show a MAC address, but I'd like to see IP address and/or hostname. Is that possible?
/etc/ethers "by hand" on the OpenWrt box running LuCI.
root@devel:/# cat /etc/ethers
space or tab separation should work with OpenWrt 18.01 and later. That at least gets all the ones I have pre-configured reservations in my DHCP config.
I've many times toyed with the idea of using MQTT to push DHCP lease changes from my DHCP servers to my OpenWrt APs, but it hasn't risen anywhere near the top of my list. That idea has been replaced by having my APs report connected stations through MQTT, then having a "desktop" parse the results from the multiple APs and use MQTT-pushed DHCP lease information to provide an aggregated view of all the APs I manage in one place, rather than having five browser windows open.
By hand meaning really that - manually? With family and friends I have 25+ machines overall, so I admit - a bit painful to do manually. Was thinking (likely incorrectly) that there is a Linux-like way to do this?
kea and there's probably a way to write a script to extract the hw-address and hostname (or ip-address) from the JSON-like config, but it reasonably fast for me just to hand-edit
/etc/ethers for 40 host reservations then update both when I "found" other MAC addresses of interest on the network. It probably would have taken me longer to write and debug a script to do that.
Understood. I did have a working script from a while back (need to go find it again), that will query the ARP table on my DHCP server (pfSense). I could use that to update /etc/ethers, as you note. So then ...
- Does /etc/ethers survive through reboots, upgrades, etc.?
- Is there a way then to show the hostname in the GUI, vs. just the MAC?
If you run
cat /opt/kea/var/kea/kea-leases4.csv | cut -d , -f 2,9 | sort | uniq | tr , "\t"
will at least give you what's recently connected in a usable form. (Edit: My
kea is in a non-standard install path.)
If you add
/etc/sysupgrade.conf it definitely should be preserved over typical upgrades. It may be already preserved, which you can check with
sysupgrade -l | fgrep ethers
Awesome, thanks for all the help!
Actually, one last minor question - do you know how to remove the IPv6 address under the hostname? Very minor, but just curious. I think I have IPv6 disabled everywhere ... but perhaps not ... :-).
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.