[Dnsmasq-discuss] using dnsmasq for dns/dhcp with minimal dynamic changes to dns
Simon Kelley
simon at thekelleys.org.uk
Mon Jun 10 11:41:52 BST 2013
On 08/06/13 13:52, Ben Cohen wrote:
>
> On Jun 8, 2013, at 6:59 PM, Ben Cohen<ncohen at ucsd.edu> wrote:
>
>> Hi sorry to dredge up a question from the archives -- but this got put on hold and I'm just now implementing it.
>>
>> I'm trying to ensure that dns always has forward and reverse entries for my hosts with static ip mappings. Here's the question I asked and the response:
>>
>> On Mar 1, 2013, at 10:38 PM, Simon Kelley<simon at thekelleys.org.uk> wrote:
>>
>>> 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.
>>
>> I want to use the host-record= mechanism you describe. Here's an example from my configuration:
>>
>> dhcp-host=00:15:62:ff:b4:6e, set:is_wap4410n, set:adm, wap4410n-crstateroom, 12h
>> host-record=wap4410n, 172.19.149.130
>
> Typo in my first message (which is not a typo in the config file) -- same bug either way. Starting dnsmasq never returns ...
>
> dhcp-host=00:15:62:ff:b4:6e, set:is_wap4410n, set:adm, wap4410n-crstateroom, 12h
> host-record=wap4410n-crstateroom, 172.19.149.130
>
>
Which version of dnsmasq are you using? A quick test here doesn't
reproduce the problem with the current code.
Cheers,
Simon.
More information about the Dnsmasq-discuss
mailing list