[Dnsmasq-discuss] Does dnsmasq support cname within same domain?
Simon Kelley
simon at thekelleys.org.uk
Mon Mar 7 23:05:53 UTC 2022
On 07/03/2022 22:06, Geoff Back wrote:
> On 07/03/2022 18:20, Simon Kelley wrote:
>> A quick test of the current development code fails to reproduce this,
>> which is puzzling.
>>
>>
>> One thing to check: having a dhcp-host line which associates an address
>> with a name is not enough to make this work: there needs to be an active
>> DHCP lease in place to be able to resolve client1.test.example.com. If
>> leases are coming and going, that can be enough to confuse tests.
> Hi Simon,
>
> Given this:
>
> domain=example.com
> dhcp-host=11:22:33:44:55:66,10.1.1.2,myhost
> cname=alias.example.com,myhost.example.com
>
> Then it would appear that dnsmasq has enough information to respond to a
> lookup for alias.example.com with full information; since the
> information that would be returned to the query is unchanged by whether
> there is a lease or not, I would have expected it to do so.
>
> However, if I am reading the above correctly, that's not the case and
> there has to be an active lease on 'myhost' for dnsmasq to return the
> assigned IP.
>
> Assuming I have that right, I'm sure there's a good reason; could you
> enlighten me/us as to why?
The reason is that you might have
dhcp-host=11:22:33:44:55:66,10.1.1.2,myhost
dhcp-host=11:22:33:44:55:66,192.168.1.2,myhost
A Mac address will have a lease on only one subnet at any time, but
which subnet (and therefore the IP address) depends on which physical
network it is currently connected to. If you unplug the host from subnet
A and attach it to subnet B then the actual IP address will change,and
that's what reflected in the associated A record, but it's fine to have
multiple dhcp-host configs for all the networks a host might be
connected to.
An actual DHCP lease is required to create the A record, as that
determines what the host's address in right now.
If you don't want this facility, it's easy to nail an IP address to a
name with host-record or /etc/hosts and that remains valid even if there
is no DHCP lease, or a DHCP lease for a different address.
Simon.
>
> Thanks,
>
> Geoff.
>
>>
>> Do you see the same effect if you use host-record to define the address
>> of client1?
>>
>>
>> Simon.
>>
>> alias.test.example.com>,alias.dummy.example.com
>>> <http://alias.dummy.example.com>,client1.test.example.com
>>> <http://client1.test.example.com>____
>>>
>>>
>>> No, it behaves the same as I use two separate cname lines:
>>> different domain alias resolves, and same domain alias doesn't.
>>> Did it work for you? If so, what version of dnsmasq do you use?
>>>
>>> Thanks!
>>> Frank
>>>
>>>
>>> _______________________________________________
>>> Dnsmasq-discuss mailing list
>>> Dnsmasq-discuss at lists.thekelleys.org.uk
>>> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
>> _______________________________________________
>> Dnsmasq-discuss mailing list
>> Dnsmasq-discuss at lists.thekelleys.org.uk
>> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
>
>
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
>
More information about the Dnsmasq-discuss
mailing list