配置tftp,dhcp, nfs服务

我使用的发行版是debain 6

------------------------------------

tftp 服务
========
1. 关闭防火墙
  #iptables -F
2. 安装
  #aptitude install xinetd   tftp tftpd
3. 创建共享目录
 # mkdir /srv/tftp
4. 配置tftp服务
创建文件
#vim /etc/xinetd.d/tftp
填入如下内容

service tftp
{
    sockect_type        = dgram
    protocol            = udp
    wait                = yes
    user                = root
    server              = /usr/sbin/in.tftpd
    server_args         = -s /srv/tftp
    disable             = no
    per_source          = 11  
    cps                 = 1002
    flags           = IPv4
}
5. 重启服务
/etc/init.d/xinetd  reload/ restart
6. 测试tftp服务
本机器ip: 192.168.1.177
另外一台机器上: tftp 192.168.1.177
   tftp> get hello
   tftp> put hi
   测试。。。
   
   =============== DNS 服务
   
1.  安装 dhcp3-server
#aptitude install dhcp3-server
2. 配置服务
#vim /etc/dhcp/dhcpd.conf
填入以下内容://#后面是注释不用写

#subnet 10.254.239.32 netmask 255.255.255.224 {
#  range dynamic-bootp 10.254.239.40 10.254.239.60;
#  option broadcast-address 10.254.239.31;
#  option routers rtr-239-32-1.example.org;
#}
subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.151 192.168.1.151;
}
该配置的意思是为 192.168.1.0网段的机器分配IP地址,
分配的IP地址从range中选择。
因为我们只用到了一个龙芯2f盒子,所以只写了一个地址。
根据你的具体需要修改。

3. 在使用前启动服务
#dhcpd  
   ====== NFS 服务
参考: http://www.fengyezhiqiu.com/?p=103
1.安装相关软件
aptitude install nfs-common nfs-kernel-server portmap
其实在Debian6中 nfs-common 和portmap已经有了最新的

2.启动服务
/etc/init.d/nfs-kernel-server start(restart)
3.创建共享文件夹
mkdir /opt/nfs
chmod 777 /opt/nfs -R
4.修改/etc/exports,192.168.1.135可读、可写,其他只读
/opt/nfs 192.168.1.135(rw,sync) *(ro)

Debian NFS服务器共享的常用参数:
ro 只读访问
rw 读写访问
sync 所有数据在请求时写入共享
async NFS在写入数据前可以相应请求
secure NFS通过1024以下的安全TCP/IP端口发送
insecure NFS通过1024以上的端口发送
wdelay 如果多个用户要写入NFS目录,则归组写入(默认)
no_wdelay 如果多个用户要写入NFS目录,则立即写入,当使用async时,无需此设置。
hide 在NFS共享目录中不共享其子目录
no_hide 共享NFS目录的子目录
subtree_check 如果共享/usr/bin之类的子目录时,强制NFS检查父目录的权限(默认)
no_subtree_check 和上面相对,不检查父目录权限
all_squash 共享文件的UID和GID映射匿名用户anonymous,适合公用目录。
no_all_squash 保留共享文件的UID和GID(默认)
root_squash root用户的所有请求映射成如anonymous用户一样的权限(默认)
no_root_squas root用户具有根目录的完全管理访问权限
anonuid=xxx 指定NFS服务器/etc/passwd文件中匿名用户的UID
anongid=xxx 指定NFS服务器/etc/passwd文件中匿名用户的GID

/etc/hosts.deny和/etc/hosts.allow是设置访问权限的
在/etc/hosts.allow添加
portmap:ALL
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL

5.重启服务
/etc/init.d/nfs-kernel-server restart

6.查看本机NFS服务器的资源共享情况:showmount -e localhost

7.在开发板上测试
mount -o nolock 192.168.1.207:/opt/nfs /mnt

8.如果出现RPC timeout之类的,先看看你Debian 的DNS是否正确
我的Debian 自动获取IP后,DNS与我们局域网的不同,后来改正后就好了。
然后再mount 就没问题了。
--------------
 !!!!我创建的文件夹在 /srv/loongson
 # mount -t nfs localhost:/srv/loongson /mnt

你可能感兴趣的:(配置tftp,dhcp, nfs服务)