It is important that every computer on a network has access to certain information. If you use simple configuration files, each host will need exactly the same information at all times. However, for large and dynamic networks, this is simply impractical because the information is complex and constantly changing. The Network Information Server (NIS) solves this problem by maintaining network information in a database on a server.
Any client on the network can then access the database for information on hosts, users, passwords, and more.
In order for a client to use NIS, it must be running two daemons.
- The first daemon,
portmap, allows applications running on the NIS client computer to obtain network information from the NIS server.
- The second daemon,
ypbind, is the NIS client daemon itself.
The "yp" found in most NIS tool names stands for Yellow Pages(tm), the former name of NIS.
You can think of NIS as a similar type of information resource for your network.
The portmap daemon in Red Hat Linux serves as a mediator between network services and the port numbers they use. It is responsible for mapping port numbers to the correct network service on a server, allowing clients to connect to the correct service using the correct port number. The portmap daemon listens on the well-known port 111 and responds to queries from client programs requesting information about network services. This information is then used by client programs to establish connections to network services running on the server. The portmap daemon is an essential component of the RPC (Remote Procedure Call) system used by many network services in Red Hat Linux.
NIS servers store information in databases, sometimes called maps. For example, you can have maps of hostnames to IP addresses, or users to passwords. Each map has a master server. This server is responsible for keeping all information up-to-date and available to clients. You can also set up slave servers, which merely keep an accurate copy of the master's database and handle NIS requests when the master is busy. The following series of images below explores some different ways NIS networks are organized.
You can set your Red Hat Linux computer's NIS domain name using the domainname command.
For example, if your NIS domain name were ooportal, you could set it by typing the following as the root user from the shell:
Set NIS domain name
To verify that your NIS domain name is set, simply type domainname and you will see the name. Unfortunately, you are not done yet. Running domainname does not set the NIS domain name permanently.
As soon as you reboot the computer, it is gone. (You can verify this by typing domainname again.) To make the NIS domain name permanent, you need to have the domainname command run automatically each time your system boots. There are many ways to do this.
What I did was add the command line (domainname trident) to a run−level script that runs before the ypbind daemon is started.
I edited the /etc/init.d/network file and added the following lines just after the first set of comment lines (about line number 9).
# Set the NIS domain name.
This caused my NIS domain name to be set each time my Red Hat Linux system booted. When you add this entry, make sure you spell the NIS domain name properly (including upper- and lowercase letters). If you get it slightly wrong, you will see ypbind failure messages when you boot.
Be very careful editing a run level script. Make a copy before you edit it.
If you make a mistake editing one of these files, you could find yourself with a network or other essential service that does not work.
The next lesson shows you how to obtain information about the network.