Open In App

What is Network Port?

Last Updated : 02 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

In today’s technological age, data stands out as a crucial asset, and to make regular advancements, we need to share data among ourselves. We can share data in two ways either using wired connections or the internet.

In wired connections, we use connectors called physical ports for the transfer of data, power, and signals from one device to another. Example – HDMI, USB, etc.

Physical Ports

Physical Ports

In the internet, communication among devices relies on a structured system called network ports.

Network ports are virtual endpoints that bridge data transmission among multiple applications, services, or devices within a network. It is a logical connection that is established between multiple devices to transfer and exchange data among them. These ports ensures the smooth flow of information and make sure that data reaches its destined address.

In a practical sense, when we interact with various online services like browsing, streaming, or downloading, network ports are working in the background. It manages the data traffic and ensures to make every process works independently and efficiently.

Each network port will have a unique number that differentiates it from others. This unique number is known as the port number.

Network Ports

Network Ports

Categories of Ports

Port numbers range from 0 – 65535 and these are assigned by an organization called IANA (Internet Assigned Numbers Authority). These 65,535 port numbers are broken down into the following three categories:-

1. System Ports

Port numbers from 0 – 1023 are called systems or well-known ports. These are common ports that most people use every day. Some of them are:

  • 80(HTTP)
  • 443(HTTPS)
  • 25(SMTP)
  • 21(FTP)

2. Registered Ports

Port numbers from 1024 – 49151 are called user or registered ports. These are ports that can be registered and accessed by companies and developers for any particular service. Some of them are:

  • 1102(Adobe Server)
  • 1433(Microsoft SQL Server)
  • 1416(Novell)
  • 1527(Oracle)

3. Dynamic Ports

Port numbers from 49152 – 65535 are called dynamic or private ports. These are client-side ports that are free to use. Computers generally use it for local addresses temporarily during a session with the server, for example when viewing a web page.

Out of these three categories, the well-known and registered port numbers are used on a server. In other words, these are used on a server that our computer connects to whereas our computer uses the dynamic or private port numbers on the client side. So whenever our computer wants to use a service on another server, it assigns itself one of these port numbers.

Functioning Of Ports

A port always functions along with an IP address. An IP address is a numeric address that acts as an identifier for a computer or a device on a network. For communication purposes, each device needs to have an IP address. An IP address and a port number work in sync to exchange data on a network.

Let’s say we want to connect to a network over the internet the IP address will be used for determining the geographical location of the server such as continent, country, city and so on whereas a port number determines what kind of service it wants to access either by pulling up a web page or accessing an FTP service.

Now in simple terms, what does this all mean?

So as an example, let’s take a very common port that just about everyone uses every day and that is port number 80. Port 80 is associated with HTTP which are web pages so whenever we visit a web page from our computer, we’re using port 80.

Functioning of ports

Functioning of ports

Let’s say we want to visit Google’s web page so we will open up a web browser and type google.com in the address bar but before it pops up on our screen, there are some intermediary steps behind the scenes. First of all, it needs to convert the domain name of google.com into Google’s IP address (215.114.85.17), and in addition, add port number 80 to the IP address since we are using a web browser that is using HTTP, to complete the foreign address(address of the server – 215.114.85.117:80). This foreign address is going to be used to locate Google’s web server.

Once we locate the server, the IP address part of the foreign address loses its significance and the port will come into play. Now Google’s web server will see the incoming request with port number 80 and will forward that request to its built-in web service and you will eventually retrieve Google’s web page.

Practical Application of Ports

As all of this activity is happening behind the scenes, we weren’t able to see how the IP address and port numbers were used. To cure this problem, we need to learn about Netstat utility.

Netstat stands for network statistics and it’s a command line tool that is used to display the current network connections and port activity on our computer. We can use Netstat on various operating systems, but in this example, we are going to be working on a Windows computer.

In the command prompt, we type in netstat and then we’re going to use a -n subcommand that enables us to see various information including the port number of the local device and server.

Command Prompt

Command Prompt

In the above output image, we can see our active connection.

Here, the local address is our computer’s IP address attached to the port number that our computer has assigned itself for this session. The foreign address is the server’s IP address (google.com) along with port number 80 that’s being used for this connection because as we mentioned before, port 80 is used for web pages.

Eventually, we want to run other services on the same server so let’s try to run the FTP service. FTP is a standard protocol that is used to transfer files between computers and servers over a network and it uses port number 21. To run the FTP service, we should open a web browser and type in ftp.google.com and then we’ll run the same subcommand (-n) again.

imresizer-1701538459397

Command Prompt

The domain name of google.com will be converted into Google’s IP address(215.114.85.17) and since we’re using FTP, our computer will add port 21 to the IP address and once Google’s server sees the incoming request with port number 21, it’ll forward that request to its built-in FTP service and it’ll show a connection to Google’s FTP service using port number 21.

FAQs on Network Ports

1. Can our local device acquire well-known ports?

Yes, we can acquire well-known ports on our local device because these ports are used on a server, however, servers aren’t just large and powerful computers. Server is a role that is fulfilled by a device, no matter its specifications. Our computer can also act as a server for other computers to connect to. If we run netstat with a -an subcommand, we might see port 21 or port 80 that are either listening or have an established connection.

imresizer-1701539962098

For example, if we will be running an FTP service or running a website on our computer we’re going to see port 21 and port 80 that are either listening or have an established connection because we can configure your computer to act as a server that accepts incoming connections.

2. What are some important Netstat commands?

Here are the most common:

netstat -a : Displays all active connections and the TCP and UDP ports on which the computer is listening.

netstat -b : Displays the binary (executable) program’s name involved in creating each connection or listening port.

netstat -e : Displays ethernet statistics, such as the number of bytes and packets sent and received.

netstat -f : Displays fully qualified domain names for foreign addresses (only available on Windows Vista and newer operating systems).

netstat -i : Displays network interfaces and their statistics.

netstat -m : Displays the memory statistics for the networking code (STREAMS statistics on Solaris).

netstat -n : Displays active TCP connections, however, addresses and port numbers are expressed numerically and no attempt is made to determine names.

netstat -o : Displays active TCP connections and includes the process id (PID) for each connection.

3. What is a server?

Server is basically a dedicated computer that provides services on behalf of clients, such as ordinary desktop computers or workstations. So it’s a centralized machine where multiple clients connect to, either over the Internet or in a local area network, and they connect to a server for a specific service.

Now when people talk about a server generally they are referring to a powerful centralized computer that clients connect to over a network, and they would be correct on that. However a server is not just a physical computer. A server is actually a role that a computer takes. Because any ordinary desktop computer can be set up as a server and it doesn’t necessarily have to be a powerful computer.

4. Can you explain port forwarding?

Port forwarding is a networking technique where incoming network traffic destined for a particular port is redirected to another device or port. It is commonly used to enable external access to services hosted on private networks, such as forwarding external web traffic to an internal web serve.

5. What is Full Form of IANA?

IANA stands for Internet Assigned Numbers Authority and works on globally coordinating IP address, ports, etc



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads