QueHow

A How-To and wiki Blog

  • Operating System
    • Windows
      • Windows 10
      • Windows 7
    • Linux
  • Software
    • Application Software
    • Microsoft Office
      • Outlook
      • Word
      • PowerPoint
  • Internet
    • Browsers
      • Mozilla Firefox
      • Google Chrome
    • CMS
    • Tips & Tricks
  • Website
    • ecommerce
    • Google
    • Social Networking
    • General Websites
  • Mobile
  • Email
    • Gmail
  • Wiki

How to Enable and Disable Firewall in Ubuntu

By Neha T Leave a Comment

Are you searching to enable / disable firewall in Ubuntu? You are at the right place…Ubuntu has a firewall that protects the system from the potential threats such as various malware, but the mechanism to implement it in Ubuntu is quite different than Windows.

Just recall what is a Firewall and why it is needed? Firewall is basically a system built to prevent the system from an unauthorized access. In short, the Firewall has all the information about incoming and outgoing connections. It can approve or disapprove the traffic to or from the network based on the security rules. You can create exceptions or rules in terms of Ubuntu, so as to allow some desired network.

If we talk about Ubuntu, Netfilter is the one responsible for network related procedures. It is a framework designed for Linux system which provides options such as network address translation, port translation, etc. That means to deal with network related issue you must know how to handle netfilter, for that you have to play with iptables.

Iptables provides the full fledged solution for the firewall which is a highly complex task to do. Iptables runs at console only, this is one of the major disadvantage for the newbie to learn it easily. That’s why frontends are made in order to manage the firewall easily. One of them is Uncomplicated Firewall which is available by default,  to enable the firewall in the Linux system.

Here’s come the Uncomplicated Firewall (ufw) which is launched for the purpose of easily handling the firewall operations. It’s a front end for iptables, through this it is much easier to enable the firewall. UFW is a very user friendly interface. It’s graphical mode is also available, termed as GUI for Uncomplicated Firewall (Gufw). You can download it from the Software center in Ubuntu, if you use graphical user interface.

In this tutorial, I had covered the command line ufw. Each and every command associated with its use,is mentioned here. You just need to go through the tutorial sincerely to know about how to enable and disable firewall in Ubuntu.

Steps to Enable and Disable Firewall in Ubuntu

Step 1: It is very important to check that whether the firewall is enabled or disabled. But, by default the firewall is already disabled in all the versions of Ubuntu . It is up to you to switch it on or off.

For an instance, suppose you don’t know about this, then you can check it using the command: “sudo ufw status” (if you are not a root user), otherwise there is no need to put “sudo”.

How-to-enable-and-disable-firewall-in-Ubuntu-step1

Step 2: Now, once you press enter after writing the command, you”ll be asked to enter the sudo password i.e. your user password. Type the password and press enter.

As you can see in the figure, password is not shown even in “*” form due to the fact that Ubuntu counts keystrokes only. Here, you can also notice the firewall is “inactive”.

How-to-enable-and-disable-firewall-in-Ubuntu-step2

Step 3: It’s time to show you how to enable it, for that the command is: “sudo ufw enable” and then press enter.

How-to-enable-and-disable-firewall-in-Ubuntu-step3

Step 4: If you have followed the steps properly, then you”ll see the message “Firewall is enabled now…” as shown below.

How-to-enable-and-disable-firewall-in-Ubuntu-step4

Step 5: At times, you may need to permit any one IP address and unblock it so that it may bypass through the firewall. Then you have to use the command: “sudo ufw allow from ipaddress” wherein the ipaddress should be mentioned of the respective network from which you need to allow the traffic to your network.

For an example: “sudo ufw allow from 192.168.167.67”

How-to-enable-and-disable-firewall-in-Ubuntu-step5

Step 6: After writing the above command, press enter button. Here, I got the confirmation as “Rule added”. That means the exceptional case is saved in the firewall settings to allow the incoming traffic.

How-to-enable-and-disable-firewall-in-Ubuntu-step6

Step 7: Unsure about whether the rule is added to the firewall data or not then you must try again “sudo ufw status”. As a result, you will see now the firewall is “active” and the rules are mentioned below it.

How-to-enable-and-disable-firewall-in-Ubuntu-step7

Step 8: In case you are required to disallow any IP address that you have added in the Firewall. Considering the above IP address which I have added, now I will delete it. Just type “sudo ufw deny from 192.168.167.67” and press enter.

How-to-enable-and-disable-firewall-in-Ubuntu-step8

Step 9: You will get the message as “Rule updated”.

How-to-enable-and-disable-firewall-in-Ubuntu-step9

Step 10: Suppose you are required to disable the firewall for some time, then type “sudo ufw disable” and press enter.

How-to-enable-and-disable-firewall-in-Ubuntu-step10

Step 11: Then you have to provide the password i.e. user password. Once you complete this,  “firewall is disabled..” message will appear.

How-to-enable-and-disable-firewall-in-Ubuntu-step11

Some other commands:

sudo ufw allow from <ipaddress> to port <portnumber> : This command can be used to allow specific IP address and port. In place of ipaddress and portnumber you have to mention the valid data.

sudo ufw allow from <ipaddress range> to any port <port number> : This command will let you to allow a range of IP addresses and the specified port to add to firewall rules, so that the firewall would not restrict these addresses and the port.

For an example: sudo ufw allow from 192.0.0.0/ 24 to any port 80, here the last digit i.e. 0 to 24 is the subnet. It’s basically a logical division of the IP Network.

NOTE: Above two commands can be used to deny the connection with a specific IP address and port using the keyword “deny” in place of “allow” and the rest of the things will be similar.

You Might Also Like:

how-to-disable-or-enable-guest-user-account-in-ubuntuHow you can Disable & Enable Guest User Account in Ubuntu How to easily Enable Root User in Ubuntu how-to-enable-and-configure-bluetooth-in-ubuntuHow to Enable and Configure Bluetooth in Ubuntu how-to-install-and-configure-ssh-in-ubuntuHow to Install and Configure SSH (Secure SHell) in Ubuntu how-to-use-and-install-telnet-in-ubuntuHow to Install and Use TELNET in Ubuntu How to Enable / Disable Regedit in Windows 7 how-to-use-sed-command-in-ubuntuHow to Use SED Command in Ubuntu how-to-install-mysql-in-ubuntu-using-terminalHow to Install MySQL in Ubuntu using Terminal

Leave a Reply Cancel reply

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

Most Viewed

  • How to Install and Use TELNET in Ubuntu
  • How to install Hindi fonts in MS Word
  • How to Change a File Extension in Windows 10?
  • How to create a flipkart account in 3 simple steps
  • How to Change Monitor Refresh Rate in Windows 10?
  • How to install IIS on Windows 10
  • How to Insert Clickable Checkbox in MS Word 2016?
  • How to Set Auto Reply in Outlook 2016?
  • How to Login as Administrator in Windows 10?
  • How to Check RAM Size and System Type in Windows 10?

Recent Additions

  • How to Add Hyperlink to Another Sheet in Excel?
  • How to Add and Remove Watermark in Excel
  • How to use Relative and Absolute Cell Reference in Excel?
  • How to Enable and Disable Scroll Lock in Excel?
  • How to Use INDEX and MATCH Functions in Excel?
  • How to Make Bar Graph in Excel?
  • How to Count Duplicate Values in Excel?
  • How to Wrap Text in Excel?
  • How to Round off Numbers in Excel?
  • How to Create a Bell Curve in Excel?

Related Searches

  • How to Slow Motion a Video in PowerDirector?
  • How to Add a Bookmark in Safari on iPhone?
  • How to Download and Install Java in Windows 10?
  • How to Live on Instagram?
  • Install MS Office 2010 Without Removing 2007,2003

Copyright © 2023 · QueHow · Contact Us