{"id":382,"date":"2012-10-15T15:45:09","date_gmt":"2012-10-15T13:45:09","guid":{"rendered":"http:\/\/songoku.homelinux.com\/wordpress\/?p=382"},"modified":"2012-10-15T15:45:09","modified_gmt":"2012-10-15T13:45:09","slug":"enable-nfs-share-on-centosrhel-6","status":"publish","type":"post","link":"https:\/\/ndk.sytes.net\/wordpress\/?p=382","title":{"rendered":"Enable NFS Share on CentOS\/RHEL 6"},"content":{"rendered":"<p>\n\tHello,\n<\/p>\n<p>\n\tNFS (Network File System) is the equivalent to SMB (Samba\/CIFS) from the Windows world in the Unix world. Over NFS you can share folders on the network. Building a NFS share is quite easy but the configuration a bit tricky if you plan the usage of a firewall, for example iptables.\n<\/p>\n<p>\n\tYou need following ports open:\n<\/p>\n<p>\n\tTCP\/UDP 111 (RPC portmapper)<br \/>\n\tTCP\/UDP 2049 (NFSD server)<br \/>\n\tTCP\/UDP 32803 (*)<br \/>\n\tTCP\/UDP 32769 (*)<br \/>\n\tTCP\/UDP 892 (*)<br \/>\n\tTCP\/UDP 875 (*)<br \/>\n\tTCP\/UDP 662 (*)<br \/>\n\tTCP\/UDP 2020 (*)\n<\/p>\n<p>\n\t(*) Because NFS choses random ports every time it&#39;s started we need to fix several ports in the config file<strong><em> \/etc\/sysconfig\/nfs<\/em><\/strong>. Without these fixed ports we can&#39;t do firewalling on a nfs server. So, to activate these ports uncomment the following lines in the mentioned config file:\n<\/p>\n<p>\n\tLOCKD_TCPPORT=32803<br \/>\n\tLOCKD_UDPPORT=32769<br \/>\n\tMOUNTD_PORT=892<br \/>\n\tRQUOTAD_PORT=875<br \/>\n\tSTATD_PORT=662<br \/>\n\tSTATD_OUTGOING_PORT=2020\n<\/p>\n<p>\n\tAfterwards restart all daemons needed for the nfs server:\n<\/p>\n<p>\n\t<em># \/etc\/init.d\/rpcbind restart<br \/>\n\t# \/etc\/init.d\/nfs restart<br \/>\n\t# \/etc\/init.d\/rpcsvcgssd restart<\/em>\n<\/p>\n<p>\n\tNow that the server is running you only need to add the ports to your iptables config. Open <em><strong>\/etc\/sysconfig\/iptables<\/strong><\/em> and repeat the following 2 lines for each port:\n<\/p>\n<p>\n\t<em>-A INPUT -m state &#8211;state NEW -p tcp &#8211;dport &lt;port&gt; -j ACCEPT<br \/>\n\t-A INPUT -m state &#8211;state NEW -p udp &#8211;dport &lt;port&gt; -j ACCEPT<\/em>\n<\/p>\n<p>\n\tNow we have to export a folder. First open the file <strong><em>\/etc\/exports <\/em><\/strong>and add the export, here an example line:\n<\/p>\n<p>\n\t\/home\/BACKUP &nbsp; &nbsp;192.168.0.0\/24(rw,sync,root_squash)\n<\/p>\n<p>\n\t<u>Short explanation:<\/u><br \/>\n\t\/home\/BACKUP &#8211; That&#39;s the folder you want to export<br \/>\n\t192.168.0.0\/24 &#8211; That&#39;s the host part which has access to the share (here the whole mentioned network)<br \/>\n\t(rw,sync,root_squash) &#8211; That&#39;s the option part (here read\/write, sync and act as root)\n<\/p>\n<p>\n\tFor more explanations on the options you can consult the manpages (<em># man exports<\/em>)\n<\/p>\n<p>\n\tAfter you have created the share and saved the file, push it online with<br \/>\n\t<em># exportfs -a<\/em>\n<\/p>\n<p>\n\tI also restart the nfs server every time after the exportfs command but i don&#39;t know if it&#39;s really needed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello, NFS (Network File System) is the equivalent to SMB (Samba\/CIFS) from the Windows world in the Unix world. Over NFS you can share folders on the network. Building a NFS share is quite easy but the configuration a bit tricky if you plan the usage of a firewall, for example iptables. You need following [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,7],"tags":[],"class_list":["post-382","post","type-post","status-publish","format-standard","hentry","category-linuxunix","category-servers"],"_links":{"self":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/382","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=382"}],"version-history":[{"count":0,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/382\/revisions"}],"wp:attachment":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}