Iptables – Connection has timed out, iptables settings

connectioniptablestimeout

I am running two websites through a VPS using apache virtualhost. The first website is working. When I try to access the second website on Firefox or Chrome I keep getting the error: The connection has timed out.

I added the following line to my iptables:

-A INPUT -i eth0 -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT

and port 80 was open yesterday and today it says it is closed. Either way my first website still works so I am not sure if this is the problem.

My iptables config is:

:INPUT ACCEPT [0:0]  
:FORWARD ACCEPT [0:0]  
:OUTPUT ACCEPT [0:0]  
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT  
-A INPUT -p tcp -m tcp --dport 10000 -j ACCEPT  
-A INPUT -p tcp -m state --state NEW -m tcp --dport 2234 -j ACCEPT  
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT  
-A INPUT -p icmp -j ACCEPT  
-A INPUT -i lo -j ACCEPT  
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT  
-A INPUT -i eth0 -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT  
-A INPUT -j REJECT --reject-with icmp-host-prohibited  
-A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT

When I run the dig command it correctly points the A record to my VPS IP address.
What could be the problem here? I can't see what I am doing wrong.

Update: I tried hashing as recommended, that did not work. How can I check to see port 80 is open for both sites? I thought once port 80 is open, anything can connect to it?

Best Answer

you have defined port 80 twice with two different rule-sets? there could be a conflict due to this? can you check by hashing one of them?