Cyber Services / All lessons / Diploma in Network Technology / Packet Analysis with Wireshark

Packet Analysis with Wireshark

Module 31 of 36 · 3 min read · Free to read

MODULES ↓ Command blocks have a COPY button

Your Gateway to a Career in Network Engineering

Module 7: Packet Analysis with Wireshark

**Wireshark** is a free and open-source packet analyzer. It is one of the most powerful troubleshooting and analysis tools available to a network professional. While command-line tools like ping can tell you *if* a connection is working, Wireshark can tell you *why* it's not working. It provides a microscopic view of the raw data frames traveling across your network, allowing you to see the conversations between devices firsthand.

The Wireshark Interface

When you open a capture, the Wireshark interface is divided into three main panes:

  1. Packet List (Top): A summary of each packet captured, listed in chronological order. Each line shows key information like source/destination IP and protocol.
  2. Packet Details (Middle): A detailed, expandable view of the currently selected packet from the list above. This is where you can analyze the different layers (Ethernet, IP, TCP/UDP, etc.).
  3. Packet Bytes (Bottom): The raw data of the selected packet, displayed in hexadecimal and ASCII. This is useful for deep, low-level analysis.

Your First Capture: Analyzing a DNS Query

The best way to learn Wireshark is to use it. In this simple lab, we will capture the packets generated by a simple DNS lookup.

  1. Step 1: Start the Capture

    Open Wireshark. You will see a list of available network interfaces (e.g., "Wi-Fi," "Ethernet"). Double-click on the active interface that has a graph showing traffic.

  2. Step 2: Apply a Display Filter

    You will see a flood of traffic. To focus only on what we need, type dns into the "Apply a display filter..." bar at the top and press Enter. The packet list will now be empty, waiting for DNS traffic.

  3. Step 3: Generate Traffic

    Open a command prompt on your computer and type the command nslookup www.cisco.com. This will generate DNS traffic.

  4. Step 4: Stop the Capture

    Go back to Wireshark. You should see a few packets in the list. Click the red "Stop" button in the toolbar.

Interpreting the Results

You should now see at least two packets in your Packet List:

No.  Time      Source          Destination     Protocol Info
 1   0.000000  192.168.1.100   8.8.8.8         DNS      Standard query 0x1234 A www.cisco.com
 2   0.025000  8.8.8.8         192.168.1.100   DNS      Standard query response 0x1234 A ...

What You Are Seeing:

  • Packet 1: The Query. This is your computer (192.168.1.100) sending a DNS query to the DNS server (8.8.8.8), asking "What is the IP address for www.cisco.com?"
  • Packet 2: The Response. This is the DNS server replying with the answer.

Diving into the Packet Details

Click on the first packet (the query) and look at the **Packet Details** pane. You can expand each layer to see the information you've learned about throughout this course:

  • Frame: Shows the physical details of the capture.
  • Ethernet II: Here you will see the **Source and Destination MAC addresses**. This is Layer 2.
  • Internet Protocol Version 4 (IPv4): Here you will see the **Source and Destination IP addresses**. This is Layer 3.
  • User Datagram Protocol (UDP): Here you will see the **Source and Destination Ports**. Since this is DNS, the destination port will be 53. This is Layer 4.
  • Domain Name System (DNS): Here you will see the actual DNS query details, including the name being looked up. This is the Application Layer payload.

Capture Filters vs. Display Filters

This is a critical concept for using Wireshark effectively.

  • A **Capture Filter** is set *before* you start capturing. It tells Wireshark to only save packets that match the filter, discarding everything else. This is good for reducing the size of large captures. (e.g., host 192.168.1.1)
  • A **Display Filter** is applied *after* the capture is complete. It hides packets you don't want to see but doesn't delete them. This is much more flexible and is what you will use 99% of the time. (e.g., ip.addr == 192.168.1.1)
Modules (36) ← Diploma in Network Technology