[Dnsmasq-discuss] Caching seems to not work

Simon Effenberg savar at schuldeigen.de
Wed Dec 4 11:01:26 GMT 2019


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 or 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`).


Simon Effenberg <savar at schuldeigen.de>

More information about the Dnsmasq-discuss mailing list