Computer generated processes require unique address to send and receive information. Port numbers are used for that purpose.
Process socket is a combination of host IP and process port number. Easy example is the Telnet service that is using port 23 by default. Knowing host IP address (for example 12.34.45.56) the socket address can be created (12.34.45.56:23). Even though Telnet’s default port is 23, it can differ if the network administrator decides to reconfigure default value. Port number is written after the IP address and is separated by the colon. System would recognise it as a port pointer, and would not consider it as additional octet of the IP. The main purpose of the ports, is creation of the virtual connection between two same processes on different machines.
TCP/IP communication simplifies with the help of ports use. Port numbers can represent different applications, but system ensures there would be no error or mistake.
Defined processes like Telnet are recognised by the machines automatically. If Computer is requesting IP with port 23, the reply would already contain all the information necessary for beginning of the Telnet session. The example of such connection establishment is shown in Figure 1.
Figure 1. A virtual connection for the Telnet service.
There are three ranges of ports. Each range is created for some specific purpose. First range is between 0 and 1023. Those ports are used by operating system, default applications and services, and network administrators. These ports are called Well Known Ports, and users have no access to them. TCP/IP protocols use them for TCP, UDP, Telnet, and FTP. Most used protocols are shown in Table 1.
Table 1. Commonly used TCP/IP port numbers.
Port number
Process name
Protocol used
Description
20
FTP-DATA
TCP
File transfer-data
21
FTP
TCP
File transfer-control
22
SSH
TCP
Secure Shell
23
TELNET
TCP
Telnet
25
SMTP
TCP
Simple Mail Transfer Protocol
53
DNS
TCP and UDP
Domain Name System
67 and 68
DHCPv4
UDP
Dynamic Host Configuration Protocol
69
TFTP
UDP
Trivial File Transfer Protocol
80
HTTP
TCP and UDP
Hypertext Transfer Protocol
110
POP3
TCP
Post Office Protocol 3
123
NTP
TCP
Network Time Protocol
143
IMAP
TCP
Internet Message Access Protocol
443
HTTPS
TCP
Secure HTTP
546 and 547
DHCPv6
UDP
Dynamic Host Configuration Protocol
3389
RDP
TCP
Remote Desktop Protocol
Next range of ports is between 1024 and 49151. These ports are called Registered Ports. They can be used by network users and/or applications with no administrative privileges. Some of the ports in this range can become default ports for some process or application. In this scenario, port should be registered with IANA (Internet Assigned Numbers Authority).
Last range of ports is called Dynamic/Private ports. The range bounds are 49152 and 65535. Range ports can be used with no restrictions.
Locally, port numbers and their services are stored in the text file. File can be accessed and modified by the administrator – the default values can be changed. It can be done for security purposes, to confuse the people who intent to access restricted data. Standard ports are not recommended to change, since it might create troubles in service communications.