TCP Analysis using Wireshark
Last Updated :
17 Aug, 2022
TCP or Transmission Control Protocol is one of the most important protocols or standards for enabling communication possible amongst devices present over a particular network. It has algorithms that solve complex errors arising in packet communications, i.e. corrupted packets, invalid packets, duplicates, etc. Since it is used with IP(Internet Protocol), many times it is also referred to as TCP/IP. In order to start a communication, the TCP first establishes a connection using the three-way-handshake. TCP’s efficiency over other protocols lies in its error detecting and correction attribute. Not only this, it organizes packets and segments larger data into a number of packets without disrupting the integrity of the data.
So now we are a bit familiar with TCP, let’s look at how we can analyze TCP using Wireshark, which is the most widely used protocol analyzer in the world. In order to analyze TCP, you first need to launch Wireshark and follow the steps given below:
- From the menu bar, select capture -> options -> interfaces.
- In the interfaces, choose a particular Ethernet adapter and note down its IP, and click the start button of the selected adapter.
- Now we shall be capturing packets. Browse to a particular web address to generate traffic to capture packets from the communication for e.g. geeksforgeeks.org and return to Wireshark and stop the capture by selecting stop from the capture menu. You can have a look at it in the image below.
Now we have the captured packets and you will be having the captured packet list on the screen. Since we are concerned here with only TCP packets as we are doing TCP analysis, we shall be filtering out TCP packets from the packet pool. You can apply a filter in any of the following ways:
- In the display filter bar on the screen, enter TCP and apply the filter.
- From analyzing the menu in the menu bar select display filters or from capture select capture filters and then TCP only and ok.
Here you will have the list of TCP packets. The first three packets of this list are part of the three-way handshake mechanism of TCP to establish a connection. Let’s get a basic knowledge of this mechanism which happens in the following 3 steps:
- A synchronization packet (SYN) is sent by your local host IP to the server it desires to connect to.
- The server reciprocates by sending an acknowledgment packet (ACK) to the local host signaling that it has received the SYN request of the host IP to connect and also sends a synchronization packet (SYN) to the local host to confirm the connection. So this one is basically an SYN+ACK packet.
- The host answers this request by sending the ACK on receiving the SYN of the server. You can understand it better by looking at the diagram below.
You can observe these three steps in the first three packets of the TCP list where each of the packet types i.e. ACK, SYN, SYN-ACK is listed on their respective side. Now to examine a packet closely we shall select a packet and in the expert view in the packet detail section just below the packet list we shall be having the TCP parameters as you can see in the below diagram. Let’s look at each one of them and their significance:
- Source port: This is the port of your host network used for communication.
- Destination port: This is the port of the destination server.
- TCP segment length: It represents the data length in the selected packet.
- Sequence number: It is a method used by Wireshark to give particular indexing to each packet for tracking packets with ease. This indexing starts from 0.
- Next sequence number: It is the sum of the sequence number and the segment length of the current packet.
- Acknowledgment number: It contains the byte length of data received.
- Header length: It is the length of the TCP header and can vary from 20 to 60.
A major section of this TCP packet analysis is the flag section of a packet which gives further in-depth information about the packet. The flag section has the following parameters which are enlisted with their respective significance.
- Congestion window reduced(CWR): It signals a decrease in transmission rate.
- ECN-Echo: It is set on receiving earlier congestion notifications.
- Urgent: It is set when the packet is to be considered a priority.
- Acknowledgment: It indicates whether the current packet contains an acknowledgment packet or not.
- Push: The data should be saved and removed from the communication channel.
- Reset: It indicates an error in the communication.
- Syn: It denotes whether the packet is synchronization or SYN packet or not.
- Fin: It indicates finalization i.e. end of the communication
Further, in the subsections we have:
- Window size value: This is the buffer size of the current host.
- Checksum: It is used to verify that the received packet is OK or has an error.
- Checksum status: The packet checksum is not verified by default, but one can enable it as per requirements.
Finally, after we have done the analysis it’s time to understand how the TCP connection is closed. It is commonly known as a TCP termination handshake. It further happens in the following steps:
- The closing side or the local host sends the FIN or finalization packet.
- The server sends an ACK signaling it has received the FIN packet and sends a FIN packet for confirmation on the closing side.
- Lastly, the closing side receives the FIN packet and reciprocates by sending the ACK packet thus confirming the connection termination. For a better understanding, you can have a look at the below diagram.
Similar Reads
ANCP in Wireshark
The ANCP (Automatic Network Configuration Protocol) is a protocol that allows for the configuration of devices over an ASCII serial link. Originally designed by Lucent Technologies, it was later standardized by the TIA and called âTIA/EIA-1057â. ANCP messages typically include information such as de
4 min read
BACnet in Wireshark
Digital information is more precious than any other asset in this information era, so it becomes the necessity of each and every organization to secure the data and provide a safe transfer of data over the network. Network in itself is very complex and transferring data attracts unwanted users and a
3 min read
IAX2 Stream Analysis Window in Wireshark
With the ease of communication through networks, people become obsessed to share data over networks rather than physical forms and this attracted malicious attackers who want to steal users' private and confidential data for various unethical purposes. These issues highlighted the need to make secur
3 min read
DNS in Wireshark
DNS or Domain Name System abbreviated as DNS is a system used to resolve domain names, IP addresses, different servers for e.g., FTP servers, game servers, active directories, etc., and keep their records. Invented by Jon Postel and Paul Mockapetris in 1982, DNS has now become one of the most signif
5 min read
VoIP Calls Window in Wireshark
Wireshark is a tool that is widely used in the field of cyber security for analyzing traffic over different networks which may be wired or wireless. This software is available for free to its users and has numerous tools to analyze data packets flowing from one point to another. Apart from analyzing
3 min read
What is RTP in Wireshark?
RTP stands for Real-Time Protocol, which is a protocol that allows the transmission of streaming media over an IP-based network. The protocol determines how audio and video data will be encoded, transmitted, and packaged in data packets along with the information necessary to decode the data at its
5 min read
SCTP Windows in Wireshark
With the growth of digital platforms, rise in malicious activities has been increased to target unsecure or less secure platforms for different purposes like identity theft, stealing personal data for psychographic profiles etc. Hence, security becomes the priority of all the digital platforms and t
3 min read
wireshark sniffing and spoofing
Wireshark is an open-source packet analyzer that enables real-time data inspection. It enables network sniffing, which analyzes traffic for device communication insights. The ethical and legal implications of network sniffing are discussed, emphasizing responsible usage. Spoofing, a manipulation of
5 min read
Endpoints in Wireshark
An "Endpoint" in simple terms is the logical endpoint that communicates back and forth with a network to which it is connected. It refers to a unit at the end of a communication channel. These are designed to perform specific or limited functions. In a network, it is the logical endpoint of separate
3 min read
Flow Graph in Wireshark
The Wireshark's Flow graph feature displays the sender and a receiver view of the packet flow. The window shows connections between hosts. It is very helpful for network analysis and packet capturing. We can analyze the traffic flow of data. We can check the network latency with the help of these yo
2 min read