Wednesday, February 29, 2012

IPTables CentOS5.6 - port 80, 143, 443 allowed or open


I had my webserver setup perfectly and it was working fine but it was not accessible from outside. It was IPtables blocking the same. I read on internet about the rules for IpTables to allow access to port 80,443,143. below mentioned are the rules.

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 143 -j ACCEPT

But even after applying these rules things were not working because I was appending these rules after the rule

-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited


-------------------------------------------------------------------------------
I think (I don't know for sure) the rule for icmp shall always be at the last. Any rule after that to allow access to network resources will not get effective.

If I am wrong please correct.

You can refer to http://www.cyberciti.biz/faq/howto-rhel-linux-open-port-using-iptables/ for more information on IPTables.

No comments:

Post a Comment