Discussion:
[Dnsmasq-discuss] Need some info on retried and failed queries
Mikhail Morfikov
2016-07-01 13:03:43 UTC
Permalink
In the dnsmasq confg file I can set the two following parameters:

min-cache-ttl=3600
max-cache-ttl=7200

Let's say I visit some http server on the internet. The cache entry would be
created for the domain and for 1h, each request to that domain would be served
from the cache, right?

What if the IP address associated with the domain changes for some reason in
10min. after my first visit? What would dnsmasq do if I tried to access the web
server once more after 15min? Some people say that I would have wrong IP so I
couldn't connect to the web server till the cache entry expires. But I've never
had this problem and all web pages works fine with the above values, at least I
think so.

I can see some retried or failed queries in the following log:

dnsmasq[1612]: cache size 10000, 0/4284 cache insertions re-used unexpired cache
entries.
dnsmasq[1612]: queries forwarded 4508, queries answered locally 6386
dnsmasq[1612]: queries for authoritative zones 0
dnsmasq[1612]: server 192.168.1.1#53: queries sent 0, retried or failed 0
dnsmasq[1612]: server 208.67.222.222#53: queries sent 59, retried or failed 0
dnsmasq[1612]: server 127.0.2.1#5353: queries sent 4449, retried or failed 60
dnsmasq[1612]: time 1467180121

But I don't really know what means "retried or failed 60". So did it fail or
not? Is it because of the high TTL values or something else?
Albert ARIBAUD
2016-07-01 14:25:06 UTC
Permalink
Hi Mikhail,

Le Fri, 1 Jul 2016 15:03:43 +0200
Post by Mikhail Morfikov
min-cache-ttl=3600
max-cache-ttl=7200
Let's say I visit some http server on the internet. The cache entry
would be created for the domain and for 1h, each request to that
domain would be served from the cache, right?
Almost. It would be 1 hour if the TTL from the upstream server was
less than 1 hour; 2 hours if the upstream TTL was more than two hours;
and in-bewteen, it would be the upstream TTL.
Post by Mikhail Morfikov
What if the IP address associated with the domain changes for some
reason in 10min. after my first visit?
You don't see it until 50 minutes after (simplifying a bit here). That's
the principle of the cache.
Post by Mikhail Morfikov
What would dnsmasq do if I
tried to access the web server once more after 15min?
It would still rely on the 1 hour minimum TTL, so it would still not
ask any upstream server again until about 35 minutes (ditto).
Post by Mikhail Morfikov
Some people say
that I would have wrong IP so I couldn't connect to the web server
till the cache entry expires. But I've never had this problem and all
web pages works fine with the above values, at least I think so.
It's just that you never experienced an IP *change* within the TTL of
its DNS entry -- or that you did but something else hid that from
you; for instance your web browser page cache may have prevented your
machine from trying to connect to the obsolete IP.
Post by Mikhail Morfikov
dnsmasq[1612]: cache size 10000, 0/4284 cache insertions re-used
unexpired cache entries.
dnsmasq[1612]: queries forwarded 4508, queries answered locally 6386
dnsmasq[1612]: queries for authoritative zones 0
dnsmasq[1612]: server 192.168.1.1#53: queries sent 0, retried or
failed 0 dnsmasq[1612]: server 208.67.222.222#53: queries sent 59,
retried or failed 0 dnsmasq[1612]: server 127.0.2.1#5353: queries
sent 4449, retried or failed 60 dnsmasq[1612]: time 1467180121
But I don't really know what means "retried or failed 60". So did it
fail or not? Is it because of the high TTL values or something else?
TTL and failures are unrelated. TTL is just an indication that a DNS
entry can/should be considered constant for as long as indicated, while
failures and retries are when dnsmasq tries to query an upstream server
and it fails for some reason (the upstream server does not anwser at
all, or anwsers garbage, for instance).

Amicalement,
--
Albert.
Loading...