UFW firewalls
Installation
Check UFW status
Note: UFW has to be executed pre-fixed by sudo
or if switching to root use su -
since ufw command isn't available by default to any of the users.
Useage
By default, UFW will block all of the incoming connections and allow all outbound connections. Defaults can be changed using the following command:
sudo ufw default <policy> <chain>
List apps
For more info on a particular app: sudo ufw app info 'Nginx Full'
Allow connections
To allow connections using the apps:
To allow connections using the port and the protocol:
Allow for port ranges:
sudo ufw allow 7100:7200/udp
Allow specific IP addresses (optionally to a specific port) :
sudo ufw allow from 64.43.12.41
sudo ufw allow from 64.43.12.41 to any port 22
Allow subnets:
sudo ufw allow from 192.168.1.0/24 to any port 3306
Enable and Disable UFW
Deny connections
sudo ufw deny from 23.24.25.0/24
sudo ufw deny from 23.24.25.0/24 to any port 443
Delete UFW rules
To see the rules that have been enabled:
Delete based on number or on port:
sudo ufw delete 3
sudo ufw delete allow 8069