tags: - ubuntu - firewall categories: - informational comments: true
Ubuntu API to iptables - ufw (uncomplicated firewall)
ufw status
first disable
ufw disable
Add rule
sudo ufw allow proto tcp to any port 22
sudo ufw allow proto udp to any port 53
sudo ufw allow from 203.0.113.103 proto tcp to any port 21
sudo ufw allow from 192.168.2.0/24 proto udp to any port 123
sudo ufw allow proto tcp to 0.0.0.0/0 port 22
sudo ufw allow proto tcp to 0.0.0.0/0 port 2222
sudo ufw allow proto tcp to 0.0.0.0/0 port 3306
sudo ufw allow proto tcp to 0.0.0.0/0 port 443
sudo ufw allow proto tcp to 0.0.0.0/0 port 80
sudo ufw allow proto tcp to 0.0.0.0/0 port 2224
sudo ufw allow proto tcp to 0.0.0.0/0 port 2323
Check application list
ufw app list
Enable Nginx application
sudo ufw allow “Nginx Full”
enable on reboot
ufw enable
check status
ufw status
cd /etc/ufw
https://www.digitalocean.com/community/tutorials/ufw-essentials-common-firewall-rules-and-commands