Home > Articles > Operating Systems, Server > Solaris

This chapter is from the book

Solaris Naming Service Switch Architecture

The main components that constitute the architecture are the Network Services libraries, the policy configuration file, and interfaces to the available naming services. A special tag identifies the location where the requested information is actually stored. As shown in FIGURE 2-1 the available tags are files, nis, nisplus, dns, compat (for passwd), with ldap added to the Solaris 8 operating environment.

FIGURE 2-1 Naming Service Switch Functions

FIGURE 2-1 shows the flow of information when an application calls the Network Services libraries. These library calls are in the form of getXbyY, for example, gethostbyname(), and are independent of any naming service. When the application makes the call, the library routine consults the nsswitch.conf file to determine which naming services to consult. The specified naming services are then searched in order until a match is found or a NOTFOUND error is returned.

The policies that determine which naming service sources are searched and in what order reside in the /etc/nsswitch.conf file. Sample configuration files that favor a particular naming service are provided with the Solaris operating environment in the /etc directory. These files are copied and automatically used as the nsswitch.conf file when a primary naming service is chosen during the Solaris installation process.

An example of the configuration files that favor nis follows.

# /etc/nsswitch.nis:
# An example file that could be copied over to /etc/nsswitch.conf; it
# uses NIS (YP) 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/
passwd: files nis
group: files nis
# consult /etc "files" only if nis is down.
hosts: nis [NOTFOUND=return] files
ipnodes: files
networks: nis [NOTFOUND=return] files
protocols: nis [NOTFOUND=return] files
rpc: nis [NOTFOUND=return] files
ethers: nis [NOTFOUND=return] files
netmasks: nis [NOTFOUND=return] files
bootparams: nis [NOTFOUND=return] files
publickey: nis [NOTFOUND=return] files
netgroup: nis
automount: files nis
aliases: files nis

The objects for which search policies can be set appear on the left. The search order, or policy, appears to the right of the object. In the case of the passwd object, the local /etc/passwd file is checked first for the user's name, and if the name is found, the password is returned. If the user's name is not found in the /etc/passwd file, the nis passwd map is searched.

The tag NOTFOUND=return is used to direct the switch to look only in the naming services listed to the left unless these services are not operational. In the sample file, files would only be consulted if nis is not responding. This tag speeds up search times by eliminating unnecessary searches and at the same time provides a backup if the primary naming service is down.

  • + Share This
  • 🔖 Save To Your Account