Next: Choosing the Right Maps Up: The Network Information System Previous: Running a NIS Server

# Setting up a NIS Client with NYS

Throughout the remainder of this chapter, we will cover the configuration of a NIS client.

Your first step should be to tell NYS which server to use for NIS service, setting it in the /etc/yp.conf configuration file. A very simple sample file for a host on the Winery's network may look like this:

The first statement tells all NIS clients that they belong to the winery NIS domain. If you omit this line, NYS will use the domain name you assigned your system through the domainname command. The server statement names the NIS server to use. Of course, the IP address corresponding to vbardolino must be set in the hosts file; alternatively, you may use the IP-address itself with the server statement.

In the form shown above, the server command tells NYS to use the named server whatever the current NIS domain may be. If, however, you are moving your machine between different NIS domains frequently, you may want to keep information for several domains in the yp.conf file. You can have information on the servers for various NIS domains in yp.conf by adding the NIS domain name to the server statement. For instance, you might change the above sample file for a laptop to look like this:

This allows you to bring up the laptop in any of the two domains by simply setting the desired NIS domain at boot time through the domainname command.

After creating this basic configuration file and making sure it is world-readable, you should run your first test to check if you can connect to your server. Make sure to choose any map your server distributes, like hosts.byname, and try to retrieve it by using the ypcat utility. ypcat, like all other administrative NIS tools, should live in /usr/sbin.

The output you get should look something like that shown above. If you get an error message instead that says ``Can't bind to server which serves domain'' or something similar, then either the NIS domain name you've set doesn't have a matching server defined in yp.conf, or the server is unreachable for some reason. In the latter case, make sure that a ping to the host yields a positive result, and that it is indeed running a NIS server. You can verify the latter by using rpcinfo, which should produce the following output:

Next: Choosing the Right Maps Up: The Network Information System Previous: Running a NIS Server