ufw needs to be enabled To open a port (ssh in this example): Rules can also be added using a numbered format: Similarly, to close an opened port: To remove a rule, use delete followed by the rule: It is also possible to allow access from specific hosts or networks to a port. The following example allows ssh access
sudo ufw enable
sudo ufw allow 22
sudo ufw insert 1 allow 80
sudo ufw deny 22
sudo ufw delete deny 22
The default firewall configuration tool for Ubuntu is ufw (Uncomplicated Firewall). Developed to ease iptables firewall configuration, ufw provides a user friendly way to create an IPv4 or IPv6 host-based firewall.
It is initially disabled. ufw is not intended to provide complete firewall functionality via its command interface, but instead provides an easy way to add or remove simple rules. It is currently mainly used for host-based firewalls.