Quick Tips: Firewall (ufw)
Ufw is a simple firewall tool for Linux. It comes as a command line version (ufw), or as a simple GUI program (gufw). Ufw is so simple, there's really no need to even bother installing the GUI version.

First thing's first, update your repo's and install ufw.
sudo apt-get update && sudo apt-get install ufw

We must set the default policies
sudo ufw default deny incoming
sudo ufw default allow outgoing

This will block all outside traffic and allow all traffic outgoing to the world wide web.

Now enable the firewall. This command will also make ufw start during every boot.
sudo ufw enable


If you ever need to stop the firewall, run this command..
sudo ufw disable

Let's open port 80 (most common for http software)
sudo ufw allow 80/tcp

Port 80 (via TCP) is now open for both IPv4 and IPv6

If you need to open let's say a range of ports, you can run something like this...
sudo ufw allow 5000:6000/udp

All UDP ports from 5000 through 6000 are open for both IPv4 and IPv6

Once you made a rule change, reload firewall for changes to take effect
sudo ufw reload


To display status of firewall
sudo ufw status

To display status plus more details
sudo ufw status verbose

To clear/reset all rules
sudo ufw reset

Forum Jump:

Users browsing this thread: 1 Guest(s)