Softpanorama

May the source be with you, but remember the KISS principle ;-)
Contents Bulletin Scripting in shell and Perl Network troubleshooting History Humor

Suse nscd

News Solaris DNS Client (resolver) Recommended Links DNS Tools nsswitch file
Configuring DNS clients DNS Security Random Findings Humor Etc 

The nscd daemon implements a cache for the most common name service requests. It's origin can be traced to BSD.

Linux models nscd daemon on Solaris.  It's not limited to DNS.  The /etc/nscd.conf configuration file controls the behavior of the nscd daemon. In Linux nscd daemon provides caching for the passwd, group, hosts, and services.

System calls automatically reference the nscd cache, and retrieve data from it instead of files, if the nscd cache holds the type of data needed. Standardized calls retrieve the cached data. The names of the calls are structured as getXbyY, where X is the name of object to get and Y is the index to be used. For example gethostbyname, gethostbyaddr, and so on.

Cached data has time-to-live. Daemon controls changed on local files and adapt cache in case such changes were detecred For example, proper modification of the /etc/hosts causes expiration of the corresponding name service cache (upon the next call to the nscd daemon.).

Configuring the nscd Daemon

The /etc/nscd.conf file contains the configuration information for the nscd daemon. Each line specifies either an attribute and a value, or an attribute, a cache name, and a value. An example of an attribute and a value is: enable-cache hosts no

An example of /etc/nscd.conf

Problems

Suse nscd daemon does not work correctly with sendmail and it might be beneficial to disable it as it keeps  old DNS entries. Or at least run it in paranoid mode. It's better to run caching DNS server if DNS response is an issue (Web servers, etc)

# nscd --help
Usage: nscd [OPTION...]
Name Service Cache Daemon.

  -d, --debug                Do not fork and display messages on the current
                             tty
  -f, --config-file=NAME     Read configuration data from NAME
  -g, --statistics           Print current configuration statistics
  -i, --invalidate=TABLE     Invalidate the specified cache
  -K, --shutdown             Shut the server down
  -t, --nthreads=NUMBER      Start NUMBER threads
  -?, --help                 Give this help list
      --usage                Give a short usage message
  -V, --version              Print program version

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

For bug reporting instructions, please see:
.
# nscd -g
nscd configuration:

              0  server debug level
 91d  1h 39m 29s  server runtime
              4  current number of threads
             32  maximum number of threads
              0  number of times clients had to wait
             no  paranoia mode enabled
           3600  restart internal

passwd cache:

            yes  cache is enabled
            yes  cache is persistent
            yes  cache is shared
            211  suggested size
         216064  total data pool size
           1840  used data pool size
            600  seconds time to live for positive entries
             20  seconds time to live for negative entries
             47  cache hits on positive entries
              0  cache hits on negative entries
          17546  cache misses on positive entries
             55  cache misses on negative entries
              0% cache hit rate
             20  current number of cached values
             73  maximum number of cached values
              2  maximum chain length searched
              0  number of delays on rdlock
              0  number of delays on wrlock
              0  memory allocations failed
            yes  check /etc/passwd for changes

group cache:

            yes  cache is enabled
            yes  cache is persistent
            yes  cache is shared
            211  suggested size
         216064  total data pool size
           1080  used data pool size
           3600  seconds time to live for positive entries
             60  seconds time to live for negative entries
             17  cache hits on positive entries
              0  cache hits on negative entries
           3802  cache misses on positive entries
             43  cache misses on negative entries
              0% cache hit rate
             14  current number of cached values
             84  maximum number of cached values
              2  maximum chain length searched
              0  number of delays on rdlock
              0  number of delays on wrlock
              0  memory allocations failed
            yes  check /etc/group for changes

hosts cache:

            yes  cache is enabled
             no  cache is persistent
            yes  cache is shared
            211  suggested size
         216064  total data pool size
            568  used data pool size
            600  seconds time to live for positive entries
              0  seconds time to live for negative entries
              0  cache hits on positive entries
              0  cache hits on negative entries
            845  cache misses on positive entries
              0  cache misses on negative entries
              0% cache hit rate
              4  current number of cached values
              9  maximum number of cached values
              2  maximum chain length searched
              0  number of delays on rdlock
              0  number of delays on wrlock
              0  memory allocations failed
            yes  check /etc/{hosts,resolv.conf} for changes

services cache:

            yes  cache is enabled
            yes  cache is persistent
            yes  cache is shared
            211  suggested size
         216064  total data pool size
              0  used data pool size
          28800  seconds time to live for positive entries
             20  seconds time to live for negative entries
              0  cache hits on positive entries
              0  cache hits on negative entries
             46  cache misses on positive entries
             21  cache misses on negative entries
              0% cache hit rate
              0  current number of cached values
             15  maximum number of cached values
              1  maximum chain length searched
              0  number of delays on rdlock
              0  number of delays on wrlock
              0  memory allocations failed
            yes  check /etc/services for changes

Top Visited
Switchboard
Latest
Past week
Past month

NEWS CONTENTS

Old News ;-)

How clear DNS cache

ken_yap
/etc/init.d/nscd restart

or
rcnscd restart
or
 service nscd restart 

Have a lot of fun!

Recommended Links

Softpanorama hot topic of the month

Softpanorama Recommended

nscd.conf(5) - Linux man page