Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Installing and Administering NFS Services with 10.20 ACE and HWE: HP 9000 Networking > Chapter 5 Configuring the Name Service Switch

Troubleshooting the Name Service Switch

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

This section describes the following methods for troubleshooting your Name Service Switch configuration:

To Check the Syntax of the hosts Line

To check the syntax of the hosts line in /etc/nsswitch.conf file, start nslookup with the swdebug option, as follows:

nslookup -swdebug 

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:

# cat /etc/nsswitch.conf
hosts: dns [notfound=continue] nis [notfound=continue files

# nslookup -swdebug
__nsw[/etc/nsswitch.conf] 1->hosts: dns [notfound=continue] nis [notf
ound=continue files
__nsw[/etc/nsswitch.conf]LS->L<hosts>L<:>L<dns>L<[>L<notfound>L<=>L<c
ontinue>L<]>L<nis>L<[>L<notfound>L<=>L<continue>L<files>^Missing =^
__nsw.error_recovery: ERR- Error Recovery Completed
__nsw_getconfig: ERR- SYNTAX ERROR
__nsw_getdefault: default hosts lookup policy
Default Name Server: hpindbu.cup.hp.com

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 =^.

NOTE: The parser checks only the position of the elements with respect to the delimiters :, [, and ]. It does not check the spelling of all the elements. For example, if you type dsn instead of dns, you receive the PARSE SUCCESSFUL message. However, when you attempt a host name lookup, dsn is not a known name service, so DNS is not queried, and the lookup switches to the next configured source.

To Check the Current hosts Configuration

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:

# nslookup
> policy

The output for the default configuration is as follows:

# Lookups = 3
dns [RRCR] nis [RRCR] files [RRRR]

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

  • SUCCESS=return

  • NOTFOUND=return

  • UNAVAIL=continue

  • TRYAGAIN=return

For the following hosts line

hosts:  dns [NOTFOUND=continue]  files

the policy command displays the following:

# Lookups = 2
dns [RCCR] files [RRRR]

To stop the nslookup program, type exit.

To Trace a Host Name Lookup

To trace a host name lookup, start nslookup, set the swtrace option, and perform a lookup, as follows:

# nslookup
> set swtrace
> hostname

For the nsswitch.conf file containing the hosts line

hosts: dns [NOTFOUND=continue] nis [NOTFOUND=continue] files

the following example tries all three name services before it finds an answer:

# nslookup
> set swtrace
> romney
Name Server: hpindbu.cup.hp.com
Address: 15.13.104.13

lookup source is DNS
Name Server: hpindbu.cup.hp.com
Address: 15.13.104.13

*** hpindbu.cup.hp.com can't find romney: Non-existent domain

Switching to next source in the policy
lookup source is NIS
Default NIS Server: hpntc43c
Address: 15.13.119.52
Aliases: hpntc43c.cup.hp.com, hpntc43c-119, 3c-119

*** No address information is available for "romney"

Switching to next source in the policy
lookup source is FILES
Using /etc/hosts on: hpntc2k

Name: romney
Address: 15.13.104.128
NOTE: If you do not set swtrace, nslookup displays only the first name service where it looks for a host, even if it finds the host in another name service.
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1998 Hewlett-Packard Development Company, L.P.