I was running old IPcop for years and when I tried to replace it, it was a painful process, I worked on that for several years (it was not urgent task)… There was problem to find good modern hardware that was reliable, well supported had 2+ NIC and was energy efficient and not expensive. Requirement for 2+ NIC was really painful so I played for some time with OPNsense running on old thinclient terminal (or mini PC) and cheap smart switch that supports VLAN (OPNsense/PFsense supports VLAN out of the box). I decided for IPfire gateway when I managed to get mini PC with 2 ETH ports and free PCI slot for WiFi card. I was familiar with IPcop and I like that IPfire has update accelerator, I like this feature and this was important for me; I do not need IPv6, I have OpenWRT router and small sub-lan dedicated to experiments with IPv6…
Inspired by AI advice, I tried CNAME, just proof of concept, it works:
I have found android entry in /etc/unbound/dhcp-leases.conf:
local-data: "android-9c5479851201c5a3.home 60 IN A 192.168.222.232"
local-data: "232.222.168.192.in-addr.arpa 60 IN PTR android-9c5479851201c5a3.home"
I appended CNAME record to the end of the file; I understand this file is generated by a script when DHCP configuration is changed, so I understand this is not permanent change and it will be lost in few minutes:
local-data: "android-tablet.home 60 CNAME android-9c5479851201c5a3.home"
I sent HUP signal to unbound
to reload configuration:
# killall -HUP unbound
Verify that configuration is still in the file:
# grep "9c5479851201c5a3" /etc/unbound/dhcp-leases.conf
local-data: "android-9c5479851201c5a3.home 60 IN A 192.168.222.232"
local-data: "232.222.168.192.in-addr.arpa 60 IN PTR android-9c5479851201c5a3.home"
local-data: "android-tablet.home 60 CNAME android-9c5479851201c5a3.home"
TEST, it works:
# host "android-tablet"
android-tablet is an alias for android-9c5479851201c5a3.home.
# host "android-tablet.home"
android-tablet is an alias for android-9c5479851201c5a3.home.
# host "android-9c5479851201c5a3"
android-9c5479851201c5a3.home has address 192.168.222.232
# host "android-9c5479851201c5a3.home"
android-9c5479851201c5a3.home has address 192.168.222.232
# host "192.168.222.232"
232.222.168.192.in-addr.arpa domain name pointer android-9c5479851201c5a3.home.
Test the case that alias is linked to host that was removed and test for host that is not defined at all.
I cannot explain why I receive two NXDOMAIN replies from host android-tablet2
# grep "broken" /etc/unbound/dhcp-leases.conf
local-data: "android-tablet2.home 60 CNAME android-broken.home"
# grep "tablet2" /etc/unbound/dhcp-leases.conf
local-data: "android-tablet2.home 60 CNAME android-broken.home"
# host "android-tablet2"
android-tablet2.home is an alias for android-broken.home.
Host android-broken.home not found: 3(NXDOMAIN)
Host android-broken.home not found: 3(NXDOMAIN)
# grep "tablet3" /etc/unbound/dhcp-leases.conf
# host "android-tablet3.home"
Host android-tablet3.home not found: 3(NXDOMAIN)
But life is not easy, khost
tool (host from knot package) cannot resolve “android-tablet”. I assume this is a bug in khost
tool, it ignores “search home” in file /etc/resolv.conf
user@ubuntu:~$ khost "android-tablet" 192.168.222.1
Host android-tablet. type A error: NXDOMAIN
Host android-tablet. type AAAA error: NXDOMAIN
Host android-tablet. type MX error: NXDOMAIN
user@ubuntu:~$ khost "android-tablet.home" 192.168.222.1
android-tablet.home. is an alias for android-9c5489852201d5e2.home.
user@ubuntu:~$ host "android-tablet" 192.168.222.1
Using domain server:
Name: 192.168.222.1
Address: 192.168.222.1#53
Aliases:
android-tablet.home is an alias for android-9c5489852201d5e2.home.
user@ubuntu:~$ tail -4 /etc/resolv.conf
nameserver 127.0.0.53
options edns0 trust-ad
search home