1833728 Members
2279 Online
110063 Solutions
New Discussion

Re: nsswitch.conf

 
SOLVED
Go to solution
Shivkumar
Super Advisor

nsswitch.conf

Hi,

I don't see nsswitch.conf file in /etc/ for hostname resolution order.

I see only below mentioned files:

nsswitch.compat
nsswitch.files
nsswitch.hp_defaults
nsswitch.nis
nsswitch.nisplus

Can anyone suggest why nsswitch.conf doesn't exist here ?

Does HPUX resolves hostnames using file other than "nsswitch.conf" ?

Thanks,
Shiv
7 REPLIES 7
Victor Fridyev
Honored Contributor

Re: nsswitch.conf

Hi,

These files are examples for different NIS types resolution orders. Look at the files and copy the nearest to your requirements to /etc/nsswitch.conf.

I usually copy nsswitch.files and add dns to name resolution and, when needed, nis to passwd and group in needed order.

HTH
Entities are not to be multiplied beyond necessity - RTFM
DCE
Honored Contributor

Re: nsswitch.conf


The system will work of the local files (hosts, passwords, group, etc) if there is no nsswitch.conf.

the nsswirch.conf file is used when you want a remote server to handle a named service resolution.

If yu want to use a nsswitch.conf file chose the example file closest to your configuration and copy it to nsswitch.conf. Then modify it as neccessary.
Bill Hassell
Honored Contributor
Solution

Re: nsswitch.conf

man switch

will tell you a lot of the details. You don't need the nsswitch.conf file if you only use /etc/hosts, or if you only use DNS (the /etc/resolv.conf file). Use nsswitch.conf when you need to be more precide about the order of hostname resolution.


Bill Hassell, sysadmin
Shivkumar
Super Advisor

Re: nsswitch.conf

Bill,

Should we use nsswitch.conf or not and what is the best practice for this ?

What is your recommendation ?

Thank,
Shiv
Deoncia Grayson_1
Honored Contributor

Re: nsswitch.conf

Well if you use DNS and your hosts file then you may want to use the nsswitch.conf to specify the order in which to resolve a server name or ip address, since my site use both, we specify the order.
If no one ever took risks, Michelangelo would have painted the Sistine floor. -Neil Simon
Bill Hassell
Honored Contributor

Re: nsswitch.conf

If you have a DNS server and do not use LDAP or NIS, the best solution is to specify nsswitch.conf like this:

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

This allows you to put a few production systems or printers into /etc/hosts if needed.


Bill Hassell, sysadmin
Chauhan Amit
Respected Contributor

Re: nsswitch.conf

Hello Shiv,

Reply is Inline,

Should we use nsswitch.conf or not and what is the best practice for this ?
What is your recommendation ?

A)The operating system uses a number of "databases" of information about hosts, users (passwd), groups and so forth. Data for these can come from a variety of sources: host-names and -addresses, for example, may be found in /etc/hosts, NIS, NIS+, LDAP or DNS. One or more sources may be used for each database; the sources and their lookup order are specified in the /etc/nsswitch.conf file.

As Bill mentioned in case you are usiing "/etc/hosts" (file) or "/etc/resolv.conf" (DNS Server) for Name resolution then there is no need for this file. But you can definitely give ur First preference for name resolution via this file.



The library functions contain compiled-in default entries that are used if the appropriate entry in nsswitch.conf is absent or syntactically incorrect. The entries are as follows:

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
ipnodes: dns [NOTFOUND = return] files


-Amit
If you are not a part of solution , then you are a part of problem