Configuring UFW (“uncomplicated firewall”) on Debian and Ubuntu.
UFW is a very easy to use firewall for Linux. Today I’ll show you how to install it on Debian (and Ubuntu).
First off, install UFW if you haven’t already.
Allow the ports you would like to have open (add SSH as that’s probably what you’re using to talk to your server).
Some services like “http” and “ssh” can be added like this:
Then we need to enable the firewall (make sure you’re not locking yourself out).
If you’re adding new rules, you will need to reload the firewall.
To delete a rule, you will need to see which number it has.
Delete the rule using the list of numbers on the left hand side.
(replace 2 with the number you would like to delete).
Don’t forget to reload the firewall.
That should be it! You know have a basic firewall!