Uncomplicated Firewall UFW / GUFW Setup Guide for Ubuntu

How to Install and Setup Uncomplicated Firewall (UFW) and its GUI – GUFW in Ubuntu.
Using a Firewall in Ubuntu is optional, unlike Windows it doesn’t have many ports open and therefore doesn’t need to restrict access into the system.
If you are using Ubuntu Server or are hosting a website from your home computer, then a Firewall would be a good thing to implement on your system.
If you are doing a lot of Torrenting then it might be a good idea to add a Firewall.

Install Instructions
Install GUFW: sudo apt-get install gufw

Setup GUFW
Change status to On
Create a new rule e.g. Deny TCP/23
Reboot
Test if the firewall is working: sudo ufw status

If Firewall doesn’t work try the following:
sudo ufw disable
sudo sed -i ‘s/ENABLED=no/ENABLED=yes/’ /etc/ufw/ufw.conf
sudo ufw logging off
sudo ufw enable
sudo ufw status

Example rules to create:
23/tcp, Deny In, Anywhere
6881 (or other torrent port), Allow In, Anywhere
22/tcp, Deny In, 192.168.1.1
137:139/udp, Deny In, 192.168.1.1
139/tcp, Deny In, 192.168.1.1
445/tcp, Deny In, 192.168.1.1
4732/tcp, Deny In, 192.168.1.1
Anywhere, Allow In 192.168.1.0/24
22/tcp, Deny In, Anywhere
137:139/udp, Deny In, Anywhere
139/tcp, Deny In, Anywhere
445/tcp, Deny In, Anywhere
4732/tcp, Deny In, Anywhere

Some Common Ports on Ubuntu Home Systems:
TCP 22 – SSH (Restrict Access)
TCP 23 – Telnet (Prevent Access)
UDP 68 – DHCP (Don’t block)
UDP 137:138 – Samba (Restrict Access)
TCP 139 – Samba (Restrict Access)
TCP 445 – Samba (Restrict Access)
TCP 4732 – Remina Remote Desktop (Restrict Access)
UDP 5353 – Avahi Service Discovery (Don’t block)

To see open TCP Ports
sudo netstat -napt | grep LISTEN

To see open UDP Ports
sudo netstat -napu

Wallpaper: http://imgur.com/8FrHx

Source: https://www.youtube.com/watch?v=zp0tg6popQ0

Leave a Reply

Your email address will not be published. Required fields are marked *