ufw is the default firewall configuration tool for Ubuntu.

To check the ufw status
sudo ufw status verbose

To open a port (ssh in this example):
sudo ufw allow 22

To close a port
sudo ufw deny 53

To add add service by name
sudo ufw allow ssh

to disable/enable ufw
sudo ufw disable
sudo ufw enable

Log files are also interesting
less /var/log/auth.log

Note: If you are connected to remote machine (through ssh for example) and enable the firewall, before allowing port 22, probably the connection will be closed and you won’t be able to connect again πŸ™‚

Basic firewall configuration for Ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *