{"id":378,"date":"2011-05-30T10:41:14","date_gmt":"2011-05-30T15:41:14","guid":{"rendered":"http:\/\/www.serverprontouniversity.com\/?p=378"},"modified":"2018-10-12T01:31:58","modified_gmt":"2018-10-12T06:31:58","slug":"check-and-open-ports-in-centos-fedora-redhat","status":"publish","type":"post","link":"https:\/\/www.serverpronto.com\/spu\/2011\/05\/check-and-open-ports-in-centos-fedora-redhat\/","title":{"rendered":"Check and open ports in CentOS \/ Fedora \/ Redhat"},"content":{"rendered":"<p>If you want to open or close a port for a Linux firewall you have to edit the rules in the iptables configuration. By default iptables firewall stores its configuration at \/etc\/sysconfig\/iptables file. You need to edit this file and add rules to open port.<\/p>\n<p>Here are the steps to open the port XY using the default visual editor vi:<\/p>\n<p><strong>Open port XY<\/strong><\/p>\n<p style=\"padding-left: 30px;\">Open file \/etc\/sysconfig\/iptables:<\/p>\n<p style=\"padding-left: 60px;\"><code># vi \/etc\/sysconfig\/iptables<\/code><\/p>\n<p style=\"padding-left: 30px;\">Append rule as follows:<\/p>\n<p style=\"padding-left: 60px;\"><code>-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport XY -j ACCEPT<\/code><\/p>\n<p style=\"padding-left: 30px;\">Save and close the file. Restart iptables:<\/p>\n<p style=\"padding-left: 60px;\"><code># \/etc\/init.d\/iptables restart<\/code><\/p>\n<p><strong>Verify that port is open<\/strong><\/p>\n<p style=\"padding-left: 30px;\">Run following command:<\/p>\n<p style=\"padding-left: 60px;\"><code># netstat -tulpn | less<\/code><\/p>\n<p style=\"padding-left: 30px;\">Make sure iptables is allowing port connections:<\/p>\n<p style=\"padding-left: 60px;\"><code># iptables -L -n<\/code><\/p>\n<p>For more information visit:<\/p>\n<p><a href=\"http:\/\/www.cyberciti.biz\/faq\/howto-rhel-linux-open-port-using-iptables\/\">http:\/\/www.cyberciti.biz\/faq\/howto-rhel-linux-open-port-using-iptables\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you want to open or close a port for a Linux firewall you have to edit the rules in the iptables configuration. By default iptables firewall stores its configuration at \/etc\/sysconfig\/iptables file. You need to edit this file and add rules to open port. Here are the steps to open the port XY using<\/p>\n","protected":false},"author":2,"featured_media":2884,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[64],"tags":[46,123,17,50,112,328,22,18],"class_list":["post-378","post","type-post","status-publish","format-standard","has-post-thumbnail","category-support-of-the-day","tag-centos","tag-cloud","tag-dedicated-server","tag-fedora","tag-hosting","tag-redhat","tag-server","tag-web-hosting"],"_links":{"self":[{"href":"https:\/\/www.serverpronto.com\/spu\/wp-json\/wp\/v2\/posts\/378","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.serverpronto.com\/spu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.serverpronto.com\/spu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.serverpronto.com\/spu\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.serverpronto.com\/spu\/wp-json\/wp\/v2\/comments?post=378"}],"version-history":[{"count":6,"href":"https:\/\/www.serverpronto.com\/spu\/wp-json\/wp\/v2\/posts\/378\/revisions"}],"predecessor-version":[{"id":2665,"href":"https:\/\/www.serverpronto.com\/spu\/wp-json\/wp\/v2\/posts\/378\/revisions\/2665"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.serverpronto.com\/spu\/wp-json\/wp\/v2\/media\/2884"}],"wp:attachment":[{"href":"https:\/\/www.serverpronto.com\/spu\/wp-json\/wp\/v2\/media?parent=378"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.serverpronto.com\/spu\/wp-json\/wp\/v2\/categories?post=378"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.serverpronto.com\/spu\/wp-json\/wp\/v2\/tags?post=378"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}