About Linux FAQ

Browse More FAQs:

Howto disable the iptables firewall in Linux

Posted by Vivek Gite [Last updated: December 23, 2007]

Q. Quick question: I need to disable firewall in Linux for testing purpose. I’m using CentOS 4.4. How do I disable the firewall in Linux?

A. A Linux firewall is software based firewall that provides protection between your server (workstation) and damaging content on the Internet or network.

It will try to guard your computer against both malicious users and software such as viruses/worms.

Task: Disable / Turn off Linux Firewall (Red hat/CentOS/Fedora Core)

Type the following two commands (you must login as the root user):
# /etc/init.d/iptables save
# /etc/init.d/iptables stop

Task: Enable / Turn on Linux Firewall (Red hat/CentOS/Fedora Core)

Type the following command to turn on iptables firewall:
# /etc/init.d/iptables start

Other Linux distribution

If you are using other Linux distribution such as Debian / Ubuntu / Suse Linux etc, try following generic procedure.

Save firewall rules
# iptables-save > /root/firewall.rules
OR
$ sudo iptables-save > /root/firewall.rules

Now type the following commands (login as root):
# iptables -X
# iptables -t nat -F
# iptables -t nat -X
# iptables -t mangle -F
# iptables -t mangle -X
# iptables -P INPUT ACCEPT
# iptables -P FORWARD ACCEPT
# iptables -P OUTPUT ACCEPT

To restore or turn on firewall type the following command:
# iptables-restore < /root/firewall.rules

GUI tools

If you are using GUI desktop firewall tools such as 'firestarter', use the same tool to stop firewall.
System > Administration > firestarter > Click on Stop Firewall button:

Howto disable the iptables firewall in Debian  / Ubuntu Linux

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Other Helpful FAQs:

Discussion on This FAQ

  1. mike Says:

    you can get the status of iptables with the following

    service iptables status

    service iptables help gives:

    Usage: /etc/init.d/iptables {start|stop|restart|condrestart|status|panic|save}

  2. Photos of China Says:

    I have this error on centOS

    /etc/init.d/iptables save
    Usage /etc/init.d/iptables {start|output_int|stop|restart|status}

  3. vivek Says:

    Are you sure you got CentOS? Another option is
    iptables-save > /root/working.fw

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 © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.