ufw
December 24, 2019
10:42 AM
other useful
dns
53
cellphone allow
sudo ufw allow from 204.48.93.2
sudo ufw allow 22/tcp
ssh
sudo ufw delete allow 22/tcp
sudo ufw allow 80/tcp
http
sudo ufw allow 443/tcp
https
sudo ufw allow 9090/tcp
cockpit
sudo ufw enable
sudo ufw disable
sudo ufw status
sudo ufw allow 443/tcp
sudo ufw app list
cat /etc/services
sudo ss
Combined command
sudo ufw allow 22/tcp && sudo ufw allow 80/tcp && sudo ufw allow 443/tcp &&sudo ufw allow 9090/tcp && sudo ufw enable && sudo ufw status
sudo ufw status

If it's inactive, enable it:
$ sudo ufw enable

Allow SSH connections from a specific IP address:
$ sudo ufw allow from 123.123.123.123 to any port 22 proto tcp

Allow FTP connections
$ sudo ufw allow from 123.123.123.123 to any port 21 proto tcp

View firewall rules:
$ sudo ufw status

Delete above SSH rule:
$ sudo ufw delete allow from 123.123.123.123 to any port 22 proto tcp

Disable Ubuntu Firewall:
$ sudo ufw disable
firewall-cmd --zone=trusted --add-source=204.48.93.2