Operating System - HP-UX
1834903 Members
2643 Online
110071 Solutions
New Discussion

Re: /etc/nsswitch.conf question

 
SOLVED
Go to solution

/etc/nsswitch.conf question

I was having troubles with "localhost" on my 64-bit HP-UX 11.00 machine. Even though the last line of /etc/hosts looks like this:

127.0.0.1 localhost loopback

I could do this fine:

telnet 127.0.0.1 23

but not this:

telnet localhost 23

When I tried "telnet localhost 23" I got the error:

localhost: Unknown host

So I remembered that on Tru64 UNIX I had to change my /etc/svc.conf file to have this line:

hosts=bind,local,yp

and I think that the equivalent file on HP-UX 11.00 is . Below is my /etc/nsswitch.conf file. How should I change it so that "telnet localhost 23" will work for me (the "[NOTFOUND=return]" strings in this file are weird-looking)?!

bwilliam@pokie <93> more /etc/nsswitch.conf
#
# /etc/nsswitch.nis:
#
# An example file that could be copied over to /etc/nsswitch.conf; it
# uses NIS (YP) in conjunction with files.
#

passwd: files nis
group: files nis
hosts: dns [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: files nis
2 REPLIES 2
Bill Hassell
Honored Contributor
Solution

Re: /etc/nsswitch.conf question

Change the DNS resolution to:

hosts: files [NOTFOUND=continue] dns

By searching /etc/hosts first, you will increase reliability of network connections should the DNS server have a mistake or go offline. You can put the most important addresses in this file (important DNS addresses won't change very often).


Bill Hassell, sysadmin
A. Clay Stephenson
Acclaimed Contributor

Re: /etc/nsswitch.conf question

Hi:

THe 'return' value means give up.

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

This is all one line in /etc/nsswitch.conf.
The translation is try /etc/hosts first, if the host entry is not found or /etc/hosts is not found go to the next service which is dns.
If not found there continue to nis. Finally if notfound in nis THEN bail out.

man nsswitch.conf for full details.

Clay
If it ain't broke, I can fix that.