Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A OUTPUT ! -p tcp -j DROP
iptables -A OUTPUT -p tcp --syn -j DROP
But as you probably can understand both of these rulesets only allows your webserver to communicate to the net. You will not be able to surf on the box aswell or do anything else...
You can always try firestarter or shorewall. I have shorewall running on my slackware 8.1 and it works great. Just follow the instructions and it will walk you through the setup. Here is the link:
Hmm, you have to be even more specific;
- Block ALL incoming connections to your computer? Yes, that's what you want isn't it?
- ONLY allow websurfing on the computer? Are these firewall rules intended to block the use of the computer for anything else than surfing the web?
- Should FTP be turned on as some services on the web require it?
This is a very basic firewall although it should deny most of the incoming connections. Every firewall is configured differently depending on what you run on your system so I suggest you read the HOWTO as it is very good to know how to create one that fits your purpose.
what Ztyx said, but where is this NAT table your talking about? AFAIK, IPTables doesn't have a NAT table by default...all it has is INPUT, OUTPUT and FORWARD...
to simplify things he could just:
iptables -F
iptables -A INPUT -p tcp --syn -j DROP
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.