您好,登錄后才能下訂單哦!
NFS:Network File System,網(wǎng)絡(luò)文件系統(tǒng),主要用來(lái)實(shí)現(xiàn)網(wǎng)絡(luò)文件共享。
---------------------server
1、創(chuàng)建共享目錄
[root@server /]# mkdir /home/TestNFS
2、創(chuàng)建文件
[root@server /]# cd /home/TestNFS/
[root@server TestNFS]# touch test.txt
3、修改exports,配置nsf提供的文件共享目錄
[root@server home]# vim /etc/exports
[root@server home]# cat /etc/exports
/home/TestNFS/ 192.168.0.104(rw,async,no_root_squash)
[root@server home]# exportfs -rv
exporting 192.168.0.104:/home/TestNFS
---------------------client
1、查看NFS服務(wù)器是否允許本機(jī)鏈接對(duì)應(yīng)的共享目錄
[root@client1 /]# showmount -e 192.168.0.104
Export list for 192.168.0.104:
/home/TestNFS 192.168.0.104
2、創(chuàng)建本地掛載點(diǎn)
[root@client1 /]# cd /home/dana
[root@client1 home]# mkdir nfs
[root@client1 home]# ls
dana nfs
3、掛載共享目錄
[root@client1 home]# mount 192.168.0.104:/home/TestNFS nfs
mount.nfs: access denied by server while mounting 192.168.0.104:/home/TestNFS
報(bào)錯(cuò):mount.nfs: access denied by server while mounting 192.168.0.104:/home/TestNFS
原因:NFS服務(wù)啟動(dòng),所使用的端口要求小于1024,而當(dāng)前虛擬機(jī)采用NAT的方式,其網(wǎng)絡(luò)地址端口轉(zhuǎn)換的時(shí)候,一般都是大于1024的,需要禁止secure選項(xiàng),即添加insecure。
[root@server /]# cat /var/log/messages | grep mount
……
Jan
14 22:59:46 localhost rpc.mountd[13367]: refused mount request from
192.168.0.104 for /home/TestNFS (/home/TestNFS): illegal port 37636
處理方法:server端修改exports
[root@server /]# vim /etc/exports
[root@server /]# cat /etc/exports
/home/TestNFS/ 192.168.0.104(insecure,rw,async,no_root_squash)
[root@server /]# exportfs -rv
exporting 192.168.0.104:/home/TestNFS
4、重新掛載共享目錄
[root@client1 home]# mount 192.168.0.104:/home/TestNFS nfs
root@client ~]# mount
……
nfsd on /proc/fs/nfsd type nfsd (rw)
192.168.0.104:/home/TestNFS on /home/nfs type nfs (rw,vers=4,addr=192.168.0.104,clientaddr=172.16.71.129)
5、查看文件
[root@client1 home]# cd nfs
[root@client1 nfs]# ls
test.txt
參考:http://blog.chinaunix.net/uid-20554957-id-3444786.html
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。