

To do this, open the UFW configuration with nano or your favorite editor.

This tutorial is written with IPv4 in mind, but will work for IPv6 as well as long as you enable it.If the Ubuntu server you have is enabled with IPv6 then ensure that UFW is configured to support IPv6 so that it will manage firewall rules for IPv6 in addition to IPv4. This tutorial will help you to set up a firewall with UFW on Ubuntu 16.04. If you do not want to manage your firewall through the command line there is a graphical user interface available for ufw called gufw.UFW, or Uncomplicated Firewall,it’s an interface to iptables, which simplifies the process of configuring a firewall.It’s an difficulty for the beginners to learn how to use it to properly configure a firewall.Because iptables is a solid and flexible tool If you’re looking to get started securing your network, and you’re not sure which tool to use, UFW may be the right choice for you. This will output a numbered list of rules, and the number may be used to delete a particular rule: Rules may be deleted with the following command: Port ranges may also be specified, a simple example for tcp would be: List the default programs with the following command: Ufw comes with preloaded defaults for some commonly used programs, and they are automatically activated when you make a rule by specifying the name of the program.

Other rules may be added in the same way by simply specifying a name of the program (Deluge, Transmission). Therefore, you must create a rule which allows SSH connections, by typing: For example, by default ufw denies all of the incoming connections, which will make it a problem if you are using SSH. Note: With this command you will also be able to see all of the defaults and rules which you have applied.Īllowing rules is quite simple from the command line, and it is sometimes necessary. Next, it is recommended to verify that the firewall is enabled by typing: For normal users the following defaults will do just fine. Note: it may be disabled the same way, by replacing enable with disable. If your connection gets interrupted before allowing SSH you may be locked out of your system.įirstly, the firewall must be enabled by typing: * Warning: If you are configuring over SSH, you may wish to allow SSH before enabling the firewall. However, simply installing the firewall will not turn it on automatically, nor it will have any rule set by default. Uncomplicated Firewall can be easily installed by typing this command into the terminal as a super user:
