{"id":223,"date":"2006-11-03T16:27:03","date_gmt":"2006-11-03T20:27:03","guid":{"rendered":"http:\/\/www.dr-chuck.com\/wordpress\/?p=223"},"modified":"2011-12-17T12:21:04","modified_gmt":"2011-12-17T16:21:04","slug":"how-to-open-a-port-on-linux-using-iptables-linux-firewall-is-a-pita","status":"publish","type":"post","link":"https:\/\/www.dr-chuck.com\/csev-blog\/2006\/11\/how-to-open-a-port-on-linux-using-iptables-linux-firewall-is-a-pita\/","title":{"rendered":"How to open a port on Linux using iptables (Linux firewall is a PITA)"},"content":{"rendered":"<p>\/sbin\/iptables -L<br \/>\n[root@s-sakai-1 etc]# vi \/etc\/sysconfig\/iptables<br \/>\n# Chuck ports<br \/>\n-A RH-Firewall-1-INPUT -m state &#8211;state NEW -m tcp -p tcp &#8211;dport 8090 -j ACCEPT<br \/>\n-A RH-Firewall-1-INPUT -m state &#8211;state NEW -m tcp -p tcp &#8211;dport 8092 -j ACCEPT<br \/>\n# Lancaster ports<br \/>\nroot@s-sakai-1 etc]# \/sbin\/service iptables restart<br \/>\nFlushing firewall rules:                                   [  OK  ]<br \/>\nSetting chains to policy ACCEPT: filter                    [  OK  ]<br \/>\nUnloading iptables modules:                                [  OK  ]<br \/>\nApplying iptables firewall rules:                          [  OK  ]<br \/>\n[root@s-sakai-1 etc]#<br \/>\nGrrr &#8211; I dislike fancy newfangled things &#8211; in BSD 4.3 &#8211; we did not have to do this!<br \/>\n&#8212;&#8212;&#8211; Comments &#8212;&#8212;-<br \/>\nToo bad you don&#8217;t allow comments in your blog. :)<br \/>\nAnyway, I wanted to share an iptables tip &#8211; to restart it, it&#8217;s safer to use iptables-restore:<br \/>\niptables-restore < \/etc\/sysconfig\/iptables\nThis will do a syntax check and only reload it if it's correct - useful when hand-editing. The other way could stop the firewall but not bring it back up if the syntax is off.\nMike Osterman\nWhitman College\n\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/sbin\/iptables -L [root@s-sakai-1 etc]# vi \/etc\/sysconfig\/iptables # Chuck ports -A RH-Firewall-1-INPUT -m state &#8211;state NEW -m tcp -p tcp &#8211;dport 8090 -j ACCEPT -A RH-Firewall-1-INPUT -m state &#8211;state NEW -m tcp -p tcp &#8211;dport 8092 -j ACCEPT # Lancaster ports root@s-sakai-1 etc]# \/sbin\/service iptables restart Flushing firewall rules: [ OK ] Setting chains to policy [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-223","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/223","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/comments?post=223"}],"version-history":[{"count":1,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/223\/revisions"}],"predecessor-version":[{"id":2323,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/223\/revisions\/2323"}],"wp:attachment":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/media?parent=223"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/categories?post=223"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/tags?post=223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}