nixCraft Poll

Topics

Linux Iptables block all network traffic

Posted by Vivek Gite [Last updated: November 15, 2007]

You would like to block all network traffic using iptables firewall under Debian GNU/Linux. This will block all incoming and outgoing traffic including Internet aka ADSL/ppp0 and it is highly recommend. The logic is block everything and allow only required traffic. This can be done with four simple commands:

# iptable -F
# iptables -P INPUT DROP
# iptables -P OUTPUT DROP
# iptables -P FORWARD DROP

Please do not enter above command over remote ssh login session.

Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

You may also be interested in other helpful articles:

Discussion on This Article:

  1. alireza sadeh seighalan Says:

    how can i use this order in fedora core?

  2. Thomas Says:

    Blocking really _ALL_ traffic can cause undesired effects. In fact quite a few applications use the internal loopback interface for internal communication. So the following two rules should be added to allow this:

    iptables -A INPUT -i lo
    iptables -A OUTPUT -o lo

    which allow all traffic via the loopback interface. This should be perfectly safe, even in a hostile environment since all external traffic is still blocked.

  3. Liju Says:

    hi,

    It’s better to disable the the network service than using such firewall

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , ,

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.