This describes how to set up and use ufw on Debian 10 Buster


Ensure your server is up to date with apt-get update & apt-get upgrade.

Step 1 Install ufw with apt-get install ufw
Step 2 Add port 22 to the firewall so you don't block ssh access to the server ufw allow ssh
Step 3 Ensure you have completed step 2, enable the firewall with ufw enable


Allowing a single port
Allowing port 80 on TCP ufw allow 80/tcp
Allowing port 80 on UDP ufw allow 80/udp
Allowing port 80 on both ufw allow 80

Allowing multiple ports
Allowing ports 80 and 443 ufw allow 80,443

Allowing a range of ports
Allowing ports 27010-27050 ufw allow 27010:27050

Allowing access from a specific IP
Allowing from ufw allow from