nfs測試(本次測試採用開發板的eth0網卡)服務器
1).設置虛擬機的網絡適配器的網絡鏈接模式爲橋接模式,設置方法如圖所示:網絡
從圖中能夠看出eth0的IP爲192.168.1.103。測試
而後在文件中加入 /dianyu1 * (加入絕對路徑,/dianyu1能夠換成別的文件夾,*表明掛載成功後能夠對這個路徑下的文件進行任意操做)保存文件。如圖所示:.net
文件保存完成後,鼠標點擊終端窗口,在鍵盤中同時按下「ctal+c」退出文件編輯。3d
至此服務器的設置就完成了。rest
查看客戶端與服務器是否鏈接,使用命令# ping NFS服務器地址 (根據NFS服務器的設置,能夠知道本次NFS IP爲192.168.1.103)。如圖所示:server
root@dianyu:~# ping 192.168.1.103blog
PING 192.168.1.103 (192.168.1.103): 56 data bytesip
64 bytes from 192.168.1.103: seq=0 ttl=64 time=2.662 ms開發
64 bytes from 192.168.1.103: seq=1 ttl=64 time=1.306 ms
64 bytes from 192.168.1.103: seq=2 ttl=64 time=1.263 ms
64 bytes from 192.168.1.103: seq=3 ttl=64 time=1.292 ms
64 bytes from 192.168.1.103: seq=4 ttl=64 time=1.294 ms
64 bytes from 192.168.1.103: seq=5 ttl=64 time=1.319 ms
64 bytes from 192.168.1.103: seq=6 ttl=64 time=1.261 ms
^C
--- 192.168.1.103 ping statistics ---
7 packets transmitted, 7 packets received, 0% packet loss
round-trip min/avg/max = 1.261/1.485/2.662 ms
root@dianyu:~#
如上圖所示,則代表鏈接成功,在鍵盤中同時按下「ctrl+c」退出鏈接測試。
2).鏈接測試成功後,能夠經過NFS 方式登陸到NFS 服務器,進行文件傳
輸。使用mount 命令,格式以下:
#mount -t nfs nfs-server-ip:nfs-share-directory /mountpoint -o nolock
例如
root@dianyu:~# mount -t nfs 192.168.1.103:/dianyu1 /mnt -o nolock
root@dianyu:~#
這就說明掛載成功。
這時就能夠使用命令#cd /mnt查看NFS服務器那端被掛載在/mnt中的dianyu1的路徑下的文件。如圖所示:
root@dianyu:~# cd /mnt/
root@dianyu:/mnt# ls
qt-everywhere-opensource-src-4.8.6 tslib
qt-everywhere-opensource-src-4.8.6.tar.gz tslib-1.4.tar.gz
root@dianyu:/mnt#
在NFS服務端的dianyu1路徑下的文件,如圖所示:
至此NFS 掛載成功,能夠使用命令對NFS 服務器的文件進行任意操做。