Index

Ubuntu Firewall

Start Stop

turn on firewall
sudo ufw enable
turn off firewall
sudo ufw disable
get status
sudo ufw status verbose

Open Ports

open port
sudo ufw allow 8080
open port, but block brute force attacks
sudo ufw limit ssh
delete rule
sudo ufw delete allow 8080
open range of ports
sudo ufw allow 6881:6999/tcp
list indexes for rules
sudo ufw status numbered
delete rules by index
sudo ufw delete [index]

Whitelist ips

whitelist ip
sudo ufw allow from 192.168.0.22
delete rule
sudo ufw delete allow from 192.168.0.22
whitelist ip range 192.168.0.xxx
sudo ufw allow from 192.168.0.0/24
whitelist ip range 192.168.xxx.xxxfor more on ip ranges google "netmask calculators"
sudo ufw allow from 192.168.0.0/16