:: Re: [DNG] how to clear DNS cache
Top Page
Delete this message
Reply to this message
Author: Rick Moen
Date:  
To: dng
Subject: Re: [DNG] how to clear DNS cache
Quoting Simon Hobson (linux@???):

> What do /etc/resolv.conf and /etc/nssswitch.conf have in them ?
> Though to be honest, other than the systems I have BIND running on,
> DNS resolution is something of a black box to me.


On Linux systems, there is a DNS 'stub resolver' librery 'libresolv'
included in the glibc package, that furnishes the system's res_query(),
res_search(), res_mkquery(), res_send(), res_init(), dn_comp(),
dn_expand() functions, plus higher-level functions such as
gethostbyname() and gethostbyaddr(). See:
https://linux.die.net/man/3/resolver

This is distressingly ancient and crufty code, going all the way back to
1980s BSD UNIX. After that, it was inside BIND4, BIND8, and all BIND9
versions until 9.6.0 as 'libbind'. It was removed from BIND itself
starting BIND 9.6.0. glibc borrowed as 'libresolv' the version of this
code during the long BIND8 era, and kept in sync with the BIND8 module
through BIND 8.2.3-T5B in July 2000, from which point it has continued
to evolve independently in glibc.

The purpose of a 'stub resolver' is to originate outgoing DNS queries to
a separate _real_ recursive nameserver[1] on- or off-system (e.g.,
Unbound, BIND9's recursive functions, MaraDNS, PowerDNS Recursor,
dnscache, Deadwood).

libresolv is used as a generic glibc interface to all DNS name resolution
methods - from using /etc/hosts file to DNS/NIS/LDAP services, and
system its behaviour is controlled by /etc/nsswitch.conf and
/etc/resolv.conf.

It should be noted that many programs presume to cache DNS, e.g., Web
browsers do, as does the Java runtime. Also, some systems such as ones
on NIS or LDAP and NFS tend to run dedicated system caching daemons like
GNU's nscd[2] for performance purposes (i.e., to make performance suck
less).

Possibly of assistance:
http://linuxmafia.com/faq/Network_Other/dns-servers.html


[1] Or to a forwarder such as Dnsmasq, DNRD, CurveDNS, dproxy, or pdnsd,
which in turn would need to relay the query to a real recursive nameserver.

[2] http://man7.org/linux/man-pages/man8/nscd.8.html