42

How do I turn off the firewall in Ubuntu 12.04?

Thanks for the answers. The reason for turning it off was twofold: I often cannot make a wireless connectin to internet and get the server is unable to connect message or I get a message that disappears telling me my domain is not compatible with the Avahi network whatever that is. So I thought if I disable firewall I would be ok.

So my question is as follows: What command line or configuration in Ubuntu 12.04 can I use to disable or stop the Ubuntu 12.04 default firewall?

Nathan Basanese
  • 422
  • 4
  • 17
  • one problem per one post please. – Raja G Feb 03 '13 at 00:55
  • whats the problem with the firewall in your ubuntu? – Raja G Feb 03 '13 at 00:55
  • 1
    I've removed one of your questions (based on the answer you received). If you still want to ask it, please ask it in a new question. – iBelieve Feb 03 '13 at 01:26
  • 6
    There isn't a firewall by default ( one is not needed ) so you will have to specify if you set one up, and if you know how to do that, you should know how to undo it. – psusi Feb 03 '13 at 03:20
  • 2
    @psusi I recommend posting something like that as an answer. – Eliah Kagan Feb 03 '13 at 05:38
  • 1
    @TheLordofTime "System" means (at least) two things. Do you mean every OS needs a firewall? Not every instance needs a one. As you say, Ubuntu's default firewall rules are permissive--it behaves like netfilter were unloaded from (or not compiled for/into) the kernel. This doesn't seem to cause security problems. Having ports closed when servers don't need to run is at least as effective as a firewall at preventing intrusion. If "stealth" mode is desired, a firewall is handy, but for WAN a NAT router is sufficient, and on LAN even a filtered node's layer 2 presence is often detectable. – Eliah Kagan Feb 03 '13 at 13:17
  • @TheLordofTime, wrong. The purpose of a firewall is to block access to insecure services, so you only need one if you are running insecure services, and for some reason, can't or won't disable or secure such services. The perception they are "needed" in Windows is because it ships with several insecure services installed by default. Ubuntu does not do such foolishness. – psusi Feb 04 '13 at 03:33
  • In response to a comment on my answer, this is NARQ. It's tough to figure out why you are trying to disable the firewall. Also, the firewall is likely not the cause of your problems, nor is Avahi (its how it discovers other systems on the local network). Therefore, I support the community's vote to NARQ this, because it's difficult to figure out why you're asking to disable the firewall. – Thomas Ward Feb 05 '13 at 22:26
  • Also, your wireless not working correctly is likely not related to the firewall, make a post saying "Can someone help me fix my wifi?" and then elaborate on the problems you're having. – Thomas Ward Feb 05 '13 at 22:32

4 Answers4

54

Actually Ubuntu got a firewall it self named uncomplicated firewall. For any reason you have problem with the firewall means you can simply disable it by running:

sudo ufw disable

from your terminal.

To again enable firewall write/paste the following command-

sudo ufw enable
Raja G
  • 102,391
  • 106
  • 255
  • 328
  • Note that ufw is only one way of configuring a firewall in Ubuntu so this would apply only if this was the method used. – thomasrutter Oct 25 '14 at 01:08
  • @ThomasW. No idea if that was true when you wrote that comment or not, but for me ufw was configured by default to block all incoming connections. Ufw wasn't enabled by default though, I had to manually enable it, so maybe that's what you meant? – Ajedi32 Jul 21 '15 at 13:55
12

sudo iptables -F will flush the firewall rules. You won't be able to turn off the firewall as it is built into the kernel.

  • 4
    What if you want to re-enable the rules later... say you're just disabling for a few minutes as a troubleshooting step. – Joel Coehoorn Mar 05 '15 at 20:30
7

By default, the firewall on Ubuntu (which can't be removed, because its part of the kernel) is unconfigured, and has default allow on everything. Unless you've added ufw or iptables rules, the firewall (which cannot be disabled because its part of the kernel) will not filter/block anything (Default ALLOW rule).

Thomas Ward
  • 74,764
1

I had a problem that I can not access a server on my hosting machine (Ubuntu 14.04 64 Bit) from a guest windows machine by VMWare Player. I had been around for like a two days searching for a network solution while the problem was all about firewall.

I decided that it is all about firewall and I tried to see how to stop the firewall, I tried this solution : sudo ufw disable
didn't work with me, however I used another way

sudo service iptables stop

Then i tried to access the servers, and IT WORKS finally. Hope this helps

aibrahim
  • 267