My dnsmasq is configured:
- On host 'rtfm.lan'
- Domain 'lan'
- There are some DHCP presets that include hostnames
All '*.lan' hosts registered via DHCP do resolve fine: dnsmasq known which IPs are assigned to which hostnames. However, 'rtfm.lan' is read from /etc/hosts and resolve to 127.0.0.1.
I can prevent dnsmasq from reading /etc/hosts and add an address manually:
But this is not flexible: if one day I decide to change my IP — i'll also have to change it in dnsmasq.conf.
How can I tell dnsmasq to use local-hostname with its real IP?
Just in case.. here's my DNSmasq config:
# Never forward plain names (without a dot or domain part) domain-needed # Never forward addresses in the non-routed address spaces. bogus-priv # Read resolv.conf serially strict-order #==========[ NAMESERVER ]==========# # Cache size cache-size=4096 # Don't read /etc/hosts no-hosts # Read additional hosts-file (not only /etc/hosts) to add entries into DNS addn-hosts=/etc/hosts-dnsmasq # Auto-append <domain> to simple entries in hosts-file expand-hosts #=== HOSTNAME OVERRIDES address=/localhost/127.0.0.1 # *.localhost => 127.0.0.1 #==========[ DHCP ]==========# # Enable for the local network? dhcp-authoritative # Tell MS Windows to release a lease on shutdown dhcp-option=vendor:MSFT,2,1i #=== DHCP # Domain name domain=lan # DNS-resolve hosts in these domains ONLY from /etc/hosts && DHCP leases local=/lan/ # DHCP range & lease time dhcp-range=192.168.1.70,192.168.1.89,24h # Default route dhcp-option=3,192.168.1.1 #=== FIXED LEASES # LAN MY HOSTS dhcp-host=00:23:54:5d:27:fa, rtfm.lan, 192.168.1.2 dhcp-host=00:23:54:5d:27:fb, rtfm.lan, 192.168.1.2 dhcp-host=c8:0a:a9:45:f1:03, 00:1e:64:9e:e9:5e, wtf.lan, 192.168.1.3