���S���Q�L�A�p�G�ڦ��Q�� Linux �D���A�o�Q���D���ȭt�d���P���\��A�ƹ�W�A�Ҧ����D���b���P�������K�X���ۦP�I����ڬO�N�b���P�K�X���O�]�w�m�b�Q���q���W���A�٬O�i�H�z�L�@���D�������b���z���\��A�M���L���D���u�n���Τ�εn�J�ɡA�N�����n��z�b�����D���W���T�{��b���P�K�X�O�H���@�Ӥ����K�ӥB�F���H���M�O��@�ӱb���z���D�������K���h�աI�p�G���ϥΪ̭n�ק�K�X�A�����n�h��Q���D���ק�K�X�աI�u�n��D�n�z�D���h�ק�A��L���D���ڥ��N���ݭn��ʡI�����I���P�S�r�֩O�I�o�ӥ\��F�����ܦh���覡�A�b�o�̡A�ڭ̤��Ф@�ӫ�²�檺�覡�A���N�O Network Information Service �o�� NIS ���A�����[�]�աI |
[root@test
root]# /etc/rc.d/init.d/portmap start
[root@test root]# netstat -tl Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 *:sunrpc *:* LISTEN # �p�G�ݨ� sunrpc ���ܡA�N���ܱҰʦ��\�F�I [root@test root]# chkconfig --level 35 portmap on # �W���o�@��b�]�w portmap �b run-level �� 3, 5 ���ɭԴN�}���ɱҰʡI |
[root@test
root]# vi /etc/xinetd.d/time
# ��쩳�U�o�@��G disable = yes # �N�L�令 disable = no # �x�s�����} [root@test root]# vi /etc/xinetd.d/time-udp # �P�˪��N disable = yes �令 disable = no �Y�i�I �@ [root@test root]# /etc/rc.d/init.d/xinetd restart [root@test root]# netstat -utl Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 *:time *:* LISTEN tcp 0 0 *:sunrpc *:* LISTEN udp 0 0 *:time *:* udp 0 0 *:sunrpc *:* |
1. �إ� NIS
�����W�� (�ڳo�̬O�]�w�� cluster )�G
[root@test root]# nisdomainname cluster [root@test root]# vi /etc/rc.d/rc.local # �N���U�o�@��[�J�o���ɮת��̫�@�椺�G /bin/nisdomainname cluster �@ 2. �]�w�n�����ѼơG [root@test root]# vi /etc/sysconfig/network # �[�J���U�o�@��G NISDOMAIN=cluster |
<�]�w����>:<�]�w���ت���> |
[root@test
root]# vi /etc/ypserv.conf
files: 30 # �o�����O�y���h�ָ�Ʈw�ɮ�(database file)�|�Q��Ū�i�֨��O��������z # ���N��A�@��ӻ��A 30 �O�w�g�ܨ������ƭȤF�A���ݭn��ʥL�F �@ trusted_master: your.master.servers.name xfr_check_port: yes # �W���o��ӳ��ȻP Master + Slave �[�c�������]�w�ȡA�@��ӻ��A # �u���@���D�n NIS Server ���t�Τ��O�Τ���o��ӳ]�w�Ȫ��I # �p�G�A�� NIS �O slave ���[�c�A����ݭn���w�@�� master ������Ʈw���e�� # �P�B�ɭԪ��D���A���N�O trusted_master ���]�w���e�o�I # �p�G�S�� master/slave �[�c�ɡA���N���ݭn trusted_master �o�ӳ]�w�F�I # �ܩ� xfr_check_port �h�O���w master �P slave �O�_���n�H < 1024 # �H�U�� port �Ӷi�淾�q���T���I�q�`�w�]�N�O yes �A���ݭn��ʥL�I �@ # <�D���W��/IP>:<����W��>:<��Ʈw���O>:<�w����> # �o�ӬO�o���ɮ̭��̭��n�������F�I�D�n�b�]�w�w���ʪ��譱�A # �i�H�]�w�h��A�ӬO�_����q�L���W�h�O�y�@��@���ˬd�z���覡�I # �ҥH�o�̪��]�w���ӬO�G���}��n�}����A�M������������I # ���ͤ@�ͦU�Ӭ��������ءG # 1. �D���W��/IP�G�o�̥i�H�o�˳]�w�G192.168.1.0/255.255.255.0 # 2. ����W���G�q�`���]�w���� * �Y�i�I # 3. ��Ʈw���O�G�i�H�ϥ� * �Ӫ��ܩҦ�����Ʈw�I # 4. �w�����G�D�n���T�ذѼơG #�@�@�@�@�@�@none �G�L�צp��N�O�i�H�L����i�J�����F #�@�@�@�@�@�@port �G�Ȥ��\ < 1024 �H�U�� port �i�J�F #�@�@�@�@�@�@deny �G�L�צp��N�O���������H�a�n�J�D���I # �ѩ�ڬO���\ 127.0.0.0/255.0.0.0 �H�� 192.168.10.0/255.255.255.0 �i�J�A # ��L���������I�ҥH�ڥi�H�o�˳]�w�G 127.0.0.0/255.255.255.0 : * : * : none 192.168.10.0/255.255.255.0: * : * : none * : * : * : deny # ���O�]�� /etc/shadow �̭����ɮ��`���n���H�ݨ�a�I�ӤS�ѩ� Linux # �t�η����A�u�� root �i�H�ҥ� < 1024 �H�U�� port �A�]���A��w�����]�w�A �i�H�o�˰��G 127.0.0.0/255.255.255.0 : * : * : port 192.168.10.0/255.255.255.0: * : * : port * : * : * : deny # �T��]�N���F�I # �L�צp��A�p�G�z�Q�n���z�� NIS Server �B�@�������ֳt�A�åB�w���ʤW�� # �S���Ӧh���Ҷq(��������ɡI)�A����ϥ� none �O�@�Ӥ������D�N�I |
<host>,<user>,<domain>
�D��,�ϥΪ̱b��,���W�� |
[root@test root]# touch /etc/netgroup |
1. �Ұ��o�I
[root@test root]# /etc/rc.d/init.d/ypserv start [root@test root]# /etc/rc.d/init.d/yppasswdd start �@ 2. �[��@�U�O�_�u�����ʧ@�H [root@test root]# rpcinfo -u localhost ypserv program 100004 version 1 ready and waiting program 100004 version 2 ready and waiting [root @test root]# rpcinfo -u localhost yppasswdd program 100009 version 1 ready and waiting # �o�� rpcinfo �N�O�b�[��P RPC Server ������ program �ثe�����p�I # �]���i�H�ΥL���[��A�� ypserv ��I �@ 3. �]�w�}���ɱҰʡG # �A�i�H�ϥ� ntsysv �A�o�̧ڭ̨ϥ� chkconfig �o�I [root@test root]# chkconfig --level 35 ypserv on [root@test root]# chkconfig --level 35 yppasswdd on |
1. �s�@��Ʈw�G
[root@test root]# /usr/lib/yp/ypinit -m At this point, we have to construct a list of the hosts which will run NIS servers. server.cluster is in the list of NIS server hosts. Please continue to add the names for the other hosts, one per line. When you are done with the list, type a <control D>. next host to add: server.cluster next host to add: <==�b�o�̫��U[ctrl + d]���X The current list of NIS servers looks like this: server.cluster Is this correct?
[y/n: y] y
# �o�Ӱʧ@�O�C���ק�ϥΪ̸�ƫ�@�w�n�����ʧ@�I�A�N�O���s�s�@��Ʈw�A
|
[root@client
root]# /etc/rc.d/init.d/portmap start
[root@client root]# netstat -tl Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 *:sunrpc *:* LISTEN �p�G�ݨ� sunrpc ���ܡA�N���ܱҰʦ��\�F�I [root@test root]# chkconfig --level 35 portmap on �W���o�@��b�]�w portmap �b run-level �� 3, 5 ���ɭԴN�}���ɱҰʡI |
[root@client
root]# vi /etc/hosts
# �n�����U�o�@���I 192.168.10.30 server.cluster |
1. �إ� NIS
domain name�G
[root@client root]# nisdomainname cluster [root@client root]# vi /etc/rc.d/rc.local # �[�J���U�o�@��G /bin/nisdomainname cluster [root@client root]# vi /etc/sysconfig/network # �[�J���U�o�@��G NISDOMAIN=cluster �@ 2. �إ� NIS �d�M���D���W�� [root@client root]# vi /etc/yp.conf # �[�J�o���G domain cluster ypserver server.cluster # �٬O�n�O�o�A���� cluster �O�A�� NIS �� domain �A�ܩ� server.cluster # �h�O NIS Server ���D���W�١A�ڳo�̬O�ϥΤ����p�� IP �A�ҥH�W�٥i�H�H�K # �ڳ��w�ӿ�ܪ���I |
1. �K�X�ɪ��ק�G
[root@client root]# vi /etc/passwd # �ٰO�o�o���ɮܡH�o���ɮ��`�@���C�����A�ӨC����쳣�H�����y:�z�j�}�A # ��������T�аѦҰ�¦�Dz߽g�̭����b���z���`�C�ѩ�ڭ̭n�N��� # �]�w�H NIS Server ����Ʈw�����ҡA�]���A # �b�o���ɮת��̫᭱�[�J�o�@��G +:::::: # �`�N��I�b + ����s��[���ӡy : �z�A�åB�����S���ťզr���I �@ 2. �d�M�K�X���{�ǡG # �]���ڭ̦��ܦh�覡�Ӭd�M�K�X�A�ݭn�ק� /etc/nsswitch.conf �o���ɮפ~�� [root@client root]# vi /etc/nsswitch.conf # ���������ѼơA�ç令���U�o�ˡG passwd: files nis nisplus shadow: files nis nisplus group: files nis nisplus hosts: files nis dns # �o���ɮצb�]�w�@�Ǹ�T���d�M�{�ǡI���� files �����O�����������ɮסA # �ܩ� nis �h�O�z�L NIS �Ӷi��d�M�A�ܩ� nisplus �h�O NIS+ �o�O����s # ���� NIS �աI���L�A�x������W�����A�ثe�o�ӵo�i���p�e�w�g�Ȱ��F�I # 1. passwd: �N�O�ϥΪ̬�����T�d�M�A���O�� /etc/passwd, nis �P nisplus # 2. shadow: �N�O�ϥΪ̱K�X���d�M�A /etc/shadow, nis �� nisplus # 3. group: �N�O�ϥΪ̪��s�ո�T�d�M�A /etc/group, nis �� nisplus # 4. hosts: �N�O�D���W�ٻPIP�������d�M�A/etc/hosts, nis �� /etc/resolv.conf |
1. ������ʱҰ�
ypbind �a�G
[root@client root]# /etc/rc.d/init.d/ypbind start [root@client root]# rpcinfo -p localhost program vers proto port 100000 2 tcp 111 portmapper 100000 2 udp 111 portmapper 100007 2 udp 735 ypbind 100007 1 udp 735 ypbind 100007 2 tcp 738 ypbind 100007 1 tcp 738 ypbind # �ܤ֭n���W���X�Ӹ�T�~�O�諸��I���L�A�ݭn�O�o���O�A���� port number # �O�t���H���Ұʪ��A�ҥH port number �C�����|���Ӥ@�˰ڡI # �O�o�n�g�`�� rpcinfo �h�ˬd�@�U RPC Server �������A�Ȥ~��I �@ 2. �]�w�}���ɱҰʡG [root@client root]# chkconfig --level 35 ypbind on |
[root@client
root]# yptest
Test 1: domainname Configured domainname is "cluster" Test 2: ypbind
Test 9: yp_all
|
[root@client
root]# ypwhich
server.cluster [root@clent root]# ypwhich -x Use "ethers" for map "ethers.byname" Use "aliases" for map "mail.aliases" Use "services" for map "services.byname" Use "protocols" for map "protocols.bynumber" Use "hosts" for map "hosts.byname" Use "networks" for map "networks.byaddr" Use "group" for map "group.byname" Use "passwd" for map "passwd.byname" |
[root@client
root]# ypcat -x
Use "ethers" for map "ethers.byname" Use "aliases" for map "mail.aliases" Use "services" for map "services.byname" Use "protocols" for map "protocols.bynumber" Use "hosts" for map "hosts.byname" Use "networks" for map "networks.byaddr" Use "group" for map "group.byname" Use "passwd" for map "passwd.byname" # �D�n���\��N�O�y�C�X��Ʈw�z�o�I�P ypwhich -x �ۦP�\��I # �ҥH�ڭ̦� ethers, aliases......passwd ����Ʈw�W�ٻP�ɦW�I �@ [root@client root]# ypcat [��Ʈw�W�٩Υ\��] # �o�ӫ��O�i�H�ΨӨ��o NIS Server �W���U�Ӹ�Ʈw�����e�I # �|�Ҩӻ��A�ڭ̷Q�n���D passwd ( �K�X��� ) ���Ҧ��ϥΪ̤��e�A�N�ݭn�G [root@client root]# ypcat passwd (�� ypcat passwd.byname ) test:dkoUW2XHV30sEV5gLM4NapyuhBcpVs.:500:500::/home/test:/bin/bash # �p�G�O�Q�n���D hosts �����e (NIS Server �D���W�� /etc/hosts �����e)�G [root@client root]# ypcat hosts 127.0.0.1 localhost localhost.localdomain 192.168.10.30 server.cluster # �ϥ��N�O�[�W��Ʈw�A�A�N�i�H���o NIS server �D���W������Ʈw���e�աI |
1. �]�w NIS
Server �D���� NFS �}��ؿ��G
[root@test root]# vi /etc/exports /home 192.168.10.0/24(rw,async,no_root_squash) �@ [root@test root]# exportfs -rv exporting 192.168.10.0/24:/home �@ [root@test root]# /etc/rc.d/init.d/nfs start Starting NFS services: [ OK ] Starting NFS quotas: [ OK ] Starting NFS daemon: [ OK ] Starting NFS mountd: [ OK ] �@ [root@test root]# chkconfig --level 35 nfs on �@ 2. �]�w NIS Client �� mount ��ơI # ���H root �������n�J�� NIS Client �D���W���G [root@client root]# mount -t nfs 192.168.10.30:/home /home # �p�G�S�����D�F�A�N�N�W���o�@��[�J /etc/rc.d/rc.local �����a�I |
/sbin/iptables
-A -s 192.168.10.0/24 --dport 111 -j ACCEPT
/sbin/iptables -A --dport 111 -j DROP |
[root @test
root]# vi /etc/hosts.allow
portmap: 192.168.10.0/255.255.255.0 [root @test
root]# vi /etc/hosts.deny
|