Topic: Giving local DNS names to IPv6 SLAAC addresses
Edit: Link to the release post: https://forum.openwrt.org/viewtopic.php … 27#p354627
I'd like to share a shell script I've been working on. The purpose of the script is to automatically generate and update a hosts file giving local DNS names to IPv6 addresses that IPv6 enabled devices took via SLAAC mechanism. It works for both fixed host part and temporary addresses. It also works with dynamic public prefix, which is the case where I use it. My ISP changes the prefix at least once every 48 hours. I'm not sure if it will work in every IPv6 configuration. I'm using it with native IPv6 with prefix delegation from the ISP.
There are at least two situations where I think having this set up is useful:
1) When you need to trace some network activity through tcpdump or Realtime Connections page on LuCI and there are lots of IPv6 addresses there and you don't know who/what they belong to.
2) When you are accessing your LAN hosts remotely through VPN. Even if the local and remote IPv4 subnets conflicts you can use IPv6 ULA addresses to connect to your services. It's much easier if the ULAs have names.
The script will watch for changes in IPv6 neighbors table in realtime and will look into the DHCPv4 leases file /tmp/dhcp.leases for a host which has the same MAC address. It will then copy the same host name set by dnsmasq for the IPv6 address. The name will have custom labels appended to it depending on the scope and type of the address (link-local, ULA, public, EUI-64 generated, temporary).
The installation procedure and code is at: