UFW (Uncomplicated FW)
UFW (Uncomplicated Firewall) is a simple and user-friendly front-end for managing firewall rules on Linux systems. It helps users configure iptables (the underlying firewall) with easy-to-understand commands, primarily for securing a system by allowing or denying incoming and outgoing network traffic. UFW is a fairly simple firewall to manage and we will secure it in this section.
Enabling & Managing the Firewall on startup
We need to enable the ufw first , To enable and manage we will use the following command :
WARNING : If accessing using SSH , Then create ssh allow rule before enabling the firewall to avoid loosing access
The basic config file of ufw is located in
/etc/ufw/sysctl.conf
&/etc/defaults/ufw
, If you need better control you can edit this file accordingly.
We will firstly disabling the ufw to set some basic configurations to deny all incoming requests and allow all outgoing access
We have sucessfully done some basic configuration of the ufw firewall now we will start adding rules .
UFW Rules
Rules are the policies configured on ufw to allow or deny any connections on the server.
Allow SSH service
We can also allow other services using same systax
Allowing connections from particulat IP Address
Allowing connections from IPAddress or Network for SSH port
Resseting & Deleting Rules
To delete rules or reset the ufw comeletely we can do this with the following command
To view the rules currently applied on the firewall
Lets say we need to delete rule no 1 then we can do it with :
Now lets say we need to reset the ufw we can simpley do this with the following command :
Last updated