Linux Panda

Open Source | Linux | Android | Tech

How to add/enable/start Uncomplicated Firewall (UFW) during startup in Linux


Uncomplicated Firewall (UFW) is a simple/basic host-based firewall configuration tool used to manage iptables in an easy way.  UFW supports both IPv4 & IPv6.

Most of the Linux distros comes without a firewall.  Some Linux distros comes with UFW installed in it but UFW is not enabled by default.

If you are not comfortable with configuring UFW using command line then you may install Gufw which is a GUI to manage Ufw.  But using this tool, you can only add rules or enable/disable the firewall.  To add/enable/start UFW during startup, you have to run commands as root or sudo.

gufw

All ufw commands should be run as root or sudo.

After installing UFW, we should configure the basic/important rule.  We should deny all incoming connections by default.  You can either use Gufw and deny the incoming connections as show in the above image or use terminal to do that.  The command to do that is

sudo ufw default deny

 

In Debian & Ubuntu based distros, the command to start UFW (and also enable during startup) is,

sudo ufw enable

 

In Arch based distros, the commands to enable & start UFW during startup are,

sudo systemctl enable ufw
sudo systemctl start ufw

 

You can check the current status of UFW using the following command

sudo ufw status

sudo ufw status verbose

Advertisements

4 responses to “How to add/enable/start Uncomplicated Firewall (UFW) during startup in Linux

  1. Ryan August 28, 2013 at 18:59

    Great article. However, the commands to enable UFW during startup do not work on Ubuntu 13.04 — when entering the commands I receive the error: sudo: systemctl: command not found

    • LinuxPanda September 7, 2013 at 15:47

      Thank you very much for the feedback. “sudo ufw enable” is enough to enable ufw in Ubuntu. “systemctl” command is for arch based distros.

      I’ve updated the article. 🙂

  2. steve September 2, 2014 at 09:30

    each time I start up linux mint I always have to remember to start up ufw firewall as it doesn’t start automaticially, how can I cause the firewall to automaticially, I have previously tried sudo ufw enable but that never starts it up automatically, any ideas anyone. 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: