Wireshark/TCP
Appearance
Wireshark is a free and open source packet analyzer used for network troubleshooting and analysis. These activities will show you how to use Wireshark to capture and analyze Transmission Control Protocol (TCP) traffic.
Readings
[edit | edit source]Preparation
[edit | edit source]To prepare for this activity:
- Start Windows.
- Log in if necessary.
- Install Wireshark.
- Install the Telnet client.
Activity 1 - Capture TCP Traffic
[edit | edit source]To capture TCP traffic:
- Start a Wireshark capture.
- Open a command prompt.
- Type telnet www.google.com 80 and press Enter.
- Close the command prompt to close the TCP connection.
- Stop the Wireshark capture.
Activity 2 - Analyze TCP SYN Traffic
[edit | edit source]To analyze TCP SYN traffic:
- Observe the traffic captured in the top Wireshark packet list pane. To view only TCP traffic related to the web server connection, type tcp.port == 80 (lower case) in the Filter box and press Enter.
- Select the first TCP packet, labeled http [SYN].
- Observe the packet details in the middle Wireshark packet details pane. Notice that it is an Ethernet II / Internet Protocol Version 4 / Transmission Control Protocol frame.
- Expand Ethernet II to view Ethernet details.
- Observe the Destination and Source fields. The destination should be your default gateway's MAC address and the source should be your MAC address. You can use ipconfig /all to confirm.
- Expand Internet Protocol Version 4 to view IP details.
- Observe the Source address. Notice that the source address is your IP address.
- Observe the Destination address. Notice that the destination address is the IP address of one of Google's web servers.
- Expand Transmission Control Protocol to view TCP details.
- Observe the Source port. Notice that it is a dynamic port selected for this connection.
- Observe the Destination port. Notice that it is http (80).
- Observe the Sequence number. Notice that it is 0 (relative sequence number). To see the actual sequence number, select the Sequence number to highlight the sequence number in the bottom Wireshark bytes pane.
- Expand Flags to view flag details.
- Observe the flag settings. Notice that SYN is set, indicating the first segment in the TCP three-way handshake.
Activity 3 - Analyze TCP SYN, ACK Traffic
[edit | edit source]To analyze TCP SYN, ACK traffic:
- In the top Wireshark packet list pane, select the second TCP packet, labeled SYN, ACK.
- Observe the packet details in the middle Wireshark packet details pane. Notice that it is an Ethernet II / Internet Protocol Version 4 / Transmission Control Protocol frame.
- Expand Ethernet II to view Ethernet details.
- Observe the Destination and Source fields. The destination should be your MAC address and the source should be your default gateway MAC address.
- Expand Internet Protocol Version 4 to view IP details.
- Observe the Source address. Notice that the source address is the Google web server IP address.
- Observe the Destination address. Notice that the destination address is your IP address.
- Expand Transmission Control Protocol to view TCP details.
- Observe the Source port. Notice that it is http (80).
- Observe the Destination port. Notice that it is the same dynamic port selected for this connection.
- Observe the Sequence number. Notice that it is 0 (relative sequence number). To see the actual sequence number, select Sequence number to highlight the sequence number in the bottom Wireshark bytes pane.
- Observe the Acknowledgement number. Notice that it is 1 (relative ack number). To see the actual acknowledgement number, select Acknowledgement number to highlight the acknowledgement number in the bottom pane. Notice that the actual acknowledgement number is one greater than the sequence number in the previous segment.
- Expand Flags to view flag details.
- Observe the flag settings. Notice that SYN and ACK are set, indicating the second segment in the TCP three-way handshake.
Activity 4 - Analyze TCP ACK Traffic
[edit | edit source]To analyze TCP ACK traffic:
- In the top Wireshark packet list pane, select the third TCP packet, labeled http ACK.
- Observe the packet details in the middle Wireshark packet details pane. Notice that it is an Ethernet II / Internet Protocol Version 4 / Transmission Control Protocol frame.
- Expand Ethernet II to view Ethernet details.
- Observe the Destination and Source fields. The destination should be your default gateway MAC address and the source should be your MAC address.
- Expand Internet Protocol Version 4 to view IP details.
- Observe the Source address. Notice that the source address is your IP address.
- Observe the Destination address. Notice that the destination address is the Google web server IP address.
- Expand Transmission Control Protocol to view TCP details.
- Observe the Source port. Notice that it is the same dynamic port selected for this connection.
- Observe the Destination port. Notice that it is http (80).
- Observe the Sequence number. Notice that it is 1 (relative sequence number). To see the actual sequence number, select Sequence number to highlight the sequence number in the bottom Wireshark bytes pane.
- Observe the Acknowledgement number. Notice that it is 1 (relative ack number). To see the actual acknowledgement number, select Acknowledgement number to highlight the acknowledgement number in the bottom pane.
- Expand Flags to view flag details.
- Observe the flag settings. Notice that ACK is set, indicating the third segment in the TCP three-way handshake. The client has established a TCP connection with the server.
Activity 5 - Analyze TCP FIN ACK Traffic
[edit | edit source]To analyze TCP FIN ACK traffic:
- In the top Wireshark packet list pane, select the fourth TCP packet, labeled http FIN, ACK.
- Observe the packet details in the middle Wireshark packet details pane. Notice that it is an Ethernet II / Internet Protocol Version 4 / Transmission Control Protocol frame.
- Expand Ethernet II to view Ethernet details.
- Observe the Destination and Source fields. The destination should be your default gateway MAC address and the source should be your MAC address.
- Expand Internet Protocol Version 4 to view IP details.
- Observe the Source address. Notice that the source address is your IP address.
- Observe the Destination address. Notice that the destination address is the Google web server IP address.
- Expand Transmission Control Protocol to view TCP details.
- Observe the Source port. Notice that it is the same dynamic port selected for this connection.
- Observe the Destination port. Notice that it is http (80).
- Observe the Sequence number. Notice that it is 1 (relative sequence number).
- Observe the Acknowledgement number. Notice that it is 1 (relative ack number).
- Expand Flags to view flag details.
- Observe the flag settings. Notice that FIN and ACK are set, indicating the first segment in the TCP teardown handshake. The client has indicated it is closing the TCP connection with the server.
Activity 6 - Analyze TCP FIN ACK Traffic
[edit | edit source]To analyze TCP FIN ACK traffic:
- In the top Wireshark packet list pane, select the fifth TCP packet, labeled FIN, ACK.
- Observe the packet details in the middle Wireshark packet details pane. Notice that it is an Ethernet II / Internet Protocol Version 4 / Transmission Control Protocol frame.
- Expand Ethernet II to view Ethernet details.
- Observe the Destination and Source fields. The destination should be your MAC address and the source should be your default gateway MAC address.
- Expand Internet Protocol Version 4 to view IP details.
- Observe the Source address. Notice that the source address is the Google web server IP address.
- Observe the Destination address. Notice that the destination address is your IP address.
- Expand Transmission Control Protocol to view TCP details.
- Observe the Source port. Notice that it is http (80).
- Observe the Destination port. Notice that it is the same dynamic port selected for this connection.
- Observe the Sequence number. Notice that it is 1 (relative sequence number).
- Observe the Acknowledgement number. Notice that it is 2 (relative ack number).
- Expand Flags to view flag details.
- Observe the flag settings. Notice that FIN and ACK are set, indicating the second segment in the TCP three-way handshake. The server has indicated it is closing the TCP connection with the client.
Activity 7 - Analyze TCP ACK Traffic
[edit | edit source]To analyze TCP ACK traffic:
- In the top Wireshark packet list pane, select the sixth TCP packet, labeled http ACK.
- Observe the packet details in the middle Wireshark packet details pane. Notice that it is an Ethernet II / Internet Protocol Version 4 / Transmission Control Protocol frame.
- Expand Ethernet II to view Ethernet details.
- Observe the Destination and Source fields. The destination should be your default gateway MAC address and the source should be your MAC address.
- Expand Internet Protocol Version 4 to view IP details.
- Observe the Source address. Notice that the source address is your IP address.
- Observe the Destination address. Notice that the destination address is the Google web server IP address.
- Expand Transmission Control Protocol to view TCP details.
- Observe the Source port. Notice that it is the same dynamic port selected for this connection.
- Observe the Destination port. Notice that it is http (80).
- Observe the Sequence number. Notice that it is 2 (relative sequence number).
- Observe the Acknowledgement number. Notice that it is 2 (relative ack number).
- Expand Flags to view flag details.
- Observe the flag settings. Notice that ACK is set, indicating the third segment in the TCP teardown handshake. The client has acknowledged the server closing the TCP connection.
- Close Wireshark to complete this activity. Quit without Saving to discard the captured traffic.