How To: Disable Firewall on RHEL / CentOS / RedHat Linux

I don’t want firewall because I only run one http (port 80) public service. How do I turn off or disable firewall permanently under RHEL / Fedora Linux / Red Hat Enterprise Linux and CentOS Linux?

iptables is administration tool / command for IPv4 packet filtering and NAT. You need to use the following tools:

ADVERTISEMENTS

[a] service is a command to run a System V init script. It is use to save / stop / start firewall service.

[b] chkconfig command is used to update and queries runlevel information for system service. It is a system tool for maintaining the /etc/rc*.d hierarchy. Use this tool to disable firewall service at boot time.

How Do I Disable Firewall?

First login as the root user.

Next enter the following three commands to disable firewall.
# service iptables save
# service iptables stop
# chkconfig iptables off

If you are using IPv6 firewall, enter:
# service ip6tables save
# service ip6tables stop
# chkconfig ip6tables off

Check out related media

🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
36 comments… add one
  • cindy watson Jan 23, 2009 @ 3:58

    #service iptables save #service iptables stop #chkconfig iptables off

  • jottos Mar 13, 2009 @ 8:38

    thanks, right to the point, just what I needed.

  • evil DBA Apr 24, 2009 @ 0:46

    gracias me fue muy útil!!!

  • julien alarmiste Aug 19, 2009 @ 20:21

    thanks very much;
    i’m french and, also, I need just this command for my appache server … !!

  • Tommy Mar 29, 2010 @ 9:50

    Excellent, you save my day

  • Randy Jul 31, 2010 @ 15:20

    How do you restart it?

  • Dean Hales Sep 21, 2010 @ 22:18

    service iptables restart

  • Sayeed Salahuddin Oct 5, 2010 @ 15:02

    Excellent, it made my apache and vncserver connect successfully :)

    thanks,
    Sayeed

  • Raju Nov 17, 2010 @ 11:42

    Thanks a ton. My problem is solved and i can leave home now.

  • Private Dec 3, 2010 @ 22:10

    Thank you! :)

  • SF Mar 9, 2011 @ 11:27

    Thank You!
    Worked Perfectly!

  • matt Mar 28, 2011 @ 15:47

    Thanks… graphical install of RHEL5.5 automatically starts the firewall (and selinux in paranoid mode) which completely compromises using it as a pxe server… this fixed the last issue quickly.

  • Mughees Hafeez Jun 28, 2011 @ 5:40

    Dear Thanks, for such a productive commands… most of the user have the problem after installing httpd that its not showiing in the browser….. a tip for them disable SElinux and as well as firewall method given above… it will work fine insh ALLAH

  • k3b Jul 2, 2011 @ 15:01

    Thanks, this is the right way to disable firewall in my case was under CentOS server

  • Josh Jul 28, 2011 @ 5:15

    Hi there, thanks for this. Just wondering, what does the service “save” command do?

  • Sumeet Sep 2, 2011 @ 15:56

    G8 ! to the point and well documented .

  • LeeThong Oct 2, 2011 @ 7:36

    thanks !

  • Rob Dec 22, 2011 @ 11:58

    Just a question:

    if i only stop iptables service without stopping ip6tables, does the firewall still block all connections even if they are ipv4? Or it only stops ipv6 connections?
    Iptables service is for ipv4 connections, and ip6tables for ipv6 ones, so i would like to know if stopping iptables is enough to disable firewall, or it still remain active if ip6tables is active.
    Thanks
    Rob

  • darrell Jan 18, 2012 @ 3:14

    thanks so much ,I spent 2 days trying to access home server, Now works fine
    You made my day !!!

  • Anil Jan 24, 2012 @ 5:17

    Thanks,
    This helped a lot.
    I was trying to execute a command using rsh on one of my RHEL servers in a private network but was unable to do that. Turns out that all I needed was to disable the firewall.

  • veve Mar 27, 2012 @ 19:45

    Thanks!!!
    Is there any command to check the status of the firewall??

    • 🐧 nixCraft Mar 27, 2012 @ 20:37

      As root run:

      /sbin/iptables -L -n -v
      /sbin/service iptables status
      /sbin/service ip6tables status
      
  • Habeeb Oct 24, 2012 @ 13:37

    Dear All,

    Can anyone tell me how to stop the iptables permanently after restart the server.
    Actually i face a problem in Centos 6.3 x86_64 version that i stop the iptables as you mentioned.
    # service iptables save
    # service iptables stop
    # chkconfig iptables off
    But after restarting the server again the iptables is on after doing chkconfig also can anyone help me in this.???

    • Ben Sodenkamp May 27, 2014 @ 22:45

      I replaced the /sbin/iptables binary with a script that told me things about the process. Tracked the issue to libvirtd. If you don’t need libvirtd, try turning it off. This worked for me.

      Ben

  • Rick Dec 20, 2012 @ 4:00

    You can set up a batch script but i think there should be a way to permeanently stop it.
    I think its easier to use the GUI for the firewall but i would recommend to use the command line as well to understand how it works. (Just in case your GUI does not work….)

    https://www.cyberciti.biz/faq/turn-on-turn-off-firewall-in-linux/

  • jessic Mar 12, 2014 @ 17:06

    Tu aporte me ha salvado de 3 dias de no poder conectar mi aplicacion al servidor de BD.. thanks!

  • cristian Jun 10, 2014 @ 21:09

    Oscar dice que le salvaste 4 días de trabajo duro e intenso.

    Gracias x el aporte

  • Wellington Torrejais da Silva Jun 24, 2014 @ 13:56

    Thanks!!!

  • Marco Jan 7, 2015 @ 23:41

    Great, thanks!

  • global74 Feb 11, 2015 @ 23:42

    Very useful information. Thanks very much for the insight!

  • Hardy Cahyadinata May 4, 2015 @ 12:17

    Please HELP.. i can’t acces WHM after Installation on VM Azure.
    Please Ayone Help me..thanks

  • Mohit May 7, 2015 @ 4:48

    Thanks You very much…i am tried manny command but finally work your three command. :)

  • Nnaemeka Sep 1, 2015 @ 18:42

    Thanks! Very helpful. I was working in the cloud on a private network and this was the issue all along

  • 0_XX4 Nov 22, 2015 @ 14:43

    Danke , this is what I needed. Thanks for sharing .
    If you are using the later version of CENTOS – 7+ ,
    you can use the systemctl utility.

  • Kiran Mar 2, 2016 @ 19:06

    Works like a charm,
    Thanks for the info !!!

  • David May 12, 2016 @ 19:37

    This solution work Ok many tanks . Despite you disable the firewall by graphical way it does not work .

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.