Latest

CCNA: TCP SEQ and Port Number

CCNA: TCP Sequence & Port Number

This article can be read as the second part of the previous article “CCNA: 3-Way Handshake” where we discussed what makes TCP a reliable protocol for transmitting information. Let’s discuss the TCP SEQ and Port numbers in this article.

TCP SEQ Number

Let’s say TCP has been assigned a task to transmit a large file that TCP cannot transfer at once. To make this happen, TCP breaks this large file into smaller chunks and assigns a number that is called the Sequence number.  For instance, HTTP application handover “CCNA” to transmit from PC-1 to PC-2. TCP breaks this information into two pieces “CC” and “NA”.

PC-1 assign sequence number 1 to “CC” and sequence number 2 to “NA” data. It sends the first chunk with sequence number 1 to PC-2.

PC-2 receives the information and sends the ACK with number 2. By sending the ACK number 2 PC-2 confirms that it has received the information with SEQ 1, please send the next chunk of information with sequence number 2.

PC-1 now sends the last piece of information “NA” with sequence number 2 as requested by PC-2. PC-2 gets this information and acknowledges PC-1 with Acknowledgement number 3. PC-2 combines the received information into single file and sends it to the application.

TCP Port Number

In a multi-processing environment, there can be multiple applications running on the system. These applications are identified using the port numbers. Port number ensures that relevant application should receive the data for processing.

For example, HTTP uses standard port number 80 and FTP uses standard port number 20. PC-1 sends the data using the standard port number as the destination port during the 3-way handshake process.

When PC-1 receive data from FTP to transmit it sets the destination port number 20 in TCP header. PC-1 uses the port 1026 as a source port number. When PC-1 gets the response from PC-2 for FTP application, it sees the destination port number is 1026 and hands it over to FTP.

This way port number ensures the packets are handed over to correct application. Port Numbers range from 1 to 65535. Well known port number range from 1 to 1024 that are assigned to known applications. Port range 1025 to 65535 are randomly used by the host to be used as source port number.

Hope you find this informative!

 Continue Reading...