[Dnsmasq-discuss] Prevent forwarding of requests for hosts Dnsmasq
already knows about
Simon Kelley
simon at thekelleys.org.uk
Thu Feb 26 11:11:05 GMT 2009
Ian Scott wrote:
> On Feb 24, 2009, at 1:31 AM, Simon Kelley wrote:
>
>> The behaviour you are requesting is how it's supposed to work, so this
>> is a bug rather than a misfeature. It's also a rather puzzling bug,
>> since mixing data from an "upstream" nameserver and locally-known
>> names is very difficult for dnsmasq to do.
>>
>> In your example above, I assume that 192.168.0.238 comes from DHCP.
>>
>> The only explanation I can come up with goes like this.
>>
>> 1) No DHCP lease exists for laptop.example.com and something does a
>> DNS lookup. That puts the CNAME records for laptop.example.com into
>> the cache.
>>
>> 2) laptop.example.com gets a DHCP lease. which puts the A record for
>> laptop.example.com into the cache, but the CNAME is not deleted.
>>
>> 3) Subsequent DNS lookups get both bits of data from the cache.
>>
>> This is a great theory, except that there seems to exist code to
>> delete any existing cache entries when a DHCP-derived name is pushed
>> into the cache, which should handle this.
>>
>> Does my theory fit the facts? If you restart dnsmasq (and clear the
>> cache) does the beahviour change?
>
> You assume correctly, 192.168.0.238 comes from DHCP.
>
> It looks like the "host" command sends several requests: it asks for an
> A, an AAAA, and MX record for the requested host. Here's the relevant
> log, right after restarting dnsmasq and renewing laptop.example.com's DHCP:
> Feb 25 22:00:59 server dnsmasq[24614]: query[A] laptop.example.com from
> 192.168.0.10
> Feb 25 22:00:59 server dnsmasq[24614]: DHCP laptop.example.com is
> 192.168.0.238
> Feb 25 22:00:59 server dnsmasq[24614]: query[AAAA] laptop.example.com
> from 192.168.0.10
> Feb 25 22:00:59 server dnsmasq[24614]: forwarded laptop.example.com to
> 68.94.156.1
> Feb 25 22:01:00 server dnsmasq[24614]: reply laptop.example.com is <CNAME>
> Feb 25 22:01:00 server dnsmasq[24614]: reply p4p.geo.vip.re4.yahoo.com
> is NODATA-IPv6
> Feb 25 22:01:00 server dnsmasq[24614]: query[MX] laptop.example.com from
> 192.168.0.10
> Feb 25 22:01:00 server dnsmasq[24614]: forwarded laptop.example.com to
> 68.94.156.1
>
> The A query works great, but AAAA and MX records get forwarded. I think
> they shouldn't be. Is this expected behavior?
>
> Ian
>
>
It is expected behaviour, but it can be changed by adding
local=/example.com/
to /etc/dnsmasq, which tells dnsmasq not to forward any queries for
*.example.com
Cheers,
Simon.
More information about the Dnsmasq-discuss
mailing list