An introduction to Uncomplicated Firewall (UFW)
UFW stands for an uncomplicated firewall. This program has a command-line interface and a Netfilter (iptables) firewall management framework.
The UFW firewall tool runs on hosts or servers and is designed to protect data. Depending on its configuration, it allows or blocks outgoing and incoming connections on a server. Using UFW, you can block specific ports, IP addresses, or entire subnetworks. This is not as flexible as iptables but much simpler for basic operations. Ubuntu 8.04 LTS and newer installations come with Ubuntu UFW by default.
This tutorial will review a few utilities and techniques for debugging the UFW.
Let’s start,
Step 1: Enable UFW
The UFW will be enabled with a default set of rules when the following commands are entered,
sudo ufw enable
You can check the status of the server firewall by running this command,
sudo ufw status
Here are some possible results,
1) UFW is not installed.
2) UFW is installed but not configured.
3) UFW is running.
1) sudo ufw status ufw: command not found ======================= 2) sudo ufw status Status: inactive ======================= 3) sudo ufw status Status: active To Action From -- ------ ---- 1194 ALLOW Anywhere 80 ALLOW Anywhere 443(v6) ALLOW Anywhere
Step 2: Disable UFW
Enter this command to disable,
sudo ufw disable
Step 3: Reset UFW to default
Enter this command to reset the configuration back to default,
sudo ufw reset
We’re going to demonstrate one operation with the UFW, enabling Only SSH and denying everything else,
In this example, inbound traffic is blocked except for SSH (port 22).
sudo ufw default deny incoming sudo ufw default allow outgoing sudo ufw allow ssh sudo ufw enable sudo ufw reload
However, we haven’t discussed all the valuable commands here, so investigate them.
That’s it!
VPSie is looking forward to embarking on a new journey with you!
Get the most out of learning
UFW stands for Uncomplicated Firewall. It is a user-friendly front-end for the iptables firewall that is used to manage network traffic on Linux systems.
A firewall is a security system that monitors and controls network traffic to and from a computer or network. It is used to protect against unauthorized access and to prevent malicious activity such as hacking, malware, and other types of cyber attacks
UFW works by allowing users to configure firewall rules that determine what network traffic is allowed to pass through the firewall. By default, UFW denies all incoming connections, and allows all outgoing connections. Users can then add rules to allow specific types of incoming or outgoing traffic based on their needs.
UFW is typically installed by default on many Linux distributions, but if it is not installed, it can be installed using the following command:
sudo apt-get install ufw
To enable UFW, you can use the following command:
sudo ufw enable
This will enable the firewall and apply the default rules that deny all incoming traffic and allow all outgoing traffic.
To add firewall rules with UFW, you can use the following syntax:
sudo ufw [allow/deny] [service/port/protocol]
For example, to allow incoming SSH connections, you can use the following command:
sudo ufw allow ssh
To check the status of UFW, you can use the following command:
sudo ufw status
This will show you the current status of the firewall and the rules that are currently in effect.