| United States-English |
|
|
|
![]() |
Installing and Administering Internet Services: HP 9000 Networking > Chapter 2 Installing and Configuring Internet ServicesConfiguring the Name Service Switch |
|
The Name Service Switch determines where your system will look for the information that is traditionally stored in the following files:
For all types of information except host information, you can configure your system to use NIS (one of the NFS Services), the local /etc file, or both, in any order. For host information, you can configure your system to use BIND (DNS), NIS, the /etc/hosts file, or any combination of the three, in any order. 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”.
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 server to query BIND when it fails to find requested host information in its database. The NIS server then returns the host information to the client through 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. For more information on the NIS server-side hostname fallback, see Installing and Administering NFS Services. You can use SAM to configure the Name Service Switch. Type sam at the HP-UX prompt. Following are some suggestions for customizing your Name Service Switch configuration:
HP 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. HP 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.
A default nsswitch.conf file is supplied in the /usr/newconfig/etc directory. It contains the following lines:
This is the default configuration. In other words, if you copy /usr/newconfig/etc/nsswitch.conf to /etc/nsswitch.conf, the Name Service Switch behaves the same way it would if no /etc/nsswitch.conf file existed. Figure 2-1 “Default Behavior of the Name Service Switch” illustrates the default behavior of the Name Service Switch for host information lookups. The configuration file for the Name Service Switch is /etc/nsswitch.conf, which consists of lines with the following syntax:
Table 2-1 “Values for Variables in the /etc/nsswitch.conf File” displays the possible values for each variable. Table 2-1 Values for Variables in the /etc/nsswitch.conf File
If you specify any status=action pairs, the set of status=action pairs for each source must be enclosed in square brackets [ ]. If the /etc/nsswitch.conf file does not exist, or if no source is specified in it, the default search order is as follows:
The default status=action pairs are as follows:
The default search order for host information is shown in Figure 2-1 “Default Behavior of the Name Service Switch”. For more information on the Name Service Switch, type man 4 switch at the HP-UX prompt. To check the syntax of the hosts line in /etc/nsswitch.conf file, start nslookup with the swdebug option, as follows:
You will see the output of the parser as it reads the hosts line in your nsswitch.conf file. If your hosts line is syntactically correct, you will see the line __nsw_getconfig: PARSE SUCCESSFUL. If your hosts line contains a syntax error, you will see the line __nsw_getconfig: ERR-SYNTAX ERROR. The following example checks the syntax of a hosts line that is missing a closing square bracket:
The parser indicates the error with carats (^). In this case, the parser reads the word files as another status following notfound=continue, because it has not encountered a closing square bracket. If the word files were a status, it must be followed by an equal sign, and it is not. So the parser displays the message ^Missing =^.
To check the Name Service Switch configuration that your system is currently using for host information, start nslookup and issue the policy command, as follows:
The output for the default configuration is as follows:
The letters in square brackets stand for (R)eturn or (C)ontinue. They represent the values of the four status values, SUCCESS, NOTFOUND, UNAVAIL, and TRYAGAIN. In the example, the status=action pairs configured for dns and nis are
For the following hosts line
the policy command displays the following:
To stop the nslookup program, type exit. To trace a host name lookup, start nslookup, set the swtrace option, and perform a lookup, as follows:
For the nsswitch.conf file containing the hosts line
the following example tries all three name services before it finds an answer:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||