TCP Handshake Process with Wireshark Packet Capture

 

The TCP (Transmission Control Protocol- connection oriented) handshake is a three-step process used to establish a connection between a client and a server in a TCP/IP network.

Three- Way Handshake Process:

  1. SYN (Synchronize): The client initiates the connection with the server by sending SYN Packet
  2. SYN-ACK (Synchronize-Acknowledge): The server responds with a ACK packet and sends it's own SYN packet to client
  3. ACK (Acknowledge): The client responds with ACK packet to server, resulting the connection is established
Fig: TCP 3-way Handshake Process 


Here I opened the browser and searched www.google.com, the respective TCP connection is highlighted here

SYN Packet Analysis: Packet from Client to Server. Covering major fields to be checked here. Note: All the fields here related to Client Machine

Fig: SYN packet analysis


  • Destination port: Client requesting https (443) services from the server
  • TCP Segment Length: Payload of the packet. In the all 3 -way handshake processes this field is zero, because data transfer will happen only the connection established between the parties.
  • Sequence Number: 2 types can be seen here raw and relative sequence number. both are same. Raw is a random number chosen by the system while relative sequence number is for human easy understanding placed here (raw sequence: 143724499 and relative sequence: 1)
  • Acknowledgement Number: this field corresponds to the info from the server, so until the server responds to the SYN packet this field is 0
  • Flags: this field will show the current Handshake Process in the Packet
SYN-ACK Packet Analysis: Packet from Server to Client. Covering major fields to be checked here. Note: All the fields here related to Server Machine acknowledging client machine

Fig: SYN-ACK packet analysis


  • Source Port: reply coming from the server machine 
  • TCP Segment Length: Payload of the packet. In the all 3 -way handshake processes this field is zero, because data transfer will happen only the connection established between the parties.
  • Sequence Number: 2 types can be seen here raw and relative sequence number. both are same. Raw is a random number chosen by the system while relative sequence number is for human easy understanding placed here
  • Acknowledgement Number: here we can confirm the SYN packet from client acknowledged by the Server. because the relative acknowledgement is increased by 1 (as Next sequence Num in SYN Packet from Client) and raw acknowledgement is sum of raw sequence number from client +1 . which means in SYN-ACK packet the server acknowledging client sequence numbers
    relative acknowledgement = relative sequence +1 0+1=1
    raw acknowledgement = raw sequence from client machine +1 143724499+1=143724500
  • Flags: this field will show the current Handshake Process in the Packet
ACK Packet Analysis: Packet from Client to Server. Covering major fields to be checked here. Note: All the fields here related to Client Machine acknowledging Server machine

Fig: ACK packet analysis

  • Destination port: Client replying to the server regarding SYN-ACK packet
  • TCP Segment Length: Payload of the packet. In the all 3 -way handshake processes this field is zero, because data transfer will happen only the connection established between the parties.
  • Sequence Number: The Client also acknowledging the SYN-ACK packet from the Server. because the raw and relative sequence number are identical with the raw and relative acknowledgment number of the server. 
    relative sequence number:  
    relative acknowledgement from the server 1
    raw sequence number: 
    raw acknowledgement from the server 143724500
  • Acknowledgement Number: here we can confirm the SYN-ACK packet from Server acknowledged by the Client. because the relative acknowledgement is increased by 1 (as Next sequence Num in SYN-ACK Packet from Server) and raw acknowledgement is sum of raw sequence number from Server+1 . which means in ACK packet the Client acknowledging Server sequence numbers
    relative acknowledgement = relative sequence +1 0+1=1
    raw acknowledgement = raw sequence from Server machine +1 2860791319+1=2860791320
  • Flags: this field will show the current Handshake Process in the Packet
In ACK packet we can confirm both parties have agreed/acknowledged other machine proven by the sequence and acknowledgment numbers
--------------------------------------------------------------------------------------------------------------------------
+ After completing of the handshake means all the three steps, the actual payload transfer will takes place

Comments

Popular posts from this blog

Understanding Titanic Survival Predictions with Decision Trees

From Raw Logistics Data to Business Insights: An Excel Analytics Project (RFM Analysis)

Unable to access the PaloAlto VM image via HTTPS