netcd Daemon

Purpose

Launches the network caching (netcd) daemon.

Syntax

netcd [ -l file ] [ -c file ] [ -d level ] [ -h ]

Description

The netcd daemon reduces the time taken by the local, DNS, NIS, and user loadable module services to respond to a query by caching the response retrieved from resolvers.

When the netcd daemon is running and configured for a resolver (for example, DNS) and a map (for example, hosts), the resolution is first made using the cached answers. If it fails, the resolver is called and the response is cached by the netcd daemon.

The type of the maps that are supported for the local, NIS, and user loadable modules resolutions are hosts, services, networks, protocols and netgroup. For DNS, hosts is the only type of map that you can use.

In addition, for the specific case of Yellow Pages, the following maps have been added:
  • passwd.byname
  • passwd.byuid
  • group.byname
  • group.bygid
  • netid.byname
  • passwd.adjunct.byname

You can use a configuration file to specify the resolvers and maps that you want to configure. You can also set other netcd parameters using this file. By default, the configuration file used is the /etc/netcd.conf file. You can change the path of this configuration file using the -c argument of the netcd daemon. If the /etc/netcd.conf file does not exist, the netcd daemon uses the default parameters. You can find a sample of this file under the /usr/samples/tcpip file. Do not use this file as a configuration file because it will be overwritten by a new installation of the package containing the file.

You can specify the level of debugging using the -d argument. The debugging levels are similar to the one used by the syslogd daemon. Log messages are written to the /var/tmp/netcd.log file. You can override the default using the netcd configuration file. As with the syslogd daemon, you can specify rotation for the netcd log file.

netcd Parameters

When an entry is inserted in a netcd cache, a time-to-live (TTL) is associated to it. You can configure this TTL using the netcd configuration file (cache declarations). For DNS, this TTL is the one contains the response from the DNS.

To clean the caches of outdated entries, you must run two tasks periodically, one to clean local caches and the other to clean the other caches. You can set the frequency of these tasks using the local_scan_frequency and net_scan_frequency parameters in the netcd configuration file.

Caches are hashed tables. The size of the hash tables can be controlled using the netcd configuration file and the netcdctrl command.

To communicate between the applications, the netcd daemon uses a socket (/dev/netcd). You can configure the size of the message queue using the netcd configuration file.

netcd supports the System Resource Controller

The netcd daemon is part of the netcd System Resource Controller (SRC) group. The following are the SRC commands you can use to manage the netcd daemon:

  • You can start the netcd daemon using the startsrc command, or stop the netcd daemon using the stopsrc command.
  • The lssrc command provides a short status output that includes the Process ID (PID) and the status of the netcd daemon.
  • The lssrc -l command provides a long status output that includes the PID, the status of the netcd daemon, the configuration file used when starting the netcd daemon, and the configured caches.
Note: You cannot use the refresh command with the netcd daemon.

Flags

Item Description
-c file Specifies a configuration file. The default file name is /etc/netcd.conf.
-d level Specifies the logging level. The level value must be an integer between 0 and 7.
-h Displays help information.
-l file Loads caches from the specified binary file created by the netcdctrl command. The local files (for example, /etc/hosts, /etc/services) are loaded depending on the configuration file.

Examples

  1. To launch the netcd daemon using the SRC, enter:
    startsrc -s netcd
  2. To display the status of the netcd daemon using the SRC, enter:
    lssrc -s netcd
    This command produces the following output:
    Subsystem         Group            PID          Status 
    netcd             netcd            299064       active
    
  3. To display the status of the netcd daemon in long form using the SRC, enter:
    lssrc -l -s netcd
    This command produces the following output:
    Subsystem         Group            PID          Status 
    netcd             netcd            299064       active
    Configuration File       /etc/netcd.conf 
    Configured Cache         local services 
    Configured Cache         local protocols 
    Configured Cache         local hosts 
    Configured Cache         local networks 
    Configured Cache         local netgroup 
  4. To launch the netcd daemon without using the SRC, enter:
    netcd