A proper UFW Firewall Setup is one of the most important steps when securing an Ubuntu server. Firewalls help control incoming and outgoing network traffic by allowing approved connections and blocking unwanted access. On Ubuntu 20.04, the Uncomplicated Firewall (UFW) provides a simple way to manage firewall rules without dealing directly with complex networking configurations.
Whether you’re running a web server, database, or personal Linux machine, understanding UFW can significantly improve your system’s security posture.
UFW, short for Uncomplicated Firewall, is a user-friendly firewall management tool available on Ubuntu. It serves as a simplified interface for managing underlying firewall rules while making security administration easier for Linux users.
The primary goal of UFW is to reduce complexity while still offering powerful traffic filtering capabilities. This makes it suitable for both beginners and experienced administrators.
In most Ubuntu 20.04 installations, UFW comes pre-installed. If it is missing, you can install it using the package manager:
sudo apt updatesudo apt install ufw
After installation, verify its current status:
sudo ufw status verbose
A newly installed system typically shows the firewall as inactive.
Before enabling the firewall, it is important to understand its default behavior.
By default:
This configuration provides a secure starting point because external connections are denied unless explicitly permitted.
If you manage a server remotely, always allow SSH access before activating the firewall. Otherwise, you could lock yourself out of the system.
sudo ufw allow ssh
You can also permit web traffic:
sudo ufw allow 80/tcpsudo ufw allow 443/tcp
For installed applications, UFW supports predefined profiles:
sudo ufw app list
These profiles simplify rule management for services such as Nginx and OpenSSH.
Once required services are allowed, activate UFW:
sudo ufw enable
To view active rules:
sudo ufw status numbered
UFW also supports advanced rule creation.
sudo ufw allow from 192.168.1.100
sudo ufw allow 7000:7100/tcp
sudo ufw deny from 203.0.113.0/24
These options provide granular control over who can access your system and which services remain exposed.
UFW supports network address translation (NAT), IP forwarding, subnet filtering, and interface-specific rules. These features make it suitable for VPN gateways, routers, and enterprise environments.
If you need to remove a rule, use:
sudo ufw delete <rule-number>
To temporarily disable the firewall:
sudo ufw disable
For a complete reset:
sudo ufw reset
A well-planned UFW Firewall Setup is essential for protecting Ubuntu 20.04 systems against unauthorized access and network-based threats. By configuring sensible default policies, allowing only necessary services, and regularly reviewing firewall rules, administrators can significantly strengthen server security. Whether you’re managing a personal VPS or a production environment, UFW Firewall Setup offers a reliable and straightforward way to maintain a secure Linux infrastructure.
phpMyAdmin is a free, open-source PHP application that provides a browser-based interface for managing MySQL and…
Zabbix is a mature open-source infrastructure monitoring platform that collects metrics from network devices, servers, virtual…
Gradle is a powerful open-source build automation tool used primarily for Java, Kotlin, Groovy, and Android…
TeamViewer is a proprietary cross-platform remote access application for remote control, desktop sharing, file transfer, and online meetings. It is one of the most widely used remote support tools in the world, available for Windows, macOS, Linux, iOS, and Android. TeamViewer is not included in the Ubuntu repositories because it is proprietary software. This guide covers how to install TeamViewer on Ubuntu 18.04 using the official .deb package. The same steps apply to Ubuntu 16.04, Debian, Linux Mint, and Elementary OS. <strong>Prerequisite:</strong> You need sudo access. Install TeamViewer on Ubuntu: Download the .deb Package Download the official TeamViewer .deb package. The _amd64.deb suffix indicates this package is for 64-bit x86-64 systems. For ARM-based machines, download the appropriate package from the TeamViewer Linux downloads page: bashwget https://download.teamviewer.com/download/linux/teamviewer_amd64.deb Install the package using apt. The ./ prefix tells apt this is a local file path, not a package name from the repositories:…
Nagios is one of the most widely used open-source infrastructure monitoring systems in the world. It…
Laravel is an open-source PHP web application framework built around an expressive, developer-friendly syntax. It is…