Disable / Turn Off Firewall in Ubuntu Linux Server

by on September 3, 2010 · 4 comments· LAST UPDATED September 3, 2010


How do I disable firewall in Ubuntu Linux server edition?

You can type the following command to see if firewall is active or not (open a terminal or ssh session and type the following command):
$ sudo iptables -L -n
Sample outputs:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     udp  --             udp dpt:53
ACCEPT     tcp  --             tcp dpt:53
ACCEPT     udp  --             udp dpt:67
ACCEPT     tcp  --             tcp dpt:67
Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --      state RELATED,ESTABLISHED
ACCEPT     all  --
ACCEPT     all  --  
REJECT     all  --             reject-with icmp-port-unreachable
REJECT     all  --             reject-with icmp-port-unreachable
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

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

A Note About ufw

The latest version of Ubuntu comes with ufw (now it is the default firewall configuration tool for Ubuntu). It is developed to ease iptables firewall configuration, ufw provides a user friendly way to create an IPv4 or IPv6 host-based firewall. To disable ufw, enter:
$ sudo ufw disable
You can also use GUI tool to enable or disable Firewall under Ubuntu Linux desktop edition by visiting System > Administration > Firewall configuration option:

Fig.01: Disabling Firewall In Ubuntu Linux

Fig.01: Disabling Firewall In Ubuntu Linux

Simply unselect "Enabled" option to turn off the firewall.

Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?

{ 4 comments… read them below or add one }

1 raj November 25, 2011 at 1:45 pm

pls give me solution for disable linux ubuntu version 2.24.1.


2 chandrasekharreddy February 23, 2012 at 5:19 am

#sudo ufw disable
Firewall stopped and disabled on system startup.


3 medo August 12, 2013 at 4:00 am

hi , thanks for your great help

i can connect via lan no problem but remotely always show an error messag
a connection could not be established to the ppp server try reconnecting , if the problem continues , verify your setting
and contact your administrator

i follow all the steps
what do u think where is the problem
thanks again for u help


4 Andrew August 21, 2013 at 10:32 pm

I ran that first command and it’s shown me the IP tables but they’re empty. Does this mean the firewall’s disabled or does it mean it’s running but effectively doing nothing? This should be on a pretty much OOB Ubuntu server 12.10.


Leave a Comment

Tagged as: , , , , , , , , , , , , , , , , , , , , , ,

Previous Faq:

Next Faq: