Comments on Getting Started with UFW (Uncomplicated Firewall) on Ubuntu 22.04
UFW or Uncomplicated Firewall is an application to manage an iptables based firewall on Ubuntu. UFW is the default firewall configuration tool for Ubuntu Linux and provides a user-friendly way to configure the firewall, the UFW command is just like English language so the commands are easy to remember. The UFW firewall supports IPv4 and IPv6.
5 Comment(s)
Comments
While I execute the shell command "ufw status" - I am getting below error message.
ERROR: problem running iptables: iptables v1.6.0: can't initialize iptables table `filter': Permission denied (you must be root)Perhaps iptables or your kernel needs to be upgraded.
Ensure to run the command as root user or with sudo. If this is a virtual server, then it might be that the virtualization software does not allow it to run iptables.
When allowing access to a particular port, the command syntax is, "... to any port N" where N is the port number. Why is the word "any" required? I find it very confusing. We're only allowing access to a specified port, not "any" port.
this is in reply to marks comment ( the reply option won't let me type anything in the text box, so i have submit a completely new comment)
sudo ufw allow from 192.168.1.106 proto tcp to any port 22
the any in this case does not refer to the port.. rather to the destination ip.. ie allow a connection from 192.168.1.106 to any ip on the server on port 22.
if the server has multiple ip addresses configured, (multiple nics / vlans / additional ip's etc) then you can create a rule to allow connections to all of those ip's, or to a specific ip or subset of those ip's.
i wanted to see sudo ufw app list
this shows a list of applications installed that can be controlled with a short name