[Dnsmasq-discuss] Prevent forwarding of requests for hosts Dnsmasq already knows about

Simon Kelley simon at thekelleys.org.uk
Tue Feb 24 09:31:45 GMT 2009


Ian Scott wrote:
> DNS for my domain out on the Internet is served by Yahoo Small Business, 
> and they serve a wildcard CNAME for that domain: *.example.com is a 
> CNAME for the machine hosting the web site for example.com. On my local 
> network, I have Dnsmasq serving DNS and DHCP. For DHCP hosts, I get back 
> both the A record from Dnsmasq and the wildcard CNAME from Yahoo. For 
> example:
> $ host laptop
> laptop.example.com has address 192.168.0.238
> laptop.example.com is an alias for p4p.geo.vip.re4.yahoo.com.
> laptop.example.com is an alias for p4p.geo.vip.re4.yahoo.com.
> p4p.geo.vip.re4.yahoo.com mail is handled by 0 .
> 
> I'd like Dnsmasq to not forward requests for any records to the upstream 
> DNS servers for hosts it knows about via DHCP. It seems to be the case 
> already for hosts in /etc/hosts:
> $ host server
> server.example.com has address 192.168.0.10
> 

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?

Cheers,

Simon.



More information about the Dnsmasq-discuss mailing list