This article covers how you can easily activate the Firewall status on Ubuntu system and protect it from almost all the potential threats and attacks. In fact, The Uncomplicated Firewall (ufw) is a frontend for iptables and is particularly well-suited for host-based firewalls. ufw provides a framework for managing netfilter, as well as a command-line interface for manipulating the firewall.
How to enable UFW status on Ubuntu ?
To enable UFW, run the below command:
$ sudo ufw enable
How to Open SSH TCP port 22 connections ?
1. We can easily open SSH TCP port 22 using UFW as follows:
$ sudo ufw allow ssh
2. If you are running ssh on TCP port 2222 or TCP port 2323, run:
$ sudo ufw allow 2222/tcp
$ sudo ufw allow 2323/tcp