- Table of Contents
- Copyright
- About the Lead Authors
- About the Contributing Authors
- Acknowledgments
- Tell Us What You Think!
- Introduction
- I. Red Hat Linux Installation and User Services
- Chapter 1. Introduction to Red Hat Linux
- Chapter 2. Installation of Your Red Hat System
- Chapter 3. LILO and Other Boot Managers
- Chapter 4. Configuring the X Window System, Version 11
- Chapter 5. Window Managers
- Chapter 6. Connecting to the Internet
- Chapter 7. IRC, ICQ, and Chat Clients
- Chapter 8. Using Multimedia and Graphics Clients
- II. Configuring Services
- Chapter 9. System Startup and Shutdown
- Chapter 10. SMTP and Protocols
- Chapter 11. FTP
- Chapter 12. Apache Server
- Chapter 13. Internet News
- Chapter 14. Domain Name Service and Dynamic Host Configuration Protocol
- Chapter 15. NIS: Network Information Service
- Chapter 16. NFS: Network Filesystem
- Chapter 17. Samba
- III. System Administration and Management
- Chapter 18. Linux Filesystems, Disks, and Other Devices
- Chapter 19. Printing with Linux
- Chapter 20. TCP/IP Network Management
- Chapter 21. Linux System Administration
- Chapter 22. Backup and Restore
- Chapter 23. System Security
- IV. Red Hat Development and Productivity
- Chapter 24. Linux C/C++ Programming Tools
- Chapter 25. Shell Scripting
- Chapter 26. Automating Tasks
- Chapter 27. Configuring and Building Kernels
- Chapter 28. Emulators, Tools, and Window Clients
- V. Appendixes
- A. The Linux Documentation Project
- B. Top Linux Commands and Utilities
- C. The GNU General Public License
- D. Red Hat Linux RPM Package Listings
Configuring a NIS Client
Compared to configuring a NIS server, NIS clients are trivial. You must deal with three files, /etc/yp.conf, /etc/sysconfig/network, and /etc/nsswitch.conf.
There are two ways you can edit these files. You can edit them manually or you can use linuxconf. The most accurate way to make the changes is to edit the files manually. However, if you are a beginner and not used to editing configuration files, perhaps you should use linuxconf the first couple of times until you come to grips with what is happening.
Configuring a NIS Client with linuxconf
Type linuxconf at the command prompt. Then go to Networking, Client Tasks, and then Network Information System (NIS).
You are asked for the NIS domain name and for the name of the NIS server. Enter the domain name, that is, audionet.domain.com.
You are asked to enter the name of the NIS server. You have two choices here. You can leave the entry blank, in which case the client will just send a broadcast message to the network and it will bind to the first server to respond. The second option is to specify the name of the server; if you do this the client will always bind to that server. Basically, if there is only one NIS server for that domain, specify the name of it; if there are more than one, then leave the entry blank.
Now click Accept, then Act Changes, and then Quit.
linuxconf has now done two things. It has added an entry in the /etc/sysconfig/ network file:
NISDOMAIN="audionet.domain.com"
This file is checked when the computer boots and it sets the domainname from this entry.
If you specified a NIS server, an entry will have been added to /etc/yp.conf such as
ypserver vestax.audionet.domain.com
If you did not specify a NIS server, the /etc/yp.conf file will not have been changed at all. This may not work; you may need to add an entry to /etc/yp.conf such as
domain NISDOMAIN broadcast
where NISDOMAIN is the domain name that you have chosen, in this case audionet.domain.com.
That's two of the three files dealt with. The last file to deal with is /etc/nsswitch.conf. This file is more involved than the other two but a default file comes with Red Hat Linux 7 and for most users this file will be perfectly acceptable. There is a section under Configuring a NIS Client Manually later in this chapter describing how to edit this file.
Now that you have made all the necessary changes to all the relevant files there is only one thing left to do. You must set up the client daemon to automatically start at boot time. You do this by creating a symbolic link from /etc/rc3.d/S63ypbind to /etc/init.d/ypbind. The exact commands are as follows.
[root@client /root]# cd /etc/rc3.d [root@client rc3.d]# ln –s ../init.d/ypbind S63ypbind
Configuring a NIS Client Manually
The first file to edit is /etc/yp.conf. The entries in this file are used for the initial binding. Use one of the following valid entries:
domain NISDOMAIN server HOSTNAME
Use server HOSTNAME for the domain NISDOMAIN. You could have more than one entry of this type for a single domain.
domain NISDOMAIN broadcast
Use broadcast on the local net for domain NISDOMAIN. Use this option if there is more than one NIS server on the network.
ypserver HOSTNAME
Use server HOSTNAME for the local domain. The IP address of the server must be listed in /etc/hosts.
The second file to edit is /etc/sysconfig/network. This file is used to set the NIS domain name at boot time. To do this, simply add this line:
NISDOMAIN="domainname"
domainname is the same as specified in the /etc/yp.conf file (in this case, audionet.domain.com).
The last file that needs to be changed is /etc/nsswitch.conf. This is slightly more involved than the previous files; however, a default file comes with the Red Hat installation. This file is used to configure which services are used to determine information such as hostnames, password files, and group files.
Begin by opening /etc/nsswitch.conf with your favorite editor. Scroll past the comments (those lines beginning with the # symbol). You should see something like this:
passwd: files nisplus nis shadow: files nisplus nis group: files nisplus nis hosts: files nisplus nis dns services: nisplus [NOTFOUND=return] files etc...
The first column indicates the file in question. In the first line, this is passwd. The next column indicates the source for the file. This can be one of six options listed in Table 15.1.
Table 15.1. Editing /etc/nsswitch.conf
| Option | Description |
| nis | Uses NIS to determine this information. |
| yp | Uses NIS to determine this information (alias for nis). |
| Dns | Uses DNS to determine this information (only applicable to hosts). |
| files | Uses the file on the local machine to determine this information (for example, /etc/passwd). |
| [NOTFOUND=return] | Stops searching if the information has not been found yet. |
| nisplus | Uses NIS+. |
The order in which these are placed in the /etc/nsswitch.conf file determines the search order used by the system. For example, in the hosts line, the order of the entries is files nis dns, indicating that hostnames are first searched for in the /etc/hosts file, then via NIS in the map hosts.byname, and finally by DNS via the DNS server specified in /etc/resolv.conf.
In almost all instances, you want to search the local file before searching through NIS or DNS. This allows a machine to have local characteristics (such as a special user listed in /etc/passwd) while still using the network services being offered. The notable exception to this is the netgroup file that by its very nature should come from NIS.
Modify the order of your searches to suit your site's needs and save the configuration file.
Now that all the files are in place, set up the client daemon to automatically start at boot time. You do this by creating a symbolic link from /etc/rc.3/S63ypbind to /etc/init.d/ypbind. The exact commands are as follows:
[root@client /root]# cd /etc/rc3.d [root@client rc3.d]# ln -s ../init.d/ypbind S63ypbind
Testing the Client
Because of the way NIS works under Red Hat, you do not need to reboot to start NIS client functions. To see if you can communicate with the NIS server, start by setting the domain name by hand. You can do so with the following command:
[root@client /root]# domainname nis_nis_domaindomain
nis_domain is the NIS domain name. In the test case, it is audionet.domain.com. Start the NIS client daemon, ypbind, with this command:
[root@client /root]# /etc/init.d/ypbind start
With the NIS client and server configured, you are ready to test your work:
ypcat passwd
If your configuration is working, you should see the contents of your NIS server's /etc/passwd.yp file displayed on your screen (assuming, of course, that you chose that file to be shared via NIS for your passwd file). If you receive a message such as
No such map passwd.byname. Reason: can't bind to a server which serves domain
you need to double-check that your files have been properly configured.
Configuring a NIS Secondary Server | Next Section

Account Sign In
View your cart