01 August 2013

How To: Disable Iptables Firewall In Ubuntu Server

You can type the following command to see if firewall is active or not:

$ sudo iptables -L -n

You can save existing firewall rules as follows:

$ sudo iptables-save > firewall.rules

Finally, type the following commands to stop firewall:

$ sudo iptables -X
$ sudo iptables -t nat -F
$ sudo iptables -t nat -X
$ sudo iptables -t mangle -F
$ sudo iptables -t mangle -X
$ sudo iptables -P INPUT ACCEPT
$ sudo iptables -P FORWARD ACCEPT
$ sudo iptables -P OUTPUT ACCEPT

To disable ufw, enter:

$ sudo ufw disable

How To: Disable Iptables Firewall In Redhat/CentOS Linux

To disable iptables in Redhat/CentOS we have to use the following commands:

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

If you want to remove iptables completly from your system, use the "rpm" command:
#rpm -e iptables