How to install Ubuntu Firewall on Ubuntu
In this tutorial, we will explain How to install Ubuntu Firewall on Ubuntu.
Uncomplicated Firewall (UFW) is a program for managing a netfilter firewall designed to be easy to use. It uses a command-line interface consisting of a small number of simple commands and uses iptables for configuration. UFW is available by default in all Ubuntu installations after 8.04 LTS.
- VPS running Ubuntu
Step 1 – Install UFW
Firewall is needed for most software. To install it run the following command:
sudo apt-get install ufw
To start it run this command:
sudo ufw start
To enable it, run:
sudo ufw enable
To check the status of firewalld service:
sudo ufw status
Step 2 – Allow connections
You need to add services to ufw if you want to access any service.
sudo ufw allow http
In that command, you need to put the service name that you want to add, for example, http.
To remove any service use this command:
sudo ufw deny http
By using this command you can open any port in ufw:
sudo ufw allow 80/tcp
To remove any port, use this command:
sudo sudo ufw 80/tcp
You can change /tcp with /udp based on your needs.
Step 3 – Use UFW
To configure UFW, you need to use this command:
You have successfully installed UFW on Ubuntu.