How to Disable a Firewall on RHEL/CentOS

It is generally not a good idea to disable the firewall on your dedicated server, but there are instances when it might be necessary. For example, if you need to run some network tests or perform some type of maintenance, you may need to have your firewall disabled. Most Linux distributions come with the standard kernel firewall and possibly even some interface for it. To disable the firewall in Red Hat Enterprise Linux or CentOS, simply follow these steps.

1. Login to your server either at the console or via SSH

2. Elevate to root and enter the following commands:

# service iptables save

# service iptables stop

# chkconfig iptables off

The output will look like this:

iptables: Flushing firewall rules: [ OK ]

iptables: Setting chains to policy ACCEPT: filter [ OK ]

iptables: Unloading modules: [ OK ]

To verify that the firewall is disabled type from the command line:

# service iptables status

When you are finished with your work, you can re-enable iptables with the following commands:

# service ip6tables start

# chkconfig ip6tables on

The output should look similar to this:

iptables: Applying firewall rules: [ OK ]

For more information about iptables, see the online documentation.