[Dnsmasq-discuss] cnames and dns working when ip not assigned

Michael michael at kmaclub.com
Thu Aug 17 17:38:17 BST 2017


On 08/14/2017 03:27 PM, Spike wrote:
> Dear all,
>
> two things I'm trying to figure out:
>
> #CNames
> how can I implement cnames in dnsmasq? I have static per mac 
> assignments in my hosts file and I'd like to add one or more cnames 
> per host. Is that possible, what's the syntax? I've seen some pages 
> discussing the topic, but none of the solutions worked for me and more 
> importantly none of them was specifying more than one cname.
>
> #DNS while host is down
> As far as I can see dnsmasq will respond to a host request only if the 
> host is alive/got a dhcp. Is it possible to override this behavior? If 
> I have a host definition with an ip, I need that to resolve even if 
> the host is down.
>

I think they key is to realize dnsmasq is a tool with multiple jobs:
1) DNS
2) DHCP
3) tftp
4) etc

These jobs can all be interconnected easily within dnsmasq.

Static host for DNS - add to /etc/hosts or specify an alternate (or 
additional ) host file w/ addn-hosts=<file> directive.

My host looks like:

192.168.1.10  hosta www aliasb aliasc
192.168.1.11  hostb
192.168.1.12  hostc

These entries are permanent and have no dependency on these hosts having 
a dhcp lease.  www, aliasb, and aliasc are now "aliases" for hosta, but 
they are A records and not CNAMES.    Do you really require a CNAME or 
will A record suffice?

you can then statically define DHCP clients if you choose such as:

dhcp-host=00:90:a9:f1:b3:e7,hostf

dnsmasq will now provide a dhcp lease to this host.    If hostf is in 
your hosts file, it will give it that static IP.   If it isnt', it will 
give you an IP from the dhcp range AND dynamically add hostf to DNS.   
Once DHCP lease is no longer valid, it will remove hostf from DNS.

if you don't define the dhcp-host at all, it will give a DHCP ip and use 
the hostname the client passed up to add to DNS and will again remove it 
when the lease goes away.

Does that help clarify?

Michael







More information about the Dnsmasq-discuss mailing list