STEPS ON HOW TO SET UP A FIREWALL WITH UFW ON UBUNTU TO TERNET SERVERS
UFW, or Uncomplicated Firewall, is an interface to
iptables that is geared towards simplifying the process of configuring a firewall.
This tutorial will show you how to set up a firewall with UFW on Ubuntu 18.04.
To follow this tutorial, you will need:
sudonon-root user, which you can set up by following Steps 1–3 in the Initial Server Setup with Ubuntu 18.04 tutorial.
UFW is installed by default on Ubuntu. If it has been uninstalled for some reason, you can install it with
sudo apt install ufw.
In recent versions of Ubuntu, IPv6 is enabled by default. In practice that means most firewall rules added to the server will include both an IPv4 and an IPv6 version, the latter identified by
v6 within the output of UFW’s status command. To make sure IPv6 is enabled, you can check your UFW configuration file at
/etc/default/ufw. Open this file using
nano or your favorite command line editor: