UFW (Uncomplicated Firewall)

The Linux kernel provides a packet filtering system called netfilter. Netfilter is usually controlled by the iptables commands. Using iptables, you can manage Netfilter in a flexible way; however, iptables are not easy to use. UFW (Uncomplicated Firewall) is a frontend program for iptables that provides an easy-to-use user interface for people who are not familiar with firewall concepts.

Overview of UFW

There are six types of ufw commands.

  1. Check UFW Status
  2. Enable and Disable UFW
  3. Default Policy Setting
  4. Allow or Deny Ports
  5. Allow or Deny IP Addresses
  6. Delete Policies

To run ufw commands, you need the superuser privilege. For better operational efficiency, switch to the superuser for this section.

Command Line - INPUT
sudo su -

1. Check UFW Status

As a default setting, UFW is not enabled yet, although the ufw.service daemon process may be already running. Check UFW status by running the ufw status command.

Command Line - INPUT
ufw status
Command Line - RESPONSE
Status: inactive

2. Enable and Disable UFW

To enable UFW, use the ufw enable command. There will be an alert about ssh connection.

Command Line - INPUT
ufw e