{"id":152,"date":"2017-10-10T07:20:00","date_gmt":"2017-10-10T07:20:00","guid":{"rendered":"https:\/\/linuxadmin.melberi.com\/uncategorized\/iptables-for-nfs-server"},"modified":"2017-10-10T12:21:38","modified_gmt":"2017-10-10T12:21:38","slug":"iptables-for-nfs-server","status":"publish","type":"post","link":"https:\/\/www.melberi.com\/linuxadmin\/iptables\/iptables-for-nfs-server","title":{"rendered":"Iptables for NFS Server ports"},"content":{"rendered":"<p>How to configure Linux iptables for NFS server on Cent OS Fedora Linux Ubuntu Debian Redhat<\/p>\n<h3 style=\"font-family: inherit;\"><span style=\"text-decoration: underline;\">NFS Pre Configuration<br \/>\n<\/span><\/h3>\n<div style=\"font-family: inherit;\">\u00a0To enable NFS clients to access NFS server we need to enable the following services.<\/div>\n<div style=\"font-family: inherit;\"><\/div>\n<div style=\"font-family: inherit;\">a] TCP\/UDP 111 &#8211; RPC 4.0 portmapper<br \/>\nb] TCP\/UDP 2049 &#8211; NFSD (nfs server)<br \/>\nc] Portmap static ports &#8211; Dynamic ports defined in \/etc\/sysconfig\/nfs file.<\/div>\n<div style=\"font-family: inherit;\"><\/div>\n<div style=\"font-family: inherit;\">Port mapper assigns each NFS service to a port dynamically at service startup time.<\/div>\n<div style=\"font-family: inherit;\">Dynamic ports cannot be protected by port filtering firewalls such as iptables.<\/div>\n<div style=\"font-family: inherit;\">So we need to configure static ports for port map service<\/div>\n<div style=\"font-family: inherit;\"><\/div>\n<div style=\"font-family: inherit;\">Edit \/etc\/sysconfig\/nfs and add the below mentioned lines<\/div>\n<div style=\"font-family: inherit;\"><\/div>\n<div style=\"font-family: inherit;\"><b>#vim \/etc\/sysconfig\/nfs<\/b><\/div>\n<div style=\"font-family: inherit;\"><\/div>\n<pre style=\"font-family: inherit;\"><b> RQUOTAD_PORT=875\r\n LOCKD_TCPPORT=32803\r\n LOCKD_UDPPORT=32769\r\n MOUNTD_PORT=892\r\n STATD_PORT=662\r\n STATD_OUTGOING_PORT=2020<\/b><\/pre>\n<div><\/div>\n<div style=\"font-family: inherit;\">Save the file and restart the service<\/div>\n<div style=\"font-family: inherit;\"><\/div>\n<div style=\"font-family: inherit;\"><b style=\"background-color: white;\"># service portmap restart<br \/>\n# service nfs restart<br \/>\n# service rpcsvcgssd restart<\/b><\/div>\n<div style=\"font-family: inherit;\">\n<h3><span style=\"text-decoration: underline;\">Iptables for NFS<\/span><\/h3>\n<\/div>\n<div style=\"font-family: inherit;\"><\/div>\n<div style=\"font-family: inherit;\"><b>IP tables configuration for nfs <\/b><br \/>\nRun the following commands in Linux Shell.<\/div>\n<div style=\"font-family: inherit;\"><\/div>\n<pre style=\"font-family: inherit;\"><b>iptables -A INPUT -p tcp --dport 110 -j ACCEPT<\/b>\r\n<b>iptables -A INPUT -p udp --dport 110 -j ACCEPT<\/b>\r\n<b>iptables -A INPUT -p tcp --dport 2049 -j ACCEPT<\/b>\r\n<b>iptables -A INPUT -p tcp --dport 662 -j ACCEPT<\/b>\r\n<b>iptables -A INPUT -p udp --dport 662 -j ACCEPT<\/b>\r\n<b>iptables -A INPUT -p tcp --dport 875 -j ACCEPT<\/b>\r\n<b>iptables -A INPUT -p udp --dport 875 -j ACCEPT<\/b>\r\n<b>iptables -A INPUT -p tcp --dport 892 -j ACCEPT<\/b>\r\n<b>iptables -A INPUT -p udp --dport 892 -j ACCEPT<\/b>\r\n<b>iptables -A INPUT -p tcp --dport 32803 -j ACCEPT<\/b>\r\n<b style=\"background-color: white;\">iptables -A INPUT -p udp --dport 32769 -j ACCEPT <\/b><\/pre>\n<div style=\"font-family: inherit;\"><b>\u00a0<\/b><\/div>\n<div>Now Save and restart iptables<\/div>\n<div><b style=\"background-color: white;\"># iptables-save &gt; \/etc\/sysconfig\/iptables<\/b><br \/>\n<b style=\"background-color: white;\">or<\/b><br \/>\n<b>#service iptables save <\/b><b> <\/b><\/div>\n<p><b>#service iptables restart<\/b><\/p>\n<p>Also you can manually edit and \/etc\/sysconfig\/iptables and add the below mentioned line<\/p>\n<p>&nbsp;<\/p>\n<pre><b> -A INPUT -p tcp -m tcp --dport\u00a0 110 -j ACCEPT<\/b>\r\n <b>-A INPUT -p udp -m udp --dport\u00a0 110 -j ACCEPT<\/b>\r\n <b>-A INPUT -p tcp -m tcp --dport\u00a0 662 -j ACCEPT<\/b>\r\n <b style=\"background-color: white;\">-A INPUT -p udp -m udp --dport\u00a0 662 -j ACCEPT\u00a0<\/b>\r\n <b>-A INPUT -p tcp -m tcp --dport\u00a0 875 -j ACCEPT<\/b>\r\n <b style=\"background-color: white;\">-A INPUT -p udp -m udp --dport\u00a0 875 -j ACCEPT\u00a0<\/b>\r\n <b>-A INPUT -p tcp -m tcp --dport\u00a0 892 -j ACCEPT<\/b>\r\n <b>-A INPUT -p udp -m udp --dport\u00a0 892 -j ACCEPT<\/b>\r\n <b>-A INPUT -p tcp -m tcp --dport\u00a0 2049 -j ACCEPT<\/b>\r\n <b>-A INPUT -p tcp -m tcp --dport\u00a0 32803 -j ACCEPT<\/b>\r\n <b style=\"background-color: white;\">-A INPUT -p udp -m udp --dport\u00a0 32769 -j ACCEPT <\/b><\/pre>\n<p><b><\/b><br \/>\nSave the file and restart the service<\/p>\n<p><b>#service iptables restart<\/b><br \/>\n<b> <\/b><br \/>\n<b><\/b><\/p>\n<div style=\"font-family: inherit;\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>How to configure Linux iptables for NFS server on Cent OS Fedora Linux Ubuntu Debian Redhat NFS Pre Configuration \u00a0To enable NFS clients to access NFS server we need to&#8230; <a href=\"https:\/\/www.melberi.com\/linuxadmin\/iptables\/iptables-for-nfs-server\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[104,141],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/posts\/152"}],"collection":[{"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/comments?post=152"}],"version-history":[{"count":7,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/posts\/152\/revisions"}],"predecessor-version":[{"id":696,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/posts\/152\/revisions\/696"}],"wp:attachment":[{"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/media?parent=152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/categories?post=152"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/tags?post=152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}