[Dnsmasq-discuss] Caching seems to not work

Simon Kelley simon at thekelleys.org.uk
Wed Dec 4 21:41:47 GMT 2019


On 04/12/2019 11:01, Simon Effenberg wrote:
> Hi,
> 
> I was trying to test dnsmasq (2.80) and I either miss a point or I cannot find how to enable the caching while being in TCP mode.
> 
> I was trying to use it in a --keep-in-forground mode with a setup like
> 
> dnsmasq -k --port=1053 --log-facility=/dev/stdout --log-queries --no-hosts --cache-size=1000 --neg-ttl=30
> 
> This works in general but trying to do a simple `dig +tcp google.de -p 1053 @localhost` this will _always_
> forward it to the upstream DNS server (in my case it is 8.8.8.8 or 8.8.4.4). I checked it in the log as
> well as with `tcpdump` and it definitely is always asking the upstream server.
> 
> I also tried to install it within Debian unstable instead of compiling it myself. Same version, standard
> install, only change in the config was to comment in the `cache-size=150` .. still same thing is happening.
> 
> Fun part: if I use `-d` instead of `-k` the cache suddenly starts to work. The first request goes to the
> upstream, every other until the TTL hits in is answered from the cache.
> 
> The main difference for me (while I tried to debug it within the code): `-d` is never forking, `-k` is still
> forking for a retrieved TCP connection.
> 
> UDP btw is always working fine (the cache is being used, in Daemon mode, `-k` and also `-d`).
> 
> Cheers
> Simon
> 

This is fixed in the current development code, which should become 2.81
soon now.......


Simon.




More information about the Dnsmasq-discuss mailing list