Able of Contents
Able of Contents
able of Contents
1. Introduction
2. Objectives
3. Prerequisites
4. Lab Setup
5. Installing Wireshark
6. Installing tcpdump
7. Capturing and Analyzing Network Traffic
○ Using Wireshark
○ Using tcpdump
8. Client-Server Communication Using UDP
9. Client-Server Communication Using TCP
10. Identifying UDP/TCP Datagrams
11. Conclusion
12. References
1. Introduction
In this lab, you will learn how to install and use network analysis tools like Wireshark
and tcpdump. You will also capture and analyze network traffic to observe data
transferred in client-server communication using UDP and TCP protocols.
2. Objectives
● Install Wireshark and tcpdump.
● Capture network traffic using Wireshark and tcpdump.
● Observe and analyze data transferred in client-server communication using
UDP/TCP.
● Identify and interpret UDP/TCP datagrams.
3. Prerequisites
● Basic knowledge of networking concepts.
● A computer with internet access.
● Administrative privileges to install software.
4. Lab Setup
● A computer running a Linux or Windows operating system.
● Wireshark and tcpdump installed.
● A server and client setup for testing UDP/TCP communication (can be done on
the same machine using different ports or on different machines).
5. Installing Wireshark
On Windows
On Linux
6. Installing tcpdump
On Windows
1. Open Wireshark.
2. Select the network interface to capture traffic from (usually eth0 or wlan0 for
wired or wireless connections, respectively).
3. Click on the "Start" button to begin capturing packets.
4. To stop capturing, click on the "Stop" button.
5. Analyze the captured packets by applying filters and examining the packet
details.
Using tcpdump
1. Open a terminal.
2. Start capturing packets on a network interface (e.g., eth0) with the following
command:
tcpdump -r capture.pcap
import socket
UDP_IP = "127.0.0.1"
UDP_PORT = 5005
while True:
data, addr = sock.recvfrom(1024)
print("Received message:", data.decode())
UDP Client
import socket
UDP_IP = "127.0.0.1"
UDP_PORT = 5005
MESSAGE = "Hello, UDP!"
TCP Server
import socket
TCP_IP = "127.0.0.1"
TCP_PORT = 5005
import socket
TCP_IP = "127.0.0.1"
TCP_PORT = 5005
MESSAGE = "Hello, TCP!"
tcpdump -r capture.pcap
11. Conclusion
In this lab, you learned how to install and use Wireshark and tcpdump to capture and
analyze network traffic. You also observed data transferred in client-server
communication using UDP and TCP protocols and identified UDP/TCP datagrams.
12. References
● Wireshark Official Website
● tcpdump Official Website
● Python socket module documentation