KnowHow

技術的なメモを中心にまとめます。
検索にて調べることができます。

NISクライアントは、NISサーバの/etc/hostsを参照する。

登録日 :2024/03/17 08:19
カテゴリ :Linux

NISサーバとNISクライアントを構築したところ、NISサーバの/etc/hostsを参照していることを確認できた。この設定は、/etc/nsswitch.confに記載されているようである。

root@headnode log]# cat /etc/nsswitch.conf
# Generated by authselect on Sat Mar 16 22:57:31 2024
# Do not modify this file manually.

# If you want to make changes to nsswitch.conf please modify
# /etc/authselect/user-nsswitch.conf and run 'authselect apply-changes'.
#
# Note that your changes may not be applied as they may be
# overwritten by selected profile. Maps set in the authselect
# profile takes always precedence and overwrites the same maps
# set in the user file. Only maps that are not set by the profile
# are applied from the user file.
#
# For example, if the profile sets:
#     passwd: sss files
# and /etc/authselect/user-nsswitch.conf contains:
#     passwd: files
#     hosts: files dns
# the resulting generated nsswitch.conf will be:
#     passwd: sss files # from profile
#     hosts: files dns  # from user file

aliases:    files nis
automount:  files nis
ethers:     files nis
group:      files nis systemd
hosts:      files nis dns myhostname
initgroups: files nis
netgroup:   files nis
networks:   files nis
passwd:     files nis systemd
protocols:  files nis
publickey:  files nis
rpc:        files nis
services:   files nis
shadow:     files nis

NISクライアントの/etc/hostsには、newheadのIPアドレス記述はないが、pingで名前解決できていることがわかる。

[root@headnode log]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.56.101 manage
192.168.56.112 compute01
[root@headnode log]# ping newhead
PING newhead (192.168.56.104) 56(84) bytes of data.

これは、NISサーバの/etc/hostsに記述があるからである。

[user01@manage ~]$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.56.101 manage rocky8_server
192.168.56.102 node1 rocky8_client_n1
192.168.56.103 node2 rocky8_client_n2
192.168.56.104 newhead rocky8_client_new_head
192.168.56.111 headnode
192.168.56.112 compute01
[user01@manage ~]$