Chinaunix首页 | 论坛 | 博客
  • 博客访问: 45232
  • 博文数量: 4
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 7
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-23 21:52
个人简介

专注Linux驱动开发、内核研究。

文章分类
文章存档

2015年(3)

2014年(1)

我的朋友

分类: 嵌入式

2015-10-22 22:29:48

1       NFS设置

1.1 查看主机是否已装portmaprpcbind

#rpm -qa|grep portmap

#rpm –qa|grep rpcbind

nfs是基于rpc的应用,rpc需要基于portmaprpcbind工作。

 

1.2 安装portmap(如果需要)

#rpm -ivh portmap-4.0-54.i386.rpm

或者yum install portmap,但是可能会自动帮你安装rpcbind

 

1.3 确定服务运行在正确的run level

#chkconfig --list nfs

#chkconfig --list portmap

#chkconfig --list rpcbind

如果不运行在345上那么就执行下列语句:

#chkconfig --level 345 nfs on

#chkconfig --level 345 portmap on

#chkconfig --level 345 rpcbind on

执行该指令后,下次上电自动会启动该service

 

1.4 启动相应服务

#service portmap [start|restart] 或者 /etc/init.d/portmap [start|restart]

#service rpcbind [start|restart] 或者 /etc/init.d/ rpcbind [start|restart]

#service nfs [start|restart] 或者 /etc/init.d/nfs [start|restart]

 

1.5 修改/etc/exports配置文件

vim /etc/exports

添加如下内容:

/new/nfs 10.10.107.248(rw,sync,no_root_squash)

允许10.10.107.248nfs client访问nfs server/new/nfs目录,权限的内容如下所示:

Options:

Description:

sync

Any adjustments are added or removed to synchronise the files

rw

Allows read and write access to the share

ro

Only allows read access, writing is blocked

all_squash

Forces all connecting users to "nobody" account and permissions

no_root_squash

Allows root account on client to access export share on server as the root account

anonuid

Forces all anonymous connections to predefined UID on server

anongid

Forces all anonymous connections to predefined GID on server

使文件生效

#exportfs –rv

 

查看是否成功导出

#showmount –e      #查看服务共享的目录

 

1.6 关闭防火墙及安全策略

最简单的方法是将防火墙及安全策略功能关闭

#setup-->Firewall Configuration-->去掉Enable  -----这两步为关闭防火墙

#setup-->System Services-->去掉iptables(顺便去掉ip6tables)

 

#system-config-selinux-->                                 ---- 这步关闭Linux安全策略

System Default Enforcing Mode 选为Disabled

Current Enforcing Mode 选为Permissive

 

如果只想让防火墙给nfs服务开特例,那么可以借鉴下面的例子。

如果我们的NFS针对内部网络开发,对于外部网络只对学术网络开发(140.0.0.0/8),可以:

iptables -A INPUT -i eth0 -p TCP -s 192.168.0.0/24 --dport 111 -j ACCEPT

iptables -A INPUT -i eth0 -p UDP -s 192.168.0.0/24 --dport 111 -j ACCEPT

iptables -A INPUT -i eth0 -p TCP -s 140.0.0.0/8 --dport 111 -j ACCEPT

iptables -A INPUT -i eth0 -p UDP -s 140.0.0.0/8 --dport 111 -j ACCEPT

 

安全策略暂时没有研究,不知如何设置。

 

1.7 修改/etc/hosts.allow/etc/hosts.deny配置文件

vim /etc/hosts.allow添加如下内容:

portmap,mountd:10.10.107.248(如果是rpc怎么配)

 

确保/etc/hosts.deny中没有ALL:ALL:deny等字样,如果有要添加如下内容:(如果是rpc怎么配)

portmap:ALL:allow

 

1.8 可选配置

vim /etc/sysconfig/nfs

RPCMOUNTDOPTS="-N 1 -N 2"

mount daemon会忽略version1version2nfs client mount请求。

 

1.9 错误信息查看

如果执行上面步骤出现错误,可通过下面指令查看log

#tail -n 50 /var/log/messages

 

1.10  要注意的问题

需要注意的是,由于NFS使用的这个RPCclient端连上主机时,那么你的主机想要关机,那可就会成为『不可能的任务』!我还不知道正确的原因是什么,但是,如果你的Server上面还有Client在联机,那么你要关机,可能得要等到数个钟头才能够正常的关机成功!嗄!真的假的!不相信吗?不然您自个儿试试看! ^_^!所以啰,建议您的NFS Server想要关机之前,能更先『关掉portmapnfs』这两个东西!如果无法正确的将这两个daemons关掉,那么先以netstat -utlp找出PID,然后以kill将他关掉先!这样才有办法正常的关机成功喔!这个请特别特别的注意呢!

 

1.11  扩展资料

man rpc.mountd

rpcinfo指令   #查看服务器提供的rpc服务

2       TFTP设置

2.1 查看主机是否已装xinetd

#rpm -qa|grep xinetd

#rpm -qa|grep tftp

 

2.2 安装xinetdtftp

#rpm -ivh xinetd-2.3.7-5.1.i386.rpm    #如果已安装,此步骤就不用

#rpm -ivh tftp-server-0.49-1.fc10.i386.rpm

#rpm -ivh tftp-0.49-1.fc10.i386.rpm

或者通过yum安装

yum install xinetd

yum install tftp-server

yum install tftp

 

2.3 修改/etc/xinetd.d/tftp配置文件

vim /etc/xinetd.d/tftp

将配置修改成如下

service tftp

{

       disable           = no        /*使能tftp服务*/

       socket_type     = dgram

       protocol         = udp

       wait               = yes

       user               = root

       server             = /usr/sbin/in.tftpd

       server_args     = -s /tftpboot -c             /*-c 选项为可以创建文件,即可上传至服务

                                                               器,/tftpboottftp服务器的根目录*/

       per_source      = 11

       cps                 = 100 2

       flags                     = IPv4

}

还需将/tftpboot加写的权限才可上传

 

2.4 重启xinetd服务

#service xinetd restart

 

2.5 关闭防火墙及安全策略

#setup-->Firewall Configuration-->去掉Enable  -----这两步为关闭防火墙

#setup-->System Services-->去掉iptables(顺便去掉ip6tables---------

 

#system-config-selinux-->                                 ---- 这步关闭Linux安全策略

System Default Enforcing Mode 选为Disabled

Current Enforcing Mode 选为Permissive

3       samba服务设置

3.1 查看主机是否已装samba

[root@sellie ~]# rpm -aq|grep samba

samba-common-3.2.4-0.22.fc10.i386

samba-client-3.2.4-0.22.fc10.i386

samba-winbind-3.2.4-0.22.fc10.i386

system-config-samba-1.2.67-1.fc10.noarch

samba-3.2.4-0.22.fc10.i386

如果没有安装相应的软件,可以通过yum工具安装。

 

3.2 samba设置

System->Administration->Samba

Add Share添加共享目录,选上WritableVisible选项,Access->Allow access to everyone

Preferences->Server Settings…->Security->Authentication Mode选择Share

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