Network Ports

How data finds its way once home

A port refers to a logical connection point that allows a computer or device to send and receive data across a network.

Different types of activities on your computer, like web browsing, email or file transfer use different ports to send and receive data. Ports help organize and manage the flow of information between devices on a network. They ensure messages and data reach the right destination on a computer.

💡
Each port is identified by a unique number, ranging from 0 to 65,535.

Common port numbers

Port NumberProtocol NameDescription
80HTTP (Hypertext Transfer Protocol)Regular web browsing
443HTTPS (Hypertext Transfer Protocol Secure)encrypted web browsing
25SMTP (Simple Mail Transfer Protocol)send emails
110POP3 (Post Office Protocol v3)retrieve emails from mail server
21FTP (File Transfer Protocol)transfer files between computers
22SSH (Secure Shell protocol)Secure remote access and control of a computer
53DNS (Domain name system protocol)Translate domain names to IP addresses
💡
IANA (Internet Assigned Numbers Authority) maintains the official registry of port numbers. They update and maintain the port number registry to reflect changes in assignments. Organizations or developers can request port numbers from IANA for new protocols or services.

Types of ports

A. System Ports aka Well known ports

  • System ports are port numbers in the range from 0 to 1023.

  • System ports are associated with essential network services and are used by system-level processes and privileged applications.

B. Registered ports aka user ports

  • Registered ports are in the range from 1024 to 49151.

  • These ports are also managed by the IANA.

  • They are available for use by user-level applications and services.

C. Dynamic aka private ports

  • Dynamic ports are in the range from 49152 to 65535.

  • This is used by the system itself and allows multiple client applications on the same system to establish connections to different servers simultaneously without port conflicts.

Role of IP address

  • Combination of IP and port number ensures that data packets are delivered to the correct application running on the destination device.

  • IP addresses get the data to the right device, and port numbers get the data to the right application on that device.

Netstat

A command-line tool that gives you information about your computer's network connections.

It answers the following questions

  1. What connections your computer has with other computers?

  2. Which programs on your computer are using the network?

  3. Which route should the data packets take to reach their destination?

Firewalls and ports

  • Firewalls often use port numbers as criteria for filtering network traffic. They can be configured to allow or block traffic based on the ports being used.

  • Firewalls can restrict access to specific ports based on security policies.

  • But firewalls can also perform deep packet inspection and application layer filtering, allowing them to inspect the contents of network packets and not just check the port numbers.

Overall, ports play a fundamental role in enabling the exchange of data and services across networks. They basically act like entry points, letting different types of data in and out of devices.