Categories: TutorialsUbuntu

UFW Allow Port

You must have heard numerous times that a Firewall acts as the first line of defense against external threats and attacks. Now, we would like to discuss what it really means. It means that a Firewall prevents any unauthorized entity from creeping into your network. However, you can create Firewall rules to allow the access of the authorized entities to your network. This can be done by opening certain trusted ports. Therefore, in this article, we will teach you the method of allowing a UFW port.

Examples of Allowing a Port on UFW

To learn how you can allow a port on UFW, you can go through the following examples:

Example
Sponsored
# 1: Allowing a Port on Both TCP and UDP

In this example, we will allow a port on UFW irrespective of the protocol, i.e., this port will be allowed both on TCP and UDP. For that, we have used the following command:

$ sudo ufw allow 53

This command will allow the opening of the port “53” on both TCP and UDP, as shown in the following image:

Sponsored

Example # 2: Allowing a Port on a Specific Protocol

In this example, we will be allowing a port on a specific protocol like TCP. For that, we have used the following command:

$ sudo ufw allow 80/tcp

This command will open port “80” only for TCP, as shown in the following image:

Conclusion

With this quick tutorial, we wanted to enlighten you on the procedure of allowing a UFW port. Here, we have shared two different examples with you, wherein we have shared the methods of opening a port on both protocols, i.e., TCP and UDP, and opening a port on a specific protocol. Therefore, you can conveniently allow the opening of whichever ports you prefer using the Ubuntu Firewall.

Ubuntu Server Admin

Recent Posts

Kolla Ansible OpenStack Installation (Ubuntu 24.04)

Kolla Ansible provides production-ready containers (here, Docker) and deployment tools for operating OpenStack clouds. This…

26 minutes ago

Canonical announces first Ubuntu Desktop image for Qualcomm Dragonwing™ Platform with Ubuntu 24.04

This public beta enables the full Ubuntu Desktop experience on the Qualcomm Dragonwing™ QCS6490 and…

23 hours ago

The long march towards delivering CRA compliance

Time is running out to be in full compliance with the EU Cyber Resilience Act,…

23 hours ago

Extra Factor Authentication: how to create zero trust IAM with third-party IdPs

Identity management is vitally important in cybersecurity. Every time someone tries to access your networks,…

2 days ago

Ubuntu Weekly Newsletter Issue 889

Welcome to the Ubuntu Weekly Newsletter, Issue 889 for the week of April 20 –…

4 days ago

From pidfd to Shimanami Kaido: My RubyKaigi 2025 Experience

Introduction I just returned from RubyKaigi 2025, which ran from April 16th to 18th at…

4 days ago