Linux NFS iptables

Linux 2016. 1. 19. 19:07

NFS Server : 192.168.0.1

NFS Client : 192.168.0.2

NFS Folder : /home/user/session






1. Server (192.168.0.1)


/etc/sysconfig/nfs 파일 수정


#vi /etc/sysconfig/nfs


LOCKD_TCPPORT=32803

# UDP port rpc.lockd should listen on.

LOCKD_UDPPORT=32769


MOUNTD_PORT=892




Server 공유폴더 지정


# vi /etc/exports 


/home/user/session 192.168.0.2(rw,sync,no_root_squash)



nfs시작


# service rpcbind start

# service nfs start




iptables



iptables -A INPUT -s 192.168.0.0/24 -d 192.168.0.0/24 -p udp -m multiport --dport 10053,111,2049,32769,875,892 -m state --state NEW,ESTABLISHED -j ACCEPT


iptables -A INPUT -s 192.168.0 0/24 -d 192.168.0 0/24 -p tcp -m multiport --dport 10053,111,2049,32803,875,892 -m state --state NEW,ESTABLISHED -j ACCEPT









2. Client (192.168.0.2)


/etc/sysconfig/nfs파일 수정


vi /etc/sysconfig/nfs


LOCKD_TCPPORT=32803

# UDP port rpc.lockd should listen on.

LOCKD_UDPPORT=32769


MOUNTD_PORT=892



iptables


iptables -A INPUT -s 192.168.0.0/24 -d 192.168.0 0/24 -p udp -m multiport --sport 10053,111,2049,32769,875,892,32769 -m state --state NEW,ESTABLISHED -j ACCEPT


iptables -A INPUT -s 192.168.0.0/24 -d 192.168.0 0/24 -p tcp -m multiport --sport 10053,111,2049,32803,875,892,32803 -m state --state NEW,ESTABLISHED -j ACCEPT




nfs시작


# service rpcbind start

# service nfs strt





NFS폴더 마움트


# mount -t nfs 192.168.0.1:/home/user/session /home/user/session





NFS 마운트 해제

# umount /home/user/session



NFS 마운트 강제 해제


# umount -f -l /home/user/session








블로그 이미지

엘로드넷

,