How To Setup Linux Firewall With UFW

The Uncomplicated Firewall (ufw) is a frontend for iptables and is particularly well-suited for host-based firewalls. Its main goal is to make managing your firewall drop-dead simple and to provide an easy-to-use interface.


# –  Linux commands to be executed with root privileges
$ –  Linux commands to be executed as a regular non-privileged/limited user

Managing UFW (Uncomplicated Firewall) from the command line

UFW ( Uncomplicated Firewall ) firewall is a default firewall on Ubuntu 18.04

Check UFW installed on an ubuntu machine or not

The First Step is to check UFW is installed on Linux machine, or you can use the apt-get or aptitude command to install ufw feature.


How to Check firewall Status

we can use verbose output append word verbose to the above command:


How To Enable UFW Firewall Ubuntu

To Enable firewall execute command

How To Allow Connections In UFW

You change the firewall rules by issuing commands in the terminal. If we turned on our firewall now, it would deny all incoming connections. Let’s look at an example to enable SSH connections to the server to prevent that from happening:


SSH command above is one example.


How to Denying Connections In UFW Ubuntu Linux

If we want to delete any rule, ‘allow’ will replace with ‘deny’, example is as below


How To Delete Rules In UFW

There are two options to delete rules. below is the syntax:





How to Reset UFW Everything

If you want to reset your firewall rules to their default settings, you can do this by typing this command:

, , , , , , , , , , , , , , , , , , , , , , , , ,

One Reply to “How To Setup Linux Firewall With UFW”

Leave a Reply