UFW Ubuntu Firewall Quick Reference

Mindwatering Incorporated

Author: Tripp W Black

Created: 02/15/2011 at 08:42 PM

 

Category:
Ubuntu
Configuration Files

UFW (ufw) is the Ubuntu firewall.
It's generally updated via command line. Anything not specifically allowed is denied. So this gets really simple.

To enable:
sudo ufw enable

To print status:
sudo ufw status

To allow a TCP/4 and TCP/6 port:
sudo ufw allow proto tcp to any port 1352

To allow just the TCP/4 port:
sudo ufw allow proto tcp to any port 1352 from 192.168.n.0/24
Note: substitute "n" with your subset number

This just opened up TCP traffic on the Lotus Notes port 1352 on the workstation/server.
This creates the rule:
1352/tcp ALLOW 192.168.n.0/24

To allow any protocol on a port:
sudo ufw allow to any port 9876 from 192.168.n.0/24
This creates the rule:
9876 ALLOW 192.168.n.0/24

To delete the rule, you either need to know its rule number or you can delete by its "name".
So for the rule:
1352/tcp ALLOW 192.168.n.0/24
We can delete it with:
sudo ufw delete allow proto tcp to any port 1352 from 192.168.n.0/24

Basically, it's the same command to allow it, except you just stick in the delete action.

Type ufw -h to see more commands.



previous page

×