How to Set Up a Firewall with UFW on Ubuntu 20.04

Maneesh kushwaha
4 min readMay 26, 2020

How to Set Up a Firewall with UFW on Ubuntu 20.04

May 9, 2020 by Editorial Staff

Contents

How to Set Up a Firewall with UFW on Ubuntu 20.04

We hope this post helped you to find out How to Set Up a Firewall with UFW on Ubuntu 20.04

A firewall is a software for monitoring and filtering incoming and outgoing community visitors. It really works by defining a set of safety guidelines that decide whether or not to permit or block particular visitors.

Ubuntu ships with a firewall configuration software referred to as UFW (Uncomplicated Firewall). UFW is a user-friendly front-end for managing iptables firewall guidelines. Its primary aim is to make managing firewall simpler or, because the title says, uncomplicated.

This text describes how one can use the UFW software to configure and handle a firewall on Ubuntu 20.04. A correctly configured firewall is among the most vital features of general system safety.

Conditions #

Solely root or customers with sudo privileges can handle the system firewall. The perfect observe is to run administrative duties as sudo person.

Set up UFW #

UFW is a part of the usual Ubuntu 20.04 set up and must be current in your system. If for some cause it isn’t put in, you possibly can set up the bundle by typing:

sudo apt update
sudo apt install ufw

Check UFW Status #

UFW is disabled by default. You can check the status of the UFW service with the following command:

sudo ufw status verbose

The output will show that the firewall status is inactive:

Status: inactive

If UFW is activated, the output will look one thing to the next:

UFW Default Insurance policies #

The default habits of the UFW Firewall is to dam all incoming and forwarding visitors and permit all outbound visitors. Which means anybody attempting to entry your server will be unable to attach until you particularly open the port. Purposes and providers working in your server will be capable of entry the skin world.

The default polices are outlined within the /etc/ufw file and could be modified both by manually modifying the file or with the sudo ufw default <coverage> <chain> command.

Firewall insurance policies are the inspiration for constructing extra advanced and user-defined guidelines. Usually, the preliminary UFW Default Insurance policies are start line.

https://www.mstvlife.com/how-to-set-up-a-firewall-with-ufw-on-ubuntu-20-04/

Utility Profiles #

An utility profile is a textual content file in INI format that describes the service and incorporates firewall guidelines for the service. Utility profiles are created within the /etc/ufw/purposes.d listing in the course of the set up of the bundle.

You may checklist all utility profiles obtainable in your server by typing:

sudo ufw app list

Depending on the packages installed on your system, the output will look similar to the following:

Available applications:
Nginx Full
Nginx HTTP
Nginx HTTPS
OpenSSH

To find more information about a specific profile and included rules, use the following command:

sudo ufw app info 'Nginx Full'

The output shows that the ‘Nginx Full’ profile opens ports 80 and 443.

Profile: Nginx Full
Title: Web Server (Nginx, HTTP + HTTPS)
Description: Small, but very powerful and efficient web server
Ports:
80,443/tcp

You may as well create customized profiles to your purposes.

Enabling UFW #

Reading full article here https://www.mstvlife.com/how-to-set-up-a-firewall-with-ufw-on-ubuntu-20-04/

In the event you’re connecting to your Ubuntu from a distant location, earlier than enabling the UFW firewall, you will need to explicitly enable incoming SSH connections. In any other case, you’ll not be capable of connect with the machine.

To configure your UFW firewall to permit incoming SSH connections, sort the next command:

We hope the How to Set Up a Firewall with UFW on Ubuntu 20.04 help you. If you have any query regarding How to Set Up a Firewall with UFW on Ubuntu 20.04 drop a comment below and we will get back to you at the earliest.

We hope this post helped you to find out How to Set Up a Firewall with UFW on Ubuntu 20.04 . You may also want to see — How to Install Python Pip on Ubuntu 20.04

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response