Yikes! This post is over a year old!
If you think it deserves a rewrite please get in touch or leave a comment.
— Thanks, Ash.
Allow and Deny
For this you’ll need to be logged in to your server as a user with admin privileges.
To permit an IP address to connect to your web server’s port 80
(typically used for web servers) you can use the following command. Substitute the fake IP address for the one that you wish to permit.
sudo ufw allow from 111.222.333.444 to any port 80
To block an IP address from connecting to the same port, you can use:
sudo ufw deny from 111.222.333.444 to any port 80
Manage firewall rules
You can view a list of all firewall rules using this command
sudo ufw status numbered
If you need to delete a rule simply list all rules as above, then use the number of the row to delete
sudo ufw delete [insert-number]