What are the minimal iptables rules to surf the internet?

Posted by alexx0186 on Server Fault See other posts from Server Fault or by alexx0186
Published on 2012-06-05T03:17:27Z Indexed on 2012/06/05 4:42 UTC
Read the original article Hit count: 122

Filed under:
|

I am trying to set minimal rules to my Linux iptables rules file to just be able to surf the internet.

Here what I did:

* filter

-A OUTPUT -p tcp --dport 80 -j ACCEPT
-A OUTPUT -p tcp --dport 443 -j ACCEPT
-A OUTPUT -p udp --dport 53 -j ACCEPT

COMMIT

With just those rules, I can't surf the web.

I noticed that when I put -A INPUT -j ACCEPT, it works but I don't understand why. So what Input/output port do I need to surf the internet?

Thanks a lot. Regards

EDIT: It still doesn't work and my rules as as follows:

# generated by iptables-save
filter
:INPUT DROP [10:648]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [10:648]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPTED
COMMIT

© Server Fault or respective owner

Related posts about linux

Related posts about security