linux redhat NFS網絡共享搭建

nfs網絡共享



測試環境:


服務端:redhat6.7  ip:192.168.1.100
客戶端:redhat6.7  ip:192.168.1.110




一.服務端

1.建立共享文件夾  權限666便可

2.掛載lv到共享文件夾(事先建立好lv或者直接用本地硬盤)

3.export文件
vi /etc/exports

/nfs 192.168.1.110/24(rw,no_root_squash,no_all_squash,sync)
--->測試機虛擬機ip爲192.168.1.110/24


4.配置生效
exportfs -r

5.啓動rpcbind、nfs服務
/etc/init.d/rpcbind start
/etc/init.d/nfs start
 
6.PRC註冊狀況
rpcinfo -p localhost

 program vers proto   port  service
    100000    4   tcp    111  portmapper
    100000    3   tcp    111  portmapper
    100000    2   tcp    111  portmapper
    100000    4   udp    111  portmapper
    100000    3   udp    111  portmapper
    100000    2   udp    111  portmapper
    100005    1   udp  41269  mountd
    100005    1   tcp  36582  mountd
    100005    2   udp  35573  mountd
    100005    2   tcp  39666  mountd
    100005    3   udp  34170  mountd
    100005    3   tcp  50384  mountd
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100227    2   tcp   2049  nfs_acl
    100227    3   tcp   2049  nfs_acl
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100227    2   udp   2049  nfs_acl
    100227    3   udp   2049  nfs_acl
    100021    1   udp  43160  nlockmgr
    100021    3   udp  43160  nlockmgr
    100021    4   udp  43160  nlockmgr
    100021    1   tcp  51212  nlockmgr
    100021    3   tcp  51212  nlockmgr
    100021    4   tcp  51212  nlockmgr
7.測試是否聯機
showmount -e localhost

[root@informixdb1 ~]# showmount -e localhost
Export list for localhost:
/nfs 192.168.1.110/24
[root@informixdb1 ~]# 

8.固定監聽端口

/etc/sysconfig/nfs
添加

RQUOTAD_PORT=30001
LOCKD_TCPPORT=30002
LOCKD_UDPPORT=30002
MOUNTD_PORT=30003
STATD_PORT=30004

重啓服務
/etc/init.d/nfs restart

9.設置開機啓動
chkconfig nfs on
chkconfig rpcbind on

10.lv邏輯卷設置開機掛載

vi /etc/rc.local

mount lv路徑 共享目錄


---------------------------------------------------------------------
二.客戶端
1.安裝客戶端軟件
 nfs-utils
 
2.建立本地掛載目錄
mkdir 目錄

3.查看服務端共享信息
showmount -e 192.168.1.100

Export list for 192.168.1.100:
/nfs 192.168.1.110/24
[root@informixdb2 ~]# 


4.掛載
 mount -t nfs 192.168.1.100:/nfs /nfs_client/ -o proto=tcp -o nolock
 
 注:proto=tcp或者udp協議   
 
 5.查看掛載狀況
 
root@informixdb2 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                      8.4G  2.5G  5.5G  32% /
tmpfs                 240M     0  240M   0% /dev/shm
/dev/sda1             477M   33M  419M   8% /boot
/dev/sr0              3.6G  3.6G     0 100% /cdrom
192.168.1.100:/nfs    8.4G  3.2G  4.8G  40% /nfs_client


6.編寫啓動自行掛載文件

vi /etc/rc.local
mount -t nfs 192.168.1.100:/nfs /nfs_client/ -o proto=tcp -o nolock
相關文章
相關標籤/搜索