Step by step Ubuntu Uncomplicated Firewall configuration

Linux, Ubuntu, 2015-06-16 23:26:20 UTC

Firewall is a network security system that controls the incoming and outgoing network traffic based on an applied rule set.(Wikipedia)

By default, Ubuntu includes Uncomplicated firewall (UFW) in the package but not activated. So, in this article, I will guide you step by step configuring it;

1. Checking UFW status

# ufw status

or

# ufw status verbose


Checking raw status

# ufw show raw



2. Activating UFW

# ufw enable

But, before activating this, make sure ssh enabled. Because UFW will be enable after the machine reboot.

# ufw allow ssh



3. Stopping UFW

# ufw disable



4. Allowing

Syntax structure;

# ufw allow <port>/<optional: protocol="">



Example;

# ufw allow 22/tcp



5. Denying

# ufw deny <port>/<optional: protocol="">


Example:

# ufw deny 22/tcp



6. Deleting the rule

# ufw delete deny <port>/<optional: protocol="">


Example:

# ufw delete deny 22/tcp
# ufw delete deny 22
# ufw delete allow 22



7. Allowing by service

Example:

# ufw allow http
# ufw allow https
# ufw allow smtp
# ufw allow submision
# ufw allow imaps

Share: