I have the following scenario:
I only want to allow access to 22, 80 and 443 ports and everything else permit.
My iptables -L
looks like this:
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere state RELATED,ESTABLISHED
DROP all -- anywhere anywhere
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
But I can't get the desired effect, and even from my server I can't ping anything anymore ( can't get on the internet anymore ).
Also, I looked at option to set INPUT
policy to DROP
and manually open the desired ports but that didn't take the desired effect either.
Is there any difference in putting the DROP
policy on INPUT
chain and manually open the desired ports and the way I did it by dropping all traffic as the last rule.
Thanks a bunch,
Best regards.
LOG
rule just before yourDROP
rule to see what you're dropping? You're not blocking any outbound traffic, and theRELATED,ESTABLISHED
rule should permit any return traffic from outbound connections. Might not be an iptables problem.-v
to see the complete rule.