Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1296764
  • 博文数量: 464
  • 博客积分: 9399
  • 博客等级: 中将
  • 技术积分: 6364
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-19 09:15
文章分类

全部博文(464)

文章存档

2014年(12)

2013年(123)

2012年(173)

2011年(156)

我的朋友

分类: 系统运维

2011-11-14 15:31:37

实验环境:AS4最小化安装

实验目标:架设NIS


大家好!

这次我们来学习Linux系统中的NIS服务器的配置。主要目标能够使用nis服务器中的账号登陆nis客户机

NIS服务器IP192.168.1.10   hostname = crazylinux.nistest该服务器下面有mike john2个账号

NIS客户机IP192.168.1.20

NIS初始配置:

首先配置NIS服务器:

1.检查服务器是否安装了下列包:portmap、ypserv、ypbind、yp-tools

ypserv在第一张安装光盘中,

[root@crazylinux cdrom]# mount /media/cdrom/挂载

[root@crazylinux /]# rpm -ivh /media/cdrom/RedHat/RPMS/ypserv-2.13-5.i386.rpm

warning: /media/cdrom/RedHat/RPMS/ypserv-2.13-5.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e

Preparing...                 ########################################### [100%]

1:ypserv                  ########################################### [100%]

[root@crazylinux /]# rpm -qa | grep portmap

portmap-4.0-63

[root@crazylinux /]# rpm -qa | grep ^yp

yp-tools-2.8-7

ypserv-2.13-5

ypbind-1.17.2-3

 

2.设置time和time-udp服务的启动状态

[root@crazylinux /]# chkconfig --list | grep time   默认设置

     time-udp:        off

     daytime-udp:     off

     daytime:         off

     time:    off

[root@crazylinux /]# chkconfig time on

[root@crazylinux /]# chkconfig time-udp on

[root@crazylinux /]# service xinetd restart

Stopping xinetd: [   OK   ]

Starting xinetd: [   OK   ]

 

3.建立NIS的域名

[root@crazylinux /]# nisdomainname nistest  

[root@crazylinux /]# cat /etc/rc.d/rc.local 

#!/bin/sh

#

# This script will be executed *after* all the other init scripts.

# You can put your own initialization stuff in here if you don't

# want to do the full Sys V style init stuff.


touch /var/lock/subsys/local

/bin/nisdomainname nistest   添加这行使之开机运行

修改/etc/sysconfig/network文件,增加此行:NISDOMAIN=nistest

 

4.设置ypserv服务的配置文件

把下面这些添加到/etc/ypserv.conf最后

127.0.0.0/255.255.255.0     : *        : *                 : none

192.168.1.0/255.255.255.0   : *        : *                 : none

*                        : *        : *                 : deny


[root@crazylinux /]# touch /etc/netgroup

[root@crazylinux /]#hostname crazylinux.nistest

[root@crazylinux /]# cat /var/yp/securenets  需要自己建立

host 127.0.0.1

255.255.255.0    192.168.1.0


5.启动相关服务:

#service portmap restart

[root@crazylinux /]# service portmap status

portmap (pid 1649) is running...

[root@crazylinux /]# service ypserv start

Starting YP server services: [   OK   ]

[root@crazylinux /]# service yppasswdd start

Starting YP passwd service: [   OK   ]

[root@crazylinux /]# chkconfig --level 35 ypserv on

[root@crazylinux /]# chkconfig --level 35 yppasswdd on   设置开机自动运行

 

6.初始化NIS数据库:

[root@crazylinux /]# useradd user1

[root@crazylinux /]# passwd user1

#/usr/lib/yp/ypinit–m

此时会询问是否有其他NIS服务器,如果没有,则可以直接按Ctrl+D结束,并重启ypserv服务。

#service ypserv restart

#service yppasswdd restart

同时检查进程是否正常运行以及信息是否正确:ps–aux | grep yp      tail /var/log/message


以下进行客户端上的配置:

1.确认安装以下包:ypbind、yp-tools默认安装了的

2.设置hosts文件

[root@localhost ~]# cat /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1                localhost.localdomain localhost

192.168.1.10             crazylinux     NIS服务器的主机名

 

3.建立NIS域名

[root@crazylinux /]# nisdomainname nistest  

    [root@crazylinux /]# cat /etc/rc.d/rc.local 

#!/bin/sh

#

# This script will be executed *after* all the other init scripts.

# You can put your own initialization stuff in here if you don't

# want to do the full Sys V style init stuff.


touch /var/lock/subsys/local

/bin/nisdomainname nistest   添加这行使之开机运行

修改/etc/sysconfig/network文件,增加此行:NISDOMAIN=nistest

 

4.设置yp.conf

[root@localhost ~]# cat /etc/yp.conf

# generated by /sbin/dhclient-script

domain domain.org broadcast

domain   nistest      添加这句

ypservercrazylinux.nistest

在/etc/passwd最下面添加

+::::::

 

5.设置nsswitch.conf

vi   /etc/nsswitch.conf    修改为这样

passwd:      filesnisnisplus

shadow:      filesnisnisplus

group:       filesnisnisplus


#hosts:      db files nisplusnisdns

hosts:       filesnisdns

 

6.启动ypbind服务程序

[root@localhost ~]# service portmap status

portmap (pid 1683) is running...

[root@localhost ~]# service   ypbind start

Binding to the NIS domain: [   OK   ]

Listening for an NIS domain server..


在NIS服务器中输出NFS共享目录


在NIS服务器上

[root@localhost ~]#vi /etc/exports添加

/home192.168.1.0/24(rw,async,np_root_squash)


[root@localhost ~]#service nfs start


在NIS客户机上

[root@localhost ~]#vi /etc/fstab

Crazylinux.nistest:/home//homenfsdefaults00

 


现在在客户机中用服务器里面的帐号登陆     OK



CCIE Security 2009 IOS防火墙合集

阅读(543) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~