Uncomplicated Firewall (UFW)

RackSpace's flavor of Ubuntu has installed the Uncomplicated Firewall and enables it by default (my experience).  Nice utility to manage the iptables for a local software based firewall.  ​

Enable UFW

To turn UFW on with the default set of rules:

sudo ufw enable

To check the status of UFW:

sudo ufw status verbose

Allow

sudo ufw allow <port>/<optional: protocol>

example: Allow incoming tcp and udp packet for MySQL

sudo ufw allow 3306  #open port for MySQL

example: To allow incoming tcp and udp packet on port 53

sudo ufw allow 53

example: To allow incoming tcp packets on port 53

sudo ufw allow 53/tcp

example: To allow incoming udp packets on port 53

sudo ufw allow 53/udp

Deny

sudo ufw deny <port>/<optional: protocol>

example: To deny tcp and udp packets on port 53

sudo ufw deny 53

example: To deny incoming tcp packets on port 53

sudo ufw deny 53/tcp

example: To deny incoming udp packets on port 53

sudo ufw deny 53/udp