Linux Ubuntu

How to Install Firewall in Linux Ubuntu

Firewall in Linux is heard weird when you read this post. Some of you, maybe just learn Linux, will laugh, and ask,”Bitch please, are you kidding me? Linux is safe, right?” Okay, you will do this because there are few hackers that attack Linux network (server, webhosting, etc). Usually Windows was targeted by crackers because Windows has a lot of users.

Firewall in Linux Ubuntu

But Linux is a man-made system, it is not 100% safe from hacker attacks. Every software surely has bug, and many bugs can be exploited and became security issue. So the best prevention from hacker’s attack is by secure your system. One of the recommendation is by using firewall.

Recently I use UFW (Uncomplicated Firewall). UFW is Ubuntu-specific firewall. There are a GUI version called Gufw, so you can work with it easily.  You can install Gufw by type on terminal

sudo apt-get install gufw

After install it, ufw is disable in default. You can check it by type

sudo ufw status

So you must enable ufw to make firewall works.

sudo ufw enable

If you want to disable it, you just type

sudo ufw disable

You can set deny or allow all incoming connections by default. Just type this

sudo ufw default deny

sudo ufw default allow

Simple. Now if you want to allow or block a specific address, you can use the following command

sudo ufw deny/

sudo ufw allow/

Check the following example

sudo ufw allow 22/tcp from $address/mask
sudo ufw deny 80 from x.x.x.x

You can see that 22 is TCP port, and 80 is HTTP port. For your information, HTTP used port 80, 8080, and 8008. It is readable, isn’t it? Okay, if you want to enable or disable logging in, just type this

sudo ufw logging on

sudo ufw logging off

Feel free to visit here to get more command about ufw

That’s all about firewall in Linux Ubuntu, you can use ufw (Uncomplicated firewall) or use others tool like iptables.


One reply on “How to Install Firewall in Linux Ubuntu”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.