Skip to content

ufw

Uncomplicated firewall

  • Install

Bash
sudo apt install -y uwf
- Enable

Bash
sudo ufw enable
  • Add a rule denying all incoming traffic - works on outgoing as well
Bash
sudo ufw default deny incoming 
  • Check status

Bash
sudo ufw status 
Bash
sudo ufw status numbered
Bash
sudo ufw status verbose

  • Reload added rules
Bash
sudo ufw reload
  • Delete rule (sudo ufw status numbered)
Bash
sudo ufw delete 5
  • Allow example tcp port
Bash
sudo ufw allow 223/tcp
  • Allow range of ports
Bash
sudo ufw allow 30000:35000/tcp
  • Allow incoming traffic from IP
Bash
sudo ufw allow from 109.xx.xx.xx
  • Deny ports
Bash
sudo ufw deny 3306

Check:

digital-oceans examples

Back to top