标签:
目录
一 环境
系统环境
软件环境
二 跨网络共享nfs
开墙 ,开几个端口,开什么端口
2. 修改配置文件
3. 重启 server 端和 client端
4. 挂载
三 验证
正文
一 环境
1.1 系统环境 CentOS 6.6 64位
[root@nfs-1 ~]# lsb_release -a LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch Distributor ID: CentOS Description: CentOS release 6.6 (Final) Release: 6.6 Codename: Final
[root@nfs-1 ~]# cat /proc/version Linux version 2.6.32-504.el6.x86_64 (mockbuild@c6b9.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) ) #1 SMP Wed Oct 15 04:27:16 UTC 2014
1.2 软件环境
nfs 是yum 安装的
请参照 http://my.oschina.net/u/234018/blog/502825
二 跨网络共享nfs
2.1 开墙 ,开几个端口,开什么端口
分析: nfs 即Network File System 默认使用2049 端口,这个是配置在/etc/services 里
[root@nfs-1 etc]# more /etc/services | grep nfs nfs 2049/tcp nfsd shilp # Network File System nfs 2049/udp nfsd shilp # Network File System nfs 2049/sctp nfsd shilp # Network File System
中间几行 是我跨网络挂的nfs [root@nfs-1 etc]# netstat -anp | grep 2049 tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN - tcp 0 0 10.59.9.1:2049 10.189.6.27:793 ESTABLISHED - tcp 0 0 10.59.9.1:2049 10.59.9.80:1006 ESTABLISHED - tcp 0 0 10.59.9.1:2049 10.189.6.30:942 ESTABLISHED - tcp 0 0 10.59.9.1:2049 10.189.6.49:746 ESTABLISHED - tcp 0 0 :::2049 :::* LISTEN - udp 0 0 0.0.0.0:2049 0.0.0.0:* - udp 0 0 :::2049 :::* -
客户端mount 到server 端时,会调用server 端 rpc.mountd ,进行通信,一般这个进程端口是随机的。
因为我们需要固定server 端 rpc.mountd 进程监听端口
2.2 修改server 端配置文件,固定rpc.mountd 进程端口
修改/etc/sysconfig/nfs
修改前,请先备份
我这边去掉了如下几个端口的注释,但是核心应该是 MOUNTD_PORT=892
[root@nfs-1 sysconfig]# diff nfs nfs.bak 20c20 < LOCKD_TCPPORT=32803 --- > #LOCKD_TCPPORT=32803 22c22 < LOCKD_UDPPORT=32769 --- > #LOCKD_UDPPORT=32769 57c57 < MOUNTD_PORT=892 --- > #MOUNTD_PORT=892 63c63 < STATD_PORT=662 --- > #STATD_PORT=662
2.3 重启server 端
2.4 实施开墙 892端口和2049端口
2.5 客户端开始挂载
三 验证
[wls81@DMZSTG7132 ~]$ mount /dev/sda3 on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) tmpfs on /dev/shm type tmpfs (rw) /dev/sda1 on /boot type ext4 (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) nfsd on /proc/fs/nfsd type nfsd (rw) 10.59.9.1:/nfsc/ on /nfsc/ type nfs (rw,vers=4,addr=10.59.9.1,clientaddr=192.168.24.35)
标签:
原文地址:http://my.oschina.net/u/234018/blog/502876