The Nameservice Switch

Solaris provides the /etc/nsswitch.conf nameservice switch file that you can use to tailor the nameservice policy of individual systems to use multiple nameservices in the Solaris environment. You can specify the following configurations with the /etc/nsswitch.conf file.

  • Which nameservices are used for each type of configuration information, such as password or host IP address.

  • The order in which the different nameservices are used for each type of information.

  • The criteria for search continuation if information is not found or if a nameservice is not available.

You can use the /etc/nsswitch.conf file to set flexible policies for nameservice use and to describe and change these policies after site requirements change. For example, a system running the Solaris Operating Environment could obtain its host's information from DNS, its group information from NIS maps, and its password information from the local /etc/passwd file.

The /etc/nsswitch.conf file also simplifies migration from NIS to NIS+, because both Solaris 1.x and Solaris 2.x systems can be clients of Solaris 1.x NIS servers. In addition, Solaris 2.x systems can be clients of both NIS and NIS+, which enables the two nameservices to coexist during the transition. If you combine NIS and NIS+ domains, make sure that they both use the same domain name. The NIS/NIS+ domain name is usually, but not always, the same as the DNS domain name.

NOTE

The Solaris 8 Operating Environment supports the printers database in the /etc/nsswitch.conf nameservice switch file. The printers database provides centralized printer configuration information to print clients on the network. With the printers database and corresponding sources of information in the nameservice switch file, print clients can automatically access printer configuration information without having it added to their own systems. The printers database is configured by the Solaris Print Manager when you add a printer to a system.


When you install the Solaris Operating Environment, the /etc directory contains a default nsswitch.conf file and the files nsswitch.files, nsswitch.nis and nsswitch.nisplus.The Solaris 8 release also provides nsswitch.dns and nsswitch.ldap, which provide default settings for each of these possible sources of nameservice information: files, NIS, NIS+, DNS, and LDAP. The default nsswitch.nisplus file is shown below.



#
# /etc/nsswitch.nisplus:
#
# An example file that could be copied over to /etc/nsswitch.conf; it
# uses NIS+ (NIS Version 3) in conjunction with files
#
# "hosts:" and "services:" in this file are used only if the
# /etc/netconfig file has a "-" for nametoaddr_libs of "inet" transports.

# the following two lines obviate the "+" entry in /etc/passwd and /etc/group.
passwd:     files nisplus
group:      files nisplus

# consult /etc "files" only if nisplus is down. 
hosts:      nisplus [NOTFOUND=return] files
ipnodes:    files
# Uncomment the following line and comment out the above to resolve
# both IPv4 and IPv6 addresses from the ipnodes databases. Note that
# IPv4 addresses are searched in all of the ipnodes databases before
# searching the hosts databases. Before turning this option on, consult
# the Network Administration Guide for more details on using IPv6.
#ipnodes:    nisplus [NOTFOUND=return] files

#Uncomment the following line, and comment out the above, to use both DNS
#and NIS+.  You must also set up the /etc/resolv.conf file for DNS name
#server lookup.  See resolv.conf(4).
#hosts:     nisplus dns [NOTFOUND=return] files

services:   nisplus [NOTFOUND=return] files
networks:   nisplus [NOTFOUND=return] files
protocols:  nisplus [NOTFOUND=return] files
rpc:        nisplus [NOTFOUND=return] files
ethers:     nisplus [NOTFOUND=return] files
netmasks:   nisplus [NOTFOUND=return] files
bootparams: nisplus [NOTFOUND=return] files

publickey:  nisplus

netgroup:   nisplus

automount:  files nisplus
aliases:    files nisplus
sendmailvars:   files nisplus

printers:       user nisplus files xfn

auth_attr:  files nisplus
prof_attr:  files nisplus

When you set up an NIS+ server or client system, you must copy the /etc/nsswitch.nisplus file to /etc/nsswitch.conf. After you have copied the file, you can either use the default file or customize it to suit the needs of your site. For example, if your site uses DNS, change the hosts entry in the /etc/nsswitch.conf file to hosts: files dns. Sun suggests that you start by using the default file and customize it only if you need to do so.

Table 28 lists the locations that the /etc/nsswitch.conf file can search for information.

Table 28. Location of Name Service Information.
Location Description
files File on the client's local system.
nisplus An NIS+ table.
nis An NIS map.
compat Supports old-style “+” syntax for passwd and group.
dns Applies only to the hosts entry.
ldap Lightweight Directory Access Protocol (LDAP) nameservice.

When NIS+ searches one or more of these locations, it returns one of the four status messages listed in Table 29.

Table 29. Name Service Switch Status Messages
Status Message Description
SUCCESS Found a valid result.
UNAVAIL Could not use the source.
NOTFOUND Information not in the source.
TRYAGAIN Source returned an “I'm busy, try later” code.

In the /etc/nsswitch.conf file, you can specify what action NIS+ should take when it returns one of these status messages. The actions you can specify are the following.

  • continueTry the next source.

  • returnStop trying, and return this result.

If no action is specified in the /etc/nsswitch.conf file, NIS+ uses the default value [NOTFOUND=continue].

The entries in the /etc/nsswitch.conf file have the following syntax.

						table: location [location...] [status=action] [location]

The table variable contains the name of the NIS map, the NIS+ table, or the /etc file. The location variable specifies the first place for the system to search, using any of the locations shown in Table 28. If you want, you can specify additional locations to search. You can also specify an action (continue or return) if one of the status messages shown in Table 29 is encountered.

In the default NIS+ file, local /etc files are not consulted for hosts, services, networks, protocols, rpc, ethers, netmasks, and bootparams unless NIS+ is down. If the entry is not found, the [NOTFOUND=return] entry prevents NIS+ from consulting the /etc files. If you want NIS+ to consult the appropriate /etc file on the local system when an entry is not found in the NIS+ table, edit the default file and remove the [NOTFOUND=return] entries.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.178.190