Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1
show    REPORT Shows    a   firewall    report

-version Displays   version information

Next, you want to enable firewall logging. Much as with the enable
command, you run the following command:


Click here to view code image
matthew@seymour~:$ sudo ufw logging on


To enable specific ports on the firewall, you can run the ufw command along
with the port number to open. For example, if you want to allow port 80
(HTTP) incoming connections to your Ubuntu server, enter the following:


Click here to view code image
matthew@seymour~:$ sudo ufw allow 80


To remove the firewall rule allowing port 80 connections, run the following
command:


Click here to view code image
matthew@seymour~:$ sudo ufw delete allow 80


Many services are already defined in ufw. This means you don’t have to
remember the standard ports those services use, and you can allow, deny, or
delete by using the service name, like this:


Click here to view code image
matthew@seymour~:$ sudo ufw allow ssh


You can also allow incoming connections from particular IP addresses. For
example, if you want to let 192.168.0.1 connect to your server, enter the
following:


Click here to view code image
matthew@seymour~:$ sudo ufw allow from 192.168.0.1


To remove the firewall rule allowing the previous IP address to connect, run
the following command:


Click here to view code image
matthew@seymour~:$ sudo ufw delete allow from 192.168.0.1


There is a graphical interface called GUFW that you can install from the
Ubuntu repositories to manage UFW. The same details apply, but the interface
is easier and does not require you to remember as much as with UFW.


UFW is based on iptables, which is used to configure the Linux kernel’s

Free download pdf