How to Allow or Deny Ubuntu Firewall Port?
A firewall is a network security device that keeps an eye on all incoming and outgoing traffic. Data packets are allowed or blocked according to pre-established security criteria.
Comprehending firewall configuration is essential if you are managing a production system. Because incoming and outgoing traffic is tightly filtered in accordance with security regulations, systems protected by firewalls are less vulnerable to infection by malicious content.
What is UFW?
Known also as the Uncomplicated Firewall, UFW is a front-end framework that offers a straightforward interface for managing netfilter; the built-in packet filtering system in the Linux kernel, through the iptables software. It’s an integrated firewall system for Ubuntu that makes complex iptables commands easier to understand and facilitates the creation of simple firewall setups.
UFW has a few basic commands in its command-line interface. Along with many other capabilities, it supports logging, many network protocols, and all of the fundamental firewall rules. The official UFW documentation has a detailed list of features that you can review.
How to Allow or Deny Ubuntu Firewall Port?
Allowing or denying ubuntu firewall port is an extremely easy task which you can do by following the steps mentioned below.
Step # 1; Check Status of your Firewall
First of all, check the status of your firewall. For this type ‘sudo ufw status’.
sudo ufw status
This will show the status of your firewall. In case, your firewall is not active, you can type ‘sudo ufw enable’ to enable your firewall.
sudo ufw enable
Step # 2; Allow Traffic at a Specific Port
You can allow traffic at any specific port. For example, if you want to allow traffic at port 80 through any IP address, type ‘sudo ufw allow 80’. With this a rule will be added to all IP address.
sudo ufw allow 80
Step # 3; Deny Traffic at a Specific Port
You can also deny traffic at any specific port. For example, to deny traffic at port 1000 type ‘sudo ufw deny 1000’. A rule will be added to all IP address.
sudo ufw deny 1000
Step # 4; Allow or Deny Traffic at any Specific Port through an IP Address
You can also allow or deny traffic at any specific port through an IP address. For example, if your IP address is 3.3.3.3 and you want to allow traffic through port 22, type ‘sudo ufw allow from 3.3.3.3 to any port 22’. A rule will be added.
sudo ufw allow from 3.3.3.3 to any port 22
How to see all the active rules?
To see all the active rules, type ‘sudo ufw status numbered’. It will show the status of all the active rules in the system along with their number in the first column.
sudo ufw status numbered
How to reset all active rules?
You can also reset all the active rules. This can be done by typing ‘sudo ufw reset’. This will rest all the active rules.
sudo ufw reset
We hope you found this article helpful, make sure to comment down below or contact us if you face any issues. Thanks!