Iptables blocking all my traffic for some reasson
I've installed stock Red Hat Linux 6 and I've installed lighttpd, it seems that my website loads only when i stop iptables (service iptables stop
), I'm not sure what's going on, because I haven't done anything to it. Is this intended?
This is expected. The default firewall settings for RHEL/CentOS are very restrictive. You'll need to open port 80 for your httpd service to be able to get connections
iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
should open the port. If this works then save the working state of the firewall with
service iptables save
This will update the /etc/sysconfig/iptables
file so that when the service is restarted the port will remain open.
The first thing I would do would be to verify what iptables rules you actually have loaded. Do an iptables -nvL
to list them all out; then look for any rules relating to tcp:80
. You could do that with a grep as well ... iptables -nvL | grep "dpt:80"
If you see any that are set to REJECT or DROP, then you need to see if they are actually needed, and if not, drop them from your ruleset. If things work after you've cleaned them up, make sure you do an /etc/init.d/iptables save
to save them out for the next reboot.