Port Numbers – Exclusive Details
The transport layer uses two port numbers: the source port and the destination port. The source port numbers belong to the originating application on the local host, while the destination port numbers belong to the destination application on the remote host.
Port numbers resolve the protocol to which incoming traffic should be directed. It allows a single host with a single IP address to run different network services simultaneously. Each port number identifies a separate service, and each host can have 65535 ports per IP address. The types of ports are:-
Source Port
The originating device dynamically generates the source port numbers to identify a conversation between two devices. It allows multiple conversations to take place at the same time. It is common for a device to send multiple HTTP service requests to a web server simultaneously. Each separate HTTP conversation is tracked based on the source port numbers.
Destination Port
The host can put destination port numbers in the segment to tell the destination server about the requested service. For example, when a client specifies port 53 in the destination port, the server receives the message requesting the DNS service.
A server can offer multiple services simultaneously, such as DNS services on port 53, FTP service on port 21, and web services on port 80. The figure below illustrates the services of more than one service simultaneously.
Socket Pairs
Source and destination port numbers are placed within the segment, and then the segments are encapsulated within an IP packet. The IP packet contains the source and destination IP addresses. The combination of the source IP address and source port number, or the destination IP address and destination port number, is known as a socket. We can recognize the server and service requested by the user using a socket.
A user socket might look like this: 192.168.1.100:1220, while the port number is 1220. The socket on an FTP server might be 115.110.0.150:21. Both source and destination sockets combine to form a socket pair: for example, 192.168.1.100:1220 and 115.110.0.150:53 are a socket pair. The Figure above illustrates the connection and socket of DNS and FTP ports.
Multiple processes running on a client are made possible by sockets. Socket differentiates themselves from each other and differentiates various connections to a server process from each other—the source port number used as a return address for the requesting application. The transport layer keeps a track record of ports and the application that initiated the request so that it can be forwarded to the correct application when a reply is returned.
Port Numbers Groups
The Internet Assigned Numbers Authority (IANA) assigns various addressing standards and port numbers. Port numbers range from 0 to 65535 and are divided into three different types:-
Well-known Ports Number
Well, known port numbers start at 0 and range to 1023. These ports are reserved for service and application. Applications such as email clients, web browsers, and remote access clients use these ports. We can program well-known ports for server applications and also a client application to request a connection to that specific port and its associated service.
Registered Ports Number
The range of registered port numbers is from 1024 to 49151. The Internet Assigned Numbers Authority (IANA) assigned registered ports upon requesting the person use them with particular processes or applications. These processes are generally individual applications a user has selected to install and use rather than common applications that would receive a well-known port number.
Dynamic or Private Ports Numbers
The range of dynamic or private port numbers is from 49152 to 65535. The dynamic or private ports are also known as ephemeral ports. The ephemeral ports are generally assigned dynamically to the client’s operating system when a connection to a service is initiated.
We can use dynamic ports to identify the client’s application during communication. Some client operating systems also use registered port numbers as an alternative to dynamic port numbers for assigning source ports.