[Dnsmasq-discuss] using dnsmasq for dns/dhcp with minimal dynamic changes to dns

Simon Kelley simon at thekelleys.org.uk
Fri Mar 1 14:38:39 GMT 2013


On 01/03/13 04:04, Nathaniel Cohen wrote:
> Hi -- I'm new to dnsmasq.  I've read through the docs but not yet
> configured the service for my environment.  I'll be using dnsmasq to
> manage dhcp and dns for a small network.
>
> I've got a simple question but wasn't able to figure out the answer
> from the docs.  I need all the locally managed dns names under the
> purview of dnsmasq to be resolvable at all times -- regardless of the
> state of the client dhcp transactions/nic.  Is there a good pattern
> to do this without having to duplicate the host <-> ip address
> mapping information in more than one place …?
>
> eg: If I use a set of entries like this:
>
> dhcp-host=xx:xx:xx:xx:xx:xx, somedns, 10.10.1.1,  12h
>
> Will somedns always resolve to 10.10.1.1 (and the reverse resolution
> from 10.10.1.1 to somedns) even if the dhcp client with that mac
> address is offline and/or has never performed a dhcp request …?

No the DNS records will only exist whilst a valid DHCP lease exists. You 
can do what you want but you need to split the configuration into two, 
though you don't need to duplicate the mappings.

The dnsmasq.conf configuration becomes.

dhcp-host=xx:xx:xx:xx:xx:xx, somedns, 12h


and then in /etc/hosts

10.10.1.1   somedns

The /etc/hosts line will give you a permanent DNS entry, and the name 
will be looked up in the DNS which the DHCP lease is created and the 
address used for DHCP too.


If you want to keep everything in one file, you can use

host-record=somedns, 10.10.1.1

in dnsmasq.conf

instead of /etc/hosts.


Cheers,

Simon.







More information about the Dnsmasq-discuss mailing list