Ubuntu has a built-in tool for firewall configuration which is known as UFW – uncomplicated firewall. This tool is front end to manage rules of an iptables firewall and enable handling of rules in an easier manner as its name suggests ‘Uncomplicated’. Sometimes there is a need however to keep the firewall in disabled state.
In today’s blog we will cover how to enable or disable Ubuntu firewall, GUI and CLI based command to disable Ubuntu firewall
Enable/Disable Firewall on Ubuntu
Ubuntu is a very well-known Linux operating system flavour having its own firewall called as uncomplicated firewall or UFW. In Ubuntu we can both enable or disable the firewall according to our requirements. It is advised to keep the firewall turned on, but in some situations like troubleshooting or testing or bug fixing you might require to disable the firewall.
Firewall is an operating system security component which observes and maintains network traffic based on a predefined set of rules. It also assists in monitoring the networks for trusted or untrusted status.
There are two ways in which you can disable the Ubuntu firewall but before that we will look at the command to check its status whether it is enabled or disabled. For that, having Sudo permissions is a pre-requisite.
Managing Firewall through Command line
To check firewall status type below command:
$ sudo ufw status
By default, firewall status will be inactive
$sudo ufw status verbose
If output is required in verbose then add verbose in the last.
Enable Ubuntu firewall
To enable Ubuntu firewall use below command in terminal.
$sudo ufw enable
Firewall is active and enabled on system start-up.
Now, firewall is active to check its status type.
$sudo ufw firewall
Managing Firewall through GUI
To manage UFW we require to install ‘gufw’ in the system. To install gufw below command is given
@sudo apt install gufw
After getting the GUI installed in same terminal when you type ‘gufw’ then firewall application will launch or you can initiate it from Start menu.
Open the application and provide authentication details.
Post login default screen will appear.
Check Status column.
You can turn it off or disabled mode.
- What is UFW, and why is it used in Ubuntu?
UFW, which stands for Uncomplicated Firewall, is a user-friendly command-line tool for managing iptables, the default firewall management tool in Ubuntu. UFW simplifies the process of configuring a firewall on Ubuntu systems.
- How do I check if UFW is installed on my Ubuntu system?
You can check if UFW is installed by running the following command:
sudo ufw status
- How do I install UFW on my Ubuntu system?
If UFW is not already installed, you can install it using the following command:
sudo apt-get install ufw
- How do I enable UFW?
To enable UFW, use the following command:
sudo ufw enable
- How do I disable UFW?
To disable UFW, use this command:
sudo ufw disable
- How do I allow incoming traffic for a specific port with UFW?
To allow incoming traffic on a specific port, use this command (replace PORT with the desired port number):
sudo ufw allow PORT/tcp
- How do I allow traffic from a specific IP address with UFW?
To allow traffic from a specific IP address, use this command (replace IP_ADDRESS with the actual IP address):
sudo ufw allow from IP_ADDRESS
- How do I deny incoming traffic for a specific port with UFW?
To deny incoming traffic on a specific port, use this command (replace PORT with the desired port number):
sudo ufw deny PORT/tcp
- How do I list the rules in my UFW configuration?
You can list the rules in your UFW configuration using the following command:
sudo ufw status
- How do I delete a specific UFW rule?
To delete a specific UFW rule, you can use the following command (replace RULE with the rule you want to delete):
sudo ufw delete RULE
- How do I reset UFW to its default settings?
You can reset UFW to its default settings by running the following command:
sudo ufw reset
- Is UFW the only way to manage the firewall in Ubuntu?
No, UFW is just a user-friendly front end for managing iptables. You can also configure iptables directly if you have advanced firewall management needs. However, UFW is recommended for most users due to its simplicity.
- How can I check the status of the UFW service?
To check the status of the UFW service, use the following command:
sudo ufw status
- How do I start UFW at system boot?
UFW is usually enabled to start at boot by default when you enable it. You can use the following command to ensure it starts at boot:
sudo systemctl enable ufw