14
May
08

Ubuntu Firewall – ufw

ufw is a nifty little command that interfaces with the firewalling features built into the ubuntu kernel, and more specifically the iptables rules.

I remember working with iptables rules from a while back, and making line after line of script to activate and deactivate ports, addresses and such.

ufw makes that so much simpler. These commands are all run from a terminal. There’s no need for a gui, it’s easy enough as it is.

sudo ufw status displays the firewall’s current status, and the currently applied rules.
sudo ufw enable turns on the firewall
sudo ufw disbale turns off the firewall
sudo ufw default allow opens up everything – allow all connections by default
sudo ufw default deny closes down everything. Your computer is a black hole on the network. Nothing comes in unless you asked for it, or specifically allow it.
sudo ufw allow port opens up a specific port, like 80, for a webserver
sudo ufw deny port don’t want to host a webpage anymore? Deny that sucka.
sudo ufw deny from ipaddress block all access from a particular IP address.

So, if I do the following on my computer:

sudo ufw enable
sudo ufw default deny
sudo ufw allow 80

I’m switching on the firewall and blocking everything but port 80 for a webserver. The status command gives me:

michael@sparta:~$ sudo ufw status
Firewall loaded

To Action From
-- ------ ----
80:tcp ALLOW Anywhere
80:udp ALLOW Anywhere

Effectively invisible, except for the webserver.

Keep checking back for more reference guides.


0 Responses to “Ubuntu Firewall – ufw”


  1. No Comments

Leave a Reply




Stuff

Lifestream