案例精讲NFS:
[root@gjp99 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:2A:5C:13
inet addr:192.168.10.99 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe2a:5c13/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:373 errors:0 dropped:0 overruns:0 frame:0
TX packets:360 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:33572 (32.7 KiB) TX bytes:28950 (28.2 KiB)
Interrupt:67 Base address:0x2000
[root@gjp99 ~]# rpcinfo –p //查看本地的
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 867 status
100024 1 tcp 870 status
[root@gjp99 ~]# rpcinfo -p 192.168.10.9 //查看远程的!
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 900 status
100024 1 tcp 903 status
[root@gjp99 ~]# mkdir /public
[root@gjp99 ~]# cd /public
[root@gjp99 public]# ll
total 0
touch个文件gjp,便于顾客访问时作为参考!
[root@gjp99 public]# echo "guo jiping"> gjp
[root@gjp99 public]# ll
total 4
-rw-r--r-- 1 root root 11 Aug 3 17:07 gjp
[root@gjp99 ~]# man 5 exports
General Options
exportfs understands the following export options:
secure This option requires that requests originate on an internet port less than
IPPORT_RESERVED (1024). This option is on by default. To turn it off, specify
insecure.
rw Allow both read and write requests on this NFS volume. The default is to dis-
allow any request which changes the filesystem. This can also be made
explicit by using the ro option.
async This option allows the NFS server to violate the NFS protocol and reply to
requests before any changes made by that request have been committed to sta-
ble storage (e.g. disc drive).
Using this option might improve performance with version 2 only, but at the
cost that an unclean server restart (i.e. a crash) can cause data to be lost
or corrupted.
sync Reply to requests only after the changes have been committed to stable stor-
age (see async above).
[root@gjp99 ~]# vim /etc/exports
[root@gjp99 ~]# cat /etc/exports
/public 192.168.10.0/24(ro)
[root@gjp99 ~]# rpm -qa |grep nfs
nfs-utils-1.0.9-42.el5
nfs-utils-lib-1.0.8-7.6.el5
[root@gjp99 ~]# rpm -ql nfs-utils |less
/etc/rc.d/init.d/nfs 控制脚本的名字
[root@gjp99 ~]# chkconfig --list |grep nfs 查看nfs服务!
nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off
[root@gjp99 ~]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
发现本地多了好多东西!
[root@gjp99 ~]# rpcinfo –p
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 867 status
100024 1 tcp 870 status
100011 1 udp 903 rquotad
100011 2 udp 903 rquotad
100011 1 tcp 906 rquotad
100011 2 tcp 906 rquotad
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100021 1 udp 40890 nlockmgr
100021 3 udp 40890 nlockmgr
100021 4 udp 40890 nlockmgr
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100021 1 tcp 51129 nlockmgr
100021 3 tcp 51129 nlockmgr
100021 4 tcp 51129 nlockmgr
100005 1 udp 930 mountd
100005 1 tcp 933 mountd
100005 2 udp 930 mountd
100005 2 tcp 933 mountd
100005 3 udp 930 mountd
100005 3 tcp 933 mountd
[root@gjp99 ~]# chkconfig nfs on
必须导出
[root@gjp99 ~]# exportfs –rv // r可译为导出,v为详细信息!
exporting 192.168.10.0/24:/public
