linux如何启动portmap服务,linux使用nfs、portmap服务共享远程磁盘的方法

NFS的安装配置:centos 5 :yum install nfs-utils portmapcentos 6 :yum install nfs-utils rpcbind本节是使用centos 6的配置过程:设备:两台 centos6 OS 安装的时候选择的是"Basic Server"软件配置包。首先,让两台机器都安装NFS的 软件包,如下显示的是服务器端:[root@roothomes /home]$ yum install nfs-utils rpcbindLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile* base: centos.ustc.edu.cn* extras: centos.ustc.edu.cn* updates: centos.ustc.edu.cnSetting up Install ProcessPackage rpcbind-0.2.0-8.el6.x86_64 already installed and latest versionResolving Dependencies--> Running transaction check---> Package nfs-utils.x86_64 1:1.2.3-15.el6 set to be updated--> Finished Dependency ResolutionDependencies Resolved================================================================================Package            Arch            Version                 Repository     Size================================================================================Updating:nfs-utils          x86_64          1:1.2.3-15.el6          base          308 kTransaction Summary================================================================================Install       0 Package(s)Upgrade       1 Package(s)Total download size: 308 kIs this ok [y/N]: yDownloading Packages:nfs-utils-1.2.3-15.el6.x86_64.rpm                        | 308 kB     00:10warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEYbase/gpgkey                                              | 3.3 kB     00:00 ...Importing GPG key 0xC105B9DE "CentOS-6 Key (CentOS 6 Official Signing Key)" from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Is this ok [y/N]: y

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Updating       : 1:nfs-utils-1.2.3-15.el6.x86_64                          1/2

Cleanup        : 1:nfs-utils-1.2.2-7.el6.x86_64                           2/2

Updated:

nfs-utils.x86_64 1:1.2.3-15.el6

Complete!

[root@roothomes /home]$

服务器端:

###(建立挂载的目录,并且挂载目录。)

[root@roothomes /etc]$ mkdir /opt/centos6

[root@roothomes /etc]$ cd /opt/centos6/

[root@roothomes /opt/centos6]$ mkdir thisISnfsFile

[root@roothomes /opt/centos6]$ ls

thisISnfsFile

[root@roothomes /etc]$ vi /etc/exports

[root@roothomes /opt/centos6]$ cat /etc/exports

/opt/centos6 192.168.1.0/24(ro,no_root_squash)

### 备注:/opt/centos6表示nfs共享的目录 192.168.1.0-192.168.1.254区间的IP可以访问,访问权限是自读,root 用户

###(启动对应的服务)

[root@roothomes /opt/centos6]$ chkconfig nfs on

[root@roothomes /opt/centos6]$ /etc/init.d/rpcbind start

[root@roothomes /opt/centos6]$ /etc/init.d/nfs start

Starting NFS services:                                     [  OK  ]

Starting NFS quotas:                                       [  OK  ]

Starting NFS daemon:                                       [  OK  ]

Starting NFS mountd:                                       [  OK  ]

[root@roothomes /opt/centos6]$ service iptables stop

iptables: Flushing firewall rules:                         [  OK  ]

iptables: Setting chains to policy ACCEPT: filter          [  OK  ]

iptables: Unloading modules:                               [  OK  ]

客户端:

[root@roothomes /home]$ yum install nfs-utils rpcbind

安装完毕!

[root@vmBS00 ~]# service iptables stop

iptables: Flushing firewall rules:                         [  OK  ]

iptables: Setting chains to policy ACCEPT: filter          [  OK  ]

iptables: Unloading modules:                               [  OK  ]

###查看是否能访问nfs服务

[root@vmBS00 ~]# showmount -e 192.168.1.75

Export list for 192.168.1.75:

/opt/centos6 192.168.1.0/24

[root@vmBS00 ~]# mkdir /opt/centos6

[root@vmBS00 ~]# mount -t nfs 192.168.1.75:/opt/centos6/  /opt/centos6/

[root@vmBS00 ~]# ls /opt/centos6/

thisISnfsFile

###配置开机自动挂载

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

### 添加 #192.168.1.75:/opt/centos6/ /opt/centos6/ nfs nodev,ro,rsize=32768,wsize=32768 0 0

[root@vmBS00 ~]# init 6

[root@vmBS00 ~]#

login as: root

root@192.168.1.116's password:

Last login: Mon Mar  5 17:29:04 2012 from 192.168.1.23

[root@vmBS00 ~]# ls /opt/centos6/

thisISnfsFile

[root@vmBS00 ~]#

>

/data 本机mount的目录

1.服务端和客户端都需要开启portmap服务。RCP是nfs mount和umount时通信的方式。

2.假如客户端portmap没有启动,mount时,会非常慢,最终会失败。umount时,即使本地的portmap是关闭的,也能umount成功。

3.挂载完成后,服务端的portmap停止后,nfs仍然工作正常,但是umout财会提示: not found / mounted or server not reachable。重启服务器的portmap也无济于事。

4.假如服务端的portmap重启了,那么nfs也要跟着重启,否则nfs工作仍然是不正常的。

5.假如服务端nfs关闭(IP是通的),这时客户端会无法umount,这时使用umount -f /nfs一般能成功,当服务端死机时,umount -f /nfs 有可能会失败,这时可以使用 umount -l /nfs .

最终建议:

1.使用NFS,就要使用portmap或者rpcbind,NFS严重依赖于portmap或者rpcbind,所以不要试图去停止它(portmap或者rpcbind)。

2.当不能umount /nfs 分区时,试着使用umount -f /nfs,一般都能成功。

3.当umount -f /nfs不能umount时,可以试试umount -l /nfs. umount -l是最终级的umount。

端口映射器(Portmap) 1.0 使用说明 1、主要功能: 该工具可以将A机器上的某一个端口(可设置)映射到B机器的某个端口(可设置),也就是将这两个端口的数据传输对应起来,其工作流程是这样的: 在机器A的端口接收到连接请求以后,Portmap马上试图连接B机器的端口,连接成功后,Portmap就在这两个端口之间就建立起一条数据通路,进行数 据转发,任何一方关闭连接,数据通路就断开。 2、设置 所有的设置都在Portmap.ini中,每一个Entry代表建立一个数据转发器,一共支持1024个。 3、安装方式 系统可以以NT系统服务方式运行,也可以直接运行(9x下); 1、下载 直接将文件解压缩一个独立的目录下面(注意不能有空格和中文名), 2、安装服务 Portmapsvc -install 安装后,服务将把自己设为自动启动; 3、卸载服务 Portmapsvc -uninstall 4、启动和停止服务 请到NT服务控制器执行! 5、9x下直接运行 请在命令行下键入: Portmapsvc -run 即可. 4、Portmap.ini说明 Enable=1 ;; 1代表启用这个数据转发器, 0则相反 InnerIP=192.168.1.198 ;; B机器的IP地址 InnerPort=21 ;; B机器的端口 ServerIP=x.x.x.x ;; A机器的IP地址 ServerPort=5021 ;; A机器的端口 5、注册方式 该软件可以免费使用,但是如果你不希望每次启动时都打开注册对话框,你可以考虑注册,注册请联系: MSN: skyvense@msn.com ICQ: 104180227 OICQ: 2091910 Email: skyvense@online.sh.cn, skyvense@vip.sina.com 张小峰(2002/10/02 01:59)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值