≡ Menu

Linux Disable / Remove The Iptables Firewall

How do I disable the iptables firewall in Fedora Linux?

Iptables command is used to set up, maintain, and inspect the tables of IP packet filter rules in the Linux kernel. You must run command as per your Linux distro.

howto-stop-disable-firewall-on-linux

How to stop and disable firewalld on CentOS Linux 7/RHEL v7 and newer only

Firewalld is a new firewall solution that has been part of CentOS 7.x+ or Red hat Enterprise Linux 7.x+ or the latest version of Fedora Linux. Type the following two commands as root user to disable and stop firewall permanently:
$ sudo systemctl disable firewalld
$ sudo systemctl stop firewalld
$ sudo systemctl status firewalld

How to stop and disable firewall on Ubuntu Linux server

Type the following command to disable UFW on Ubuntu Linux server:
$ sudo ufw disable

How to stop and disable firewall on older version of CentOS/RHEL version 6.x and earlier only

If you are using RHEL (Redhat), Fedora core or Cent os Linux just type following commands to disable the iptables firewall:
# service iptables save
# service iptables stop
# chkconfig iptables off

If you are using any other Linux distribution type the following command to clear up IPv4 based firewall rules:
# iptables -F
# iptables -X
# iptables -t nat -F
# iptables -t nat -X
# iptables -t mangle -F
# iptables -t mangle -X
# iptables -P INPUT ACCEPT
# iptables -P OUTPUT ACCEPT

You may need to put above rules in a shell script and execute the same. Also remove your iptables startup script from your network configuration file such as /etc/network/interfaces. Look for post-up directive.

Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:



{ 6 comments… add one }
  • Raph October 5, 2009, 11:01 pm

    Is there a way I can make some sort of bridge connection and if not, were do I type in this code

  • Matteo Cappelli April 8, 2010, 1:38 pm

    Simple and useful article! Now I understand how to disable iptables :-)… How is it possible to disable iptables in other distributions? Does the “service iptables stop” command work?

    thanks

  • Wagner Bianchi November 15, 2013, 2:12 pm

    It seems not that effective. When I restart server iptables will be up again!

  • John July 26, 2014, 4:20 pm

    Can I just de-install (remove) iptables ?

  • rf2632 January 25, 2017, 9:33 pm

    it doesn’t work for me on Centos 7 :

    [root@centos]# service iptables save
    The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
    [root@centos]# systemctl iptables save
    Unknown operation 'iptables'. 
    iptables is functioning on the background :
    [root@centos]# iptables -L
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination         
    
    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination         
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination

    But on every reboot everything comes back as default or something and ftp along with webmin are blocked! I hate this shit :)

    • Vivek Gite January 26, 2017, 4:26 am


      systemctl disable firewalld
      systemctl stop firewalld

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">


   Tagged with: , , , , , , , , , ,