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:
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:
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
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.