1. NIS is a CS structure. All data files (such as/etc/hosts,/etc/passwd) of NIs are called maps, that is, the information retained by all NIS servers is changed to maps. The client communicates with the NIS server to obtain these maps. NIS slave server also has maps, but they cannot modify maps. They only accept queries from clients. NIS master server saves the latest version of the maps and can modify them. Once we modify the maps on the master server, we need to immediately notify the slave server to update their maps. for the client, it does not need to care whether the maps obtained by itself come from the master or slave server. The following figure shows the problem:
Appendix 1
2. BTW: NIS data files, NIS database, and NIS maps. They all mean one thing.
3. in reality, many machines may be connected to a network segment, but their directory information may be different, using NIs to manage the data makes it necessary to distinguish different machines. To this end, NIS invented the concept of domain. Although many machines are in a network segment, when they need NIS maps, they need to first identify which NIS domain to obtain, this avoids mutual interference. We can also configure multiple NIS servers. In short, we can regard NIS domain as a set of NIS maps with significant mark.
4. the command domainname can be used to set the domain of NIS (not DNS or other domain), but this setting will expire after the machine restarts, unless: Modify/etc/sysconfig/network, add nisdomain = xxx (add domainname to the/etc/defaultdomain file under RedHat and Solaris) or add the domainname statement to the startup process, graceful can be added to the/etc/rc2.d/s69inet script. Otherwise, it will be placed in RC. the same is true for local. Input domainname to print the specified NIS domain
5. Files managed by NIs, I .e., the files available by NIs map: attachment 2
6. This book also mentions that it makes sense not to include root users in the NIS management field. The book provides such a solution: first copy/etc/passwd to another place, then manually delete the root user line, and then modify/var/yp/makefile, tell him to find the files passwd in another place (search under/etc/by default), as shown below:
Newmaster # mkdir/etc/nispw
Newmaster # chmod 0700/etc/nispw
Newmaster # grep-V '^ root:'/etc/passwd>/etc/nispw/passwd
Newmaster # grep-V '^ root:'/etc/shadow>/etc/nispw/shadow
Newmaster # cp/var/yp/makefile. Save
# Change the pwdir variable to/etc/nispw
Newmaster # vi/var/yp/makefile
In fact, I did a research. This is not necessary, because a configuration in makefile is called minuid. The default value is 500. This indicates that NIS will search for the user data to be managed from uid greater than 500, this ensures that the root user will not be implicated. It may be that this book is old.
7. Use ypinit-m to generate maps, and an NIS master server is OK (set nisdomain, start ypserv, and execute ypinit-m ).
8. Set up an NIS slave server. Edit/etc/hosts, enter the hostname and IP address of the NIS master server, edit/etc/sysconfig/network, input the NIS domain, and then run ypinit-C, this means that the local machine is used as an NIS client, and then the hostname of the NIS master server and the hostname of other slave servers are entered, in this way, ypbind can work normally (NIS slave server uses ypbind to obtain updated maps), and finally enters ypinit-S <NIS master Server Hostname>. In this way, an slave server is OK, of course, after this is done, ypserv needs to be started. Therefore, ypbind and ypserv must be started on the NIS slave server.
9. NIS client, you need to edit/etc/sysconfig/network, set NIS domain, and then use ypinit-C to set NIS servers. We usually do not do this step. If we do not do this step, then, ypbind searches for ypserver through broadcast.
10. what we will talk about later in this book is getting increasingly boring. We don't need to care about the construction of maps files. So far, it seems that the first chapter of network fundamental has gained a lot, and a bad thing in this book is that many command lines are on Solaris and cannot stand it.