If you are one of those nerdy types and use iptables, ignore this. If you are like the rest of us Ubuntu users (nerdy in denial), UFW (Uncomplicated Firewall) provides a handy tool to configure your firewall.
Here’s how to install. As root, type:
apt-get install ufw
If this can’t find the package, run
before running the command again. You’ll get it.
Next, add your exceptions. For example, on my server, I allow ssh (Secure Shell) and http (Hypertext Transfer Protocol).
# ufw allow ssh # ufw allow http
Then start the firewall
# ufw enable
It will ask
Command may disrupt existing ssh connections. Proceed with operation (y|n)?
Reply “y”. Simply hitting enter will abort.
This should return:
Firewall is active and enabled on system startup
If you get an error like
ERROR: problem running ufw-init
Edit the file /etc/default/ufw and change IPv6=yes to IPv6=no