Installation:

sudo apt install ufw

Enable firewall:

ufw enable

Reload firewall:

ufw reload

Set default rules:

sudo ufw default deny incoming
sudo ufw default allow outgoing

Allow Port x via TCP/UDP:

ufw allow x/tcp
ufw allow x/udp

Allow several ports (from x to y via TCP):

ufw allow x:y/tcp

Allow application/service traffic:

ufw allow ssh
ufw allow http

Allow specific IP to specific port:

ufw allow from <IP address> to any port <port number>

Show status:

ufw status verbose

Show status with numbered rules:

ufw status numbered

Sourced from phoenixnap.com

  • linux/debian/ufw.txt
  • Last modified: 2023/06/15 21:56
  • by Zyzonix