Ufw

Ufw Cheat Sheet

Ufw

Basic commands

Defaults

sudo ufw default deny incoming
sudo uwf default allow outgoing

Allow HTTP (80)

sudo ufw allow http

or

sudo ufw allow 80

Allow HTTPS (443)

sudo ufw allow https

or

sudo ufw allow 443

Allow a Port Range

sudo ufw allow 8000:8100/tcp

Allow entire subnet to all ports

sudo ufw allow from 192.168.1.0/24

Allow a specific IP

sudo ufw allow from 192.168.1.50

Allow IP to a specific port

sudo ufw allow from 192.168.1.50 to any port 22

Allow subnet to specific port with specific protocol with comment

sudo ufw allow from 192.168.10.0/24 to any port 5900 proto tcp comment \
"Allow VNC from .10.0/24 subnet"