Computers & ProgrammingBasic NetworkingComputers & Networking

TCP/IP Port Numbers

In computer networking, a port is a communications socket/endpoint in a computer’s operating system. A port is associated with an IP address of the host, as well as the type of protocol used for communication. A port in conjunction with the IP address is known as a socket or endpoint.

The Transport Layer protocols, such as the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP), are the primary users of TCP/IP ports. The sockets created by each host that is used in the communication session are known as socket pairs or endpoint pairs.

These sockets or endpoints allow hosts to create more than one session to allow for multiple communication channels to be active at any given time between various hosts.

Port Ranges

There are clearly defined port numbers for every popular or well-known TCP/IP application. A port number is a 16-bit value between 0 and 65,535. Within this range of ports, some port numbers are established for specific services, some are reserved for certain applications, and others are available for temporary use by applications.

Web servers, for example, use port number 80 because client browsers are developed to connect to web servers using the HTTP protocol on port 80. Port numbers from 0 to 1023 are called well-known ports and are reserved for specific TCP/IP application services. The range of port numbers from 1024 to 49151 are the Registered, also known as User ports.

These ports are assigned by IANA for specific services upon application by a requesting entity. The range from 49152 to 65535 are above the registered ports. This range is reserved for the Dynamic and/or Private ports that cannot be registered with IANA. This range is used for custom or temporary purposes and for automatic allocation of ephemeral ports.

Well-Known Ports

The port numbers in the range from 0 to 1023 are the well-known, also known as System ports. They are used by system processes that provide widely-used types of network services. Examples of some of the most common
well-known ports are:

Port Service Protocol Description
20 ftp tcp/udp/sctp File Transfer Data
21 ftp tcp/udp/sctp File Transfer Control
22 ssh tcp/udp/sctp Secure Shell
23 telnet tcp/udp Telnet
25 smtp tcp/udp Simple Mail Transfer
42 name tcp/udp Name Server (WINS)
67 bootps udp Bootstrap (BOOTP/DHCP) Server
68 bootpc udp Bootstrap (BOOTP/DHCP) Client
69 tftp udp Trivial File Transfer
80 http tcp Hypertext Transfer Protocol
88 kerberos tcp Kerberos
110 pop3 tcp Post Office Protocol v3
119 nntp tcp Network News Transfer Protocol
123 ntp udp Network Time Protocol
135 epmap tcp/udp DCE Endpoint Mapper/RPC
137 netbios-ns tcp/udp NETBIOS Name Service
138 netbios-dgm tcp/udp NETBIOS Datagram Service
139 netbios-ssn tcp/udp NETBIOS Session Service
143 imap tcp/udp Internet Message Access Protocol
161 snmp udp Simple Network Management Protocol
162 snmptrap tcp/udp Simple Network Management Protocol Trap
443 https tcp Internet Message Access Protocol
445 microsoft-ds tcp SMB File Sharing

If we take the example of a host system trying to access a web server, the source system will craft a packet to send to the destination IP address on port 80. Since port 80 is a well-known port for HTTP, in most cases, if you wanted to host a web server, you would not change the web server’s default port.

If you did configure the web server to run on a different port, you would have to communicate this information to your users since the client applications that they are using (web browsers) are expecting to connect to the web server on port 80.

In this scenario, the client that established this connection with the web server will use a port in the Private/Dynamic range. For example, the source IP:source port may be for the client. When the web server sends back a packet to the client it will send it back to this IP and port (socket/endpoint).

For more information about port numbers or to get a complete listing of reserved and registered ports, please visit the Service Name and Transport Protocol Port Number Registry.

Leave a Comment

Your email address will not be published.

Scroll to Top