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:

20ftptcp/udp/sctpFile Transfer Data
21ftptcp/udp/sctpFile Transfer Control
22sshtcp/udp/sctpSecure Shell
25smtptcp/udpSimple Mail Transfer
42nametcp/udpName Server (WINS)
67bootpsudpBootstrap (BOOTP/DHCP) Server
68bootpcudpBootstrap (BOOTP/DHCP) Client
69tftpudpTrivial File Transfer
80httptcpHypertext Transfer Protocol
110pop3tcpPost Office Protocol v3
119nntptcpNetwork News Transfer Protocol
123ntpudpNetwork Time Protocol
135epmaptcp/udpDCE Endpoint Mapper/RPC
137netbios-nstcp/udpNETBIOS Name Service
138netbios-dgmtcp/udpNETBIOS Datagram Service
139netbios-ssntcp/udpNETBIOS Session Service
143imaptcp/udpInternet Message Access Protocol
161snmpudpSimple Network Management Protocol
162snmptraptcp/udpSimple Network Management Protocol Trap
443httpstcpInternet Message Access Protocol
445microsoft-dstcpSMB 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. Required fields are marked *

Scroll to Top