HPlogo Installing and Administering Internet Services: HP 9000 Networking > Chapter 2 Installing and Configuring Internet Services

Configuring the Name Service Switch

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

The Name Service Switch determines where your system will look for the information that is traditionally stored in the following files:

  • /etc/mail/aliases

  • AutoFS maps (like /etc/auto_master and /etc/auto_home)

  • /etc/group

  • /etc/hosts

  • /etc/netgroup

  • /etc/networks

  • /etc/passwd

  • /etc/protocols

  • /etc/publickey

  • /etc/rpc

  • /etc/services

For all types of information except host information, you can configure your system to use NIS (one of the NFS Services), NIS+ (the next generation of NIS), or the local /etc file, in any order. However, we recommend that you do not configure your system to use both NIS and NIS+.

For host information, you can configure your system to use BIND (DNS), NIS, NIS+, or the /etc/hosts file. As mentioned above, we recommend that you do not configure your system to use both NIS and NIS+.

The default Name Service Switch configuration is adequate for most installations, so you probably do not have to change it. The default configuration is explained in “Default Configuration”.

Beginning with the earlier HP-UX 10.30 release, the Name Service Switch has a different default behavior from the Name Service Switch in previous releases. If you have been using the pre-10.30 default Name Service Switch configuration (or if you do not have an /etc/nsswitch.conf file), and you want your host to continue to have that same pre-10.30 behavior, copy the /etc/nsswitch.hp_defaults file to /etc/nsswitch.conf. See “Default Configuration”. Also, for more information about the Name Service Switch configuration files supplied in the /etc directory, see Installing and Administering NFS Services.

The ability to consult more than one name service for host information is often called hostname fallback. The Name Service Switch provides client-side hostname fallback, because it is incorporated into client-side programs (for example, gethostbyname), which request host information.

The Network Information Service (NIS), one of the NFS Services, allows you to configure a server-side hostname fallback. This feature causes the NIS or NIS+ server to query BIND when it fails to find requested host information in its database. The NIS or NIS+ server then returns the host information to the client through NIS or NIS+. This server-side hostname fallback is intended for use with clients like PCs that do not have a feature like the Name Service Switch. Hewlett-Packard recommends that you use the Name Service Switch if possible, instead of the server-side hostname fallback provided by NIS and NIS+. For more information about the NIS server-side hostname fallback, see Installing and Administering NFS Services.

NOTE: Configuring the Name Service Switch is a separate task from configuring the name services themselves. You must also configure the name services before you can use them. The Name Service Switch just determines which name services are queried and in what order.

For more information about configuring the Name Service Switch, including the syntax of the configuration file and customizing your configuration, see Installing and Administering NFS Services. You can also type man 4 nsswitch.conf at the HP-UX prompt.

Hewlett-Packard recommends that you maintain at least a minimal /etc/hosts file that includes important addresses like gateways, diskless boot servers and root servers, and your host's own IP address. Hewlett-Packard also recommends that you include the word files in the hosts line to help ensure a successful system boot using the /etc/hosts file when BIND and NIS are not available.

Default Configuration

If the /etc/nsswitch.conf file does not exist, or if the line for a particular type of information is absent or syntactically incorrect, the following default configuration is used:

passwd:    files nis
group: files nis
hosts: dns [NOTFOUND=return] nis [NOTFOUND=return] files
networks: nis [NOTFOUND=return] files
protocols: nis [NOTFOUND=return] files
rpc: nis [NOTFOUND=return] files
publickey: nis [NOTFOUND=return] files
netgroup: nis [NOTFOUND=return] files
automount: files nis
aliases: files nis
services: nis [NOTFOUND=return] files

If your /etc/nsswitch.conf file contains a syntactically correct line for a particular type of information, that line is used instead of the default. For more information about configuring the Name Service Switch, including the syntax of the configuration file and customizing your configuration, see Installing and Administering NFS Services.

Troubleshooting the Name Service Switch

Issue the nsquery command to perform a hosts, passwd, or group lookup, as follows:

/usr/contrib/bin/nsquery lookup_type lookup_query

The lookup_type can be hosts, passwd, or group.

The lookup_query can be a host name or IP address, a user name or user ID, or a group name or group ID.

The nsquery command displays the Name Service Switch configuration that is currently in use. Then, it displays the results of the query. The following example uses nsquery to perform a lookup of the host name romney:

# /usr/contrib/bin/nsquery hosts romney

Using "nisplus [NOTFOUND=return] files" for the hosts policy.

Searching nisplus for romney
romney was NOTFOUND

Switch configuration: Terminates Search

As an optional third argument to nsquery, you can supply a Name Service Switch configuration in double quotes, as in the following example:

# /usr/contrib/bin/nsquery passwd 30 "files nis"

Using "files nis" for the passwd policy.

Searching /etc/passwd for 30
User name: www
User ID: 30
Group ID: 1
Gecos:
Home Directory: /
Shell:

Switch configuration: Terminates Search

For more information, type man 1 nsquery at the HP-UX prompt.

© 2000 Hewlett-Packard Development Company, L.P.