{"id":25,"date":"2012-11-24T00:55:33","date_gmt":"2012-11-24T00:55:33","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=25"},"modified":"2018-04-27T15:32:18","modified_gmt":"2018-04-27T15:32:18","slug":"how-to-open-a-port-on-redhat-centos-or-fedora-linux","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/how-to-open-a-port-on-redhat-centos-or-fedora-linux\/","title":{"rendered":"How to Open a Port on Redhat, CentOS or Fedora Linux"},"content":{"rendered":"<p>By default iptables firewall stores its configuration at \/etc\/sysconfig\/iptables file. You need to edit this file and add rules to open port number.<\/p>\n<p>Note: if you have SELinux\u00a0 enabled, you&#8217;ll need to allow the port with <a href=\"http:\/\/www.incredigeek.com\/home\/semanage-allow-and-delete-ports-in-centos\/\">semanage<\/a>.<\/p>\n<h2>Open port 80<\/h2>\n<p>To open a different port just enter the port number.<\/p>\n<p>Open flle \/etc\/sysconfig\/iptables:<\/p>\n<pre># vi \/etc\/sysconfig\/iptables<\/pre>\n<p>Append rule as follows:<\/p>\n<pre>A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT<\/pre>\n<p>Save and close the file.\u00a0 Restart iptables:<\/p>\n<pre># \/etc\/init.d\/iptables restart<\/pre>\n<p>or,<\/p>\n<pre>#service iptables restart<\/pre>\n<p>&nbsp;<\/p>\n<p>Verify that port is open<\/p>\n<p>Run the following command:<\/p>\n<pre>netstat -tulpn | less<\/pre>\n<p>Make sure iptables is allowing the port you enabled:<\/p>\n<pre>iptables -L -n<\/pre>\n<p>If you need more info you can refer to the man page:<\/p>\n<pre>man iptables<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>By default iptables firewall stores its configuration at \/etc\/sysconfig\/iptables file. You need to edit this file and add rules to open port number. Note: if you have SELinux\u00a0 enabled, you&#8217;ll need to allow the port with semanage. Open port 80 &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/how-to-open-a-port-on-redhat-centos-or-fedora-linux\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,4,24,3,21,22],"tags":[17,19,15,7,20,16,18],"class_list":["post-25","post","type-post","status-publish","format-standard","hentry","category-centos-linux","category-command-line","category-fedora-2","category-linux","category-networking","category-redhat-linux","tag-centos","tag-fedora","tag-iptables","tag-linux-2","tag-open-port","tag-ports","tag-redhat"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/25","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=25"}],"version-history":[{"count":15,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/25\/revisions"}],"predecessor-version":[{"id":1987,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/25\/revisions\/1987"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=25"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=25"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}