How to Open a Port on Ubuntu 20.04

Ubuntu, which is based on Debian’s design, provides multiple utilities, one of which allows it to open closed ports. Ports allow communication between devices. To perform their tasks, internet-facing services and applications generally listen for ports to connect from the outside. Communication between hosts via the internet is impossible without ports. Some ports are closed by default, and some are closed using a firewall. This article is about opening the ports on Ubuntu systems.

Sponsored

A virtual point where a network connection begins, and stops is referred to as a port. The operating systems of computers manage ports, which are software-based. Each port is linked to a particular operation or service. Both TCP and UDP networks consist of ports. Some of the common ports are HTTP, FTP, SSSH, and so on.

How to Open a Port on Ubuntu

There are multiple ports on the system. Generally, we use the ufw command to open the ports. Ufw comes preinstalled with the latest Ubuntu versions. UFW, abbreviated as Uncomplicated Firewall, is used to set up a tool based on iptables that comes standard with Ubuntu editions.

Furthermore, we will explain how to open some of the ports as mentioned below.

  • Open port 22 on Ubuntu
  • Open port 80 on Ubuntu
  • Open port 443 on Ubuntu
  • Open port 53 on Ubuntu

Before opening the ports, check which ports are open or closed using the mentioned below command.

$ sudo ufw status verbose

Firstly, enable the firewall by the below-mentioned command:

$ sudo ufw enable

How to Open Port 22 on Ubuntu

Port 22 offers remote management access to the VM and is used for Secure Shell (SSH) communication. Password verification is used to secure traffic in general. Run the mentioned command below to accept the TCP packets incoming to port 22.

$ sudo ufw allow 22/tcp

Run the command mentioned below to verify that the port is open.

$ sudo ufw status verbose

How to Open Port 80 on Ubuntu

Port # 80 is allocated to the Hypertext Transfer Protocol, a widely used internet-based communication protocol (HTTP). It’s the port via which a computer can send and receive Web-client-based communication and messages from a Web server, and it’s also where HTML pages and data are sent and received.

Sponsored

Run the mentioned below command to allow the HTTP port:

$ sudo ufw allow 80/tcp

Run the command mentioned below to verify that the port is open.

$ sudo ufw status verbose

How to Open Port 443 on Ubuntu

Computers utilize port as a virtual port to deflect network traffic. It is used by billions of humans every day across the world. Your computer can connect to a server that hosts the information and retrieves it for you whenever you conduct an online search. This connection is established over a port that is either HTTPS or HTTP.

Run the mentioned below command to allow the HTTPS port:

$ sudo ufw allow 443/tcp

Run the command mentioned below to verify that the port is open.

$ sudo ufw status verbose

How to Open Port 53 on Ubuntu

TCP Port# 53 is used by the DNS for zone transfer and to keep the DNS databases and servers in sync. When the client requests a DNS server, it uses the UDP protocol. The TCP protocol shouldn’t be utilized for inquiries since it provides attackers with a lot of information.

Run the mentioned command below to accept the TCP/UDP packets incoming on port 22.

$ sudo ufw allow 53

Run the command mentioned below to verify that the port is open.

$ sudo ufw status verbose

Conclusion

A port is a virtually numerical address that TCP and UDP protocols employ as a communication destination. Network ports route traffic to the appropriate destinations. Some ports are open by default, and some need to be opened. In the article, we discuss how to open ports on Ubuntu with some examples like opening port 22, port 80, port 443, and port 53 using the ufw command.

Ubuntu Server Admin

Recent Posts

How to Install Google Cloud BigQuery Python client library on Linux

In this article, we will see how to Install Google Cloud BigQuery Python client library…

2 days ago

Wallpaper Contest for Xfce 4.20 open for voting

Nov 15,2024 Wallpaper Contest for Xfce 4.20 open for voting The submission phase for the…

2 days ago

Canonical announces the first MicroCloud LTS release

MicroCloud 2.1.0 LTS is now available, expanding the number of Canonical infrastructure solutions with a…

3 days ago

Join Canonical in Paris at Dell Technologies Forum

Canonical is thrilled to be joining forces with Dell Technologies at the upcoming Dell Technologies…

4 days ago

Bringing automation to open source 5G software at Ubuntu Summit 2024

In today’s massive private mobile network (PMN) market, one of the most common approaches to…

5 days ago

Ubuntu Weekly Newsletter Issue 865

Welcome to the Ubuntu Weekly Newsletter, Issue 865 for the week of November 3 –…

7 days ago