Analytics

Basic Firewall


Like stated security is one of the top priorities, Ubuntu comes in with a simple non-GUI program called Uncomplicated Firewall, or simply ufw.

What this is basically a simple firewall program that runs on terminal and has diverse and easy to learn commands to keep your OS secure whilst retaining normal functionality.
So go ahead and open a terminal session and type sudo ufw status


This shall show firewall active status which should be inactive by default, also listing any rules that are active
So then the proper command to activate it would be sudo ufw enable , to turn it off it’s pretty much the contrary type sudo ufw disable


Okay so let’s play a game, you would like to disable all incoming/outgoing connections from the internet using your firewall, simply put in the commands sudo ufw default deny outgoing and sudo ufw default deny incoming , try opening a browser and making a connection to a website it will give the no internet error.


To reverse this it’s also pretty simple, contrary to deny is sudo ufw default allow outgoing and sudo ufw default allow incoming


Now for basic port opening and blocking, type in these commands sudo ufw allow <port number> or sudo ufw deny <port number> , you can also use this for IP addresses sudo ufw allow/deny from <IP address>


If you make any mistakes inputting the rules, you can remove them using the delete function: sudo ufw delete allow <port number> or for example sudo ufw delete deny from <IP address> any further dubiousness and you may type sudo ufw reset


Furthermore, this is how firewall status looks like thus far:


Basically all this is done for the purpose of controlling network activity from and to your PC, not too complicated huh?
So let’s uncomplicate things a little further, there exist GUI versions of this firewall.
Gufw for example. You know the drill. Type sudo apt-get install gufw and proceed as normal.

A GUI version of ufw which allows you to set firewall rules in a much easier way.