Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ switch(4) — HP-UX 10.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getnetgrent(3C)

getrpcbyname(3C)

gethostbyname(3N)

getnetbyname(3N)

getportbyname(3N)

nslookup(1M)

switch(4)

NAME

switch − switch configuration file

SYNOPSIS

/etc/nsswitch.conf

DESCRIPTION

The switch configuration file specifies the lookup policy used by a library routine to retrieve information from a network database. One such routine and network database is the gethostbyname() (see gethostbyname(3N)) library call used to lookup hostname or IP address entries in the hosts database. The hosts database may be located in several different information services (sources); for example, DNS, NIS or the local /etc/hosts file. The lookup policy defines the order and the conditions under which various sources (network information services) are queried to obtain information.

The lookup policy is specified as a text line using a human-understandable syntax and is created or modified by the system administrator.  Several sample configuration files are provided in /usr/examples/nsswitch and a copy of the standard default file is located in /usr/newconfig/etc.  The default file generates a behavior that is compatible with previous HP-UX releases,  and also represents the same behavior in the case where there is no /etc/nsswitch.conf configuration file present. 

The configuration file supports a policy entry for the following network databases (the possible information sources for each database are located in parentheses):

hosts (dns, nis, files)

services (nis, files)

protocols (nis, files)

networks (nis, files)

rpc (nis, files)

netgroup (nis, files)

The following (network information) sources may be available: dns (Domain Name System), (see named (1M)) nis (the Network Information Service), (see ypbind(1M)) and files (see hosts(4), services(4), protocols(4), networks(4) )

A name service switch entry is specified in the configuration file as follows:

info-class : src [  criteria src  [  criteria src  ] ]

wherein

info-class is a string which refers to the class of information being queried; currently only the host name and internet address info-class, hosts, is supported,

src is a string which refers to a source (network information service) to be queried; the valid sources for name service are dns, nis, and files, and

criteria is an optional field containing status=action string pairs enclosed in square brackets and represents the criteria for determining when to query the following source. The valid status strings are: SUCCESS, NOTFOUND, TRYAGAIN, and UNAVAIL.  The valid action strings are return and continue.  The action continue allows the use of the next source on the list, if the associated status for this action has occurred with the present source. The action return terminates the search and returns the results of the last query (if any) to the calling program. 

If no criteria is specified between two sources, then these default actions are assigned to the statuses:

SUCCESS=return
NOTFOUND=return
UNAVAIL=continue
TRYAGAIN=return

The only exception is that all the actions associated with the last source in the list are always set to return and cannot be overridden. 

The entry must be on a single line. Blank lines and lines beginning with a # sign, space or tab are treated as comment lines and are ignored. 

EXAMPLES

An example of a valid name service switch entry is:

hosts : dns [NOTFOUND=continue UNAVAIL=return TRYAGAIN=continue] files

If the preceding policy entry is used, then the /etc/hosts file will be checked whenever DNS returns a status of NOTFOUND due to an answer not being located in the DNS information service.  If the action for NOTFOUND had been return (the default), then the search for an answer would have been terminated after the DNS lookup.  If DNS is found to be unconfigured, thus returning the status UNAVAIL, then the next source is not tried and control is returned to the calling program (the default is to continue when UNAVAIL is the returned status).  If the DNS server(s) are configured, but they do not respond (i.e. time-out), then the status TRYAGAIN is returned and the next source will be tried (the default is to return to the calling program). 

The HP-UX default entry is given by:

hosts: dns nis files

services: nis files

networks: nis files

protocols: nis files

rpc: nis files

netgroup: nis files

FILES

/etc/nsswitch.conf Switch configuration file. 

AUTHOR

The name service switch was developed by Hewlett-Packard. 

SEE ALSO

getnetgrent(3C), getrpcbyname(3C), gethostbyname(3N), getnetbyname(3N), getportbyname(3N), nslookup(1M). 

Hewlett-Packard Company  —  HP-UX Release 10.20:  July 1996

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026