SLES Suse Linux 11 SP4環境下NFS的搭建
阿新 • • 發佈:2017-10-13
配置文件 start 組成 bsp /tmp fss showmount 系統環境 star
系統環境:
SLES 11 SP4
NFS Server IP:192.168.74.141
NFS Client IP: 192.168.74.142
SLES環境下NFS套件是缺省安裝的,可以使用zypper se nfs來確認一下.
#service nfsserver start #啟動NFS服務器服務 #vi /etc/exports #添加以下內容 /tmp 192.168.74.142(rw,no_root_squash,no_all_squash,sync,anonuid=501,anongid=501) #exportfs-rv #導出NFS #showmount -e #服務器上確認導出NFS狀態正常
接下來配置NFS Server上的防火墻(這部分是重點)
## rpcinfo -p program vers proto port service 100000 4 tcp 111 portmapper 100000 3 tcp 111 portmapper 100000 2 tcp 111 portmapper 100000 4 udp 111portmapper 100000 3 udp 111 portmapper 100000 2 udp 111 portmapper 100005 1 udp 53075 mountd 100005 1 tcp 42607 mountd 100005 2 udp 49948 mountd 100005 2 tcp 48332 mountd 100005 3 udp 53662 mountd 100005 3 tcp 60244 mountd 100024 1 udp 57614status 100024 1 tcp 45583 status 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 43109 nlockmgr 100021 3 udp 43109 nlockmgr 100021 4 udp 43109 nlockmgr 100021 1 tcp 53998 nlockmgr 100021 3 tcp 53998 nlockmgr 100021 4 tcp 53998 nlockmgr
看到NFS服務端主要由portmapper(port 111),nfs(port 2049),mountd(port隨機),nlockmgr(port隨機)四個服務組成.portmapper和nfs的端口是固定的,而mountd,nlockmgr的端口不固定,這樣就不能直接在防火墻上配置.
先自定義mountd的TCP/UDP port=20048, nlockmgr的TCP/UDP port=51000,打開/etc/sysconfig/nfs文件
#vi /etc/sysconfig/nfs MOUNTD_PORT="20048" LOCKD_TCPPORT="51000" LOCKD_UDPPORT="51000"
改變這三行就把mountd,nlockmgr的端口固定下來了,重啟一下NFS服務讓改變的配置文件生效
#service nfsserver restart # rpcinfo -p 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 20048 mountd 100005 1 tcp 20048 mountd 100005 2 udp 20048 mountd 100005 2 tcp 20048 mountd 100005 3 udp 20048 mountd 100005 3 tcp 20048 mountd 100024 1 udp 33747 status 100024 1 tcp 43717 status 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 51000 nlockmgr 100021 3 udp 51000 nlockmgr 100021 4 udp 51000 nlockmgr 100021 1 tcp 51000 nlockmgr 100021 3 tcp 51000 nlockmgr 100021 4 tcp 51000 nlockmgr
接下來將nfs,111,20048,51000四個端口加入防火墻配置文件
#vi /etc/sysconfig/SuSEfirewall2 FW_SERVICES_EXT_TCP="ssh ftp 30000:30100 nfs 111 20048 51000" FW_SERVICES_EXT_UDP="nfs 111 20048 51000"
重啟防火墻服務讓配置文件生效
#/sbin/rcSuSEfirewall2 restart
由於SLES環境下NFS套件是缺省安裝的,客戶端不需要安裝其它軟件了
#showmount -e 192.168.74.141 #mount -t nfs 192.168.74.141:/tmp /mnt
最後測試文件在NFS上的讀寫情況即可.
SLES Suse Linux 11 SP4環境下NFS的搭建