<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Wireshark 101 · Network Doodles</title><link>https://networkdoodles.com/lessons/wireshark-101/</link><description>Read the network one packet at a time. What a capture is and where to take it, capture and display filters, then ARP, DHCP, DNS, TCP and TLS as they really look on the wire, and a method for finding a broken path. Eight lessons, each with a hands-on lab chapter.</description><language>en-us</language><managingEditor>David Henderson</managingEditor><lastBuildDate>Mon, 16 Nov 2026 09:00:00 -0500</lastBuildDate><atom:link href="https://networkdoodles.com/lessons/wireshark-101/index.xml" rel="self" type="application/rss+xml"/><item><title>Troubleshooting a Broken Path with Wireshark: Loss, Silent Drops and MTU (Wireshark 101, Lesson 8)</title><link>https://networkdoodles.com/lessons/wireshark-101/broken-path/</link><pubDate>Mon, 16 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/wireshark-101/broken-path/</guid><category>wireshark</category><category>packet-capture</category><category>networking-basics</category><category>troubleshooting</category><category>tcp</category><description>Find where a path breaks: capture at several points, follow one packet, read loss and retransmissions, silent ACL drops, missing routes and MTU holes.</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>When a connection fails, the capture on the client tells you <em>that</em> something went wrong, rarely <em>where</em>. The
method that finds where is simple: capture at two or more points on the path at the same time, and follow one
packet from point to point. The fault is between the last place you see it and the first place you don&rsquo;t. Then
the shape of what you see tells you what kind of fault it is: a burst of duplicate ACKs is loss, a SYN that
vanishes is a filter, a SYN-ACK that never comes back is a route, and a connection that opens and then stalls
is very often the MTU.</p>
<p>This lesson pulls the whole course together on four faults from the
<a href="/labs/wireshark-101/">Wireshark 101 lab</a>. Each one looks different on the wire, and two of them look the same
from the laptop.</p>
<hr>
<h2 id="silence-versus-refusal">Silence versus refusal</h2>
<p><a href="/lessons/wireshark-101/tcp/">Lesson 6</a> drew the line that matters most here. A SYN answered by a RST is a
<strong>refusal</strong>: the network works and the far end said no. A SYN answered by nothing is <strong>silence</strong>: something on
the way dropped it, or dropped the answer, and nobody said a word.</p>
<p>A refusal is easy to troubleshoot, because the answer came from somewhere. Silence is hard, because the client
sees exactly the same thing whatever the cause: the same SYN, sent again and again. In the lab&rsquo;s mystery fault,
the laptop&rsquo;s capture is seven copies of one SYN over seven seconds, then nothing. Three different faults
produce that capture. You can&rsquo;t tell them apart from the laptop, however long you stare.</p>
<p>So you stop staring and add capture points.</p>
<hr>
<h2 id="capture-at-two-points-and-follow-one-packet">Capture at two points and follow one packet</h2>
<p>The lab&rsquo;s path from the laptop to the web server crosses a switch and two routers:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">laptop ──[laptop:eth1]── sw1 ── r1 ──[r1:eth2]── r2 ──[r2:eth2]── web
</span></span></code></pre></div><p>Capture all three marked points into one file, at the same time, and filter on one connection. A SYN that
appears at <code>laptop:eth1</code> and <code>r1:eth2</code>, but never at <code>r2:eth2</code>, got through r1 and died at r2. That&rsquo;s the
whole method: divide the path, and look for the boundary between seen and not seen. Wireshark&rsquo;s
<code>frame.interface_name</code> field records which point saw each frame.</p>
<p>Two rules make it work:</p>
<ul>
<li><strong>Capture at the same time.</strong> Faults come and go. Two captures taken ten minutes apart don&rsquo;t describe the
same packet.</li>
<li><strong>Take away what you&rsquo;re not testing.</strong> The lab&rsquo;s mystery traffic opens the web server by its IP address, not
its name, so a DNS problem can&rsquo;t hide the fault you&rsquo;re looking for.</li>
</ul>
<h3 id="the-multi-interface-trap">The multi-interface trap</h3>
<p>Put one packet in a file three times and Wireshark&rsquo;s TCP analysis gets confused. It doesn&rsquo;t know the copies are
the same packet seen in three places. It thinks the second and third copies were sent again:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">1  0.000000000  laptop:eth1  51606 → 80 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 ...
</span></span><span class="line"><span class="cl">2  0.000217167  r1:eth2      [TCP Retransmission] 51606 → 80 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 ...
</span></span></code></pre></div><p>Frame 2 isn&rsquo;t a retransmission. It&rsquo;s frame 1, 0.2 ms later and one router further on. Every <code>tcp.analysis</code>
flag in a multi-point capture is suspect until you deal with this.</p>
<p>The obvious fix, a display filter like <code>frame.interface_name == &quot;laptop:eth1&quot;</code>, isn&rsquo;t enough. A display filter
hides frames; it doesn&rsquo;t redo the analysis. In the lab&rsquo;s MTU capture, the SYN-ACK reached the switch&rsquo;s capture
point first, so the laptop&rsquo;s own copy is still flagged <em>TCP Retransmission</em> with everything else filtered out.
Two fixes that do work, both checked against the lab&rsquo;s captures with Wireshark 4.6:</p>
<ul>
<li><strong>Export one interface to its own file</strong> (File › Export Specified Packets, with the interface filter applied)
and open that. The analysis starts over, and the false flags are gone.</li>
<li><strong>Tell Wireshark the copies are different conversations.</strong> The preference
<code>protocols.conversation_deinterlacing_key</code> (find it under Edit › Preferences › Advanced) set to <code>.MI</code> keeps
frames from different interfaces and MACs in separate TCP streams. Each capture point becomes its own stream,
and only real retransmissions are flagged.</li>
</ul>
<hr>
<h2 id="packet-loss-duplicate-acks-and-fast-retransmission">Packet loss: duplicate ACKs and fast retransmission</h2>
<p>A link that loses a few percent of its packets doesn&rsquo;t look broken. Pages load, downloads finish, ping mostly
answers. Everything is just slower. A capture shows it plainly, because TCP has to do something about every lost
packet, and it does it on the wire.</p>
<p>In the lab, r2 drops 3% of what it sends towards r1, and the laptop downloads a 2 MB file. Here&rsquo;s one lost
segment and its repair:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">35 0.578603209 192.168.2.10 → 192.168.1.175 [TCP Previous segment not captured] 80 → 56336 [ACK] Seq=17623 ... Len=1448
</span></span><span class="line"><span class="cl">36 0.578605084 192.168.1.175 → 192.168.2.10 [TCP Dup ACK 34#1] 56336 → 80 [ACK] Seq=79 Ack=16175 ... SLE=17623 SRE=19071
</span></span><span class="line"><span class="cl">38 0.578606375 192.168.1.175 → 192.168.2.10 [TCP Dup ACK 34#2] 56336 → 80 [ACK] Seq=79 Ack=16175 ... SLE=17623 SRE=20519
</span></span><span class="line"><span class="cl">40 0.578607334 192.168.1.175 → 192.168.2.10 [TCP Dup ACK 34#3] 56336 → 80 [ACK] Seq=79 Ack=16175 ... SLE=17623 SRE=21967
</span></span><span class="line"><span class="cl">...
</span></span><span class="line"><span class="cl">58 0.578705625 192.168.2.10 → 192.168.1.175 [TCP Fast Retransmission] 80 → 56336 [ACK] Seq=16175 ... Len=1448
</span></span></code></pre></div><p>Read it with the sequence numbers from lesson 6:</p>
<ol>
<li><strong>The gap.</strong> Frame 35 starts at byte 17,623, but the laptop was expecting 16,175. One 1,448-byte segment is
missing. Wireshark marks it <em>Previous segment not captured</em>.</li>
<li><strong>Duplicate ACKs.</strong> The laptop can only acknowledge bytes up to the gap, so every segment that arrives after it
triggers the same ACK again: <code>Ack=16175</code>, &ldquo;I still need byte 16,175&rdquo;.</li>
<li><strong>SACK blocks.</strong> Each duplicate ACK also carries a <strong>SACK</strong> block (<a href="https://www.rfc-editor.org/rfc/rfc2018">RFC 2018</a>):
<code>SLE</code> and <code>SRE</code> (the left and right edges) list the bytes the laptop <em>did</em> get past the gap. The right edge
grows with every segment. The sender learns exactly what&rsquo;s missing and resends only that.</li>
<li><strong>Fast retransmission.</strong> The sender doesn&rsquo;t wait for a timeout. Duplicate ACKs are a strong hint that one
segment was lost and the ones after it arrived, so it resends the missing one straight away.
<a href="https://www.rfc-editor.org/rfc/rfc5681">RFC 5681</a> sets the trigger at three duplicate ACKs.</li>
</ol>
<p>In the lab&rsquo;s reference capture, 3% loss on one direction of one link produced 26 retransmissions (25 of them
fast) and 142 duplicate ACKs, plus 39 gaps and 18 segments marked out of order. The receiver is noisy about loss;
the sender is quiet and efficient.</p>
<h3 id="wiresharks-labels-are-heuristics">Wireshark&rsquo;s labels are heuristics</h3>
<p>Those <code>tcp.analysis</code> labels are Wireshark&rsquo;s best guess from the sequence numbers, not something TCP wrote in
the packet. <a href="https://www.wireshark.org/docs/wsug_html_chunked/ChAdvTCPAnalysis.html">Wireshark&rsquo;s TCP analysis documentation</a>
gives the rules, and they don&rsquo;t always match the RFCs. It calls a segment a <em>fast retransmission</em> after two
duplicate ACKs, not three. And it calls a filled gap <em>out-of-order</em> instead of a retransmission when it arrives
very soon after the previous segment, within the initial RTT or 3 ms. The lab&rsquo;s link loses packets but never reorders them, so
those 18 &ldquo;out-of-order&rdquo; segments are really repairs too.</p>
<table>
  <thead>
      <tr>
          <th>Flag</th>
          <th>Wireshark&rsquo;s meaning</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>tcp.analysis.lost_segment</code></td>
          <td>a gap: the sequence number jumped past what was expected</td>
      </tr>
      <tr>
          <td><code>tcp.analysis.duplicate_ack</code></td>
          <td>an ACK that repeats the previous one, with no data and the same window</td>
      </tr>
      <tr>
          <td><code>tcp.analysis.retransmission</code></td>
          <td>data the sender had already sent (fast retransmissions included)</td>
      </tr>
      <tr>
          <td><code>tcp.analysis.fast_retransmission</code></td>
          <td>a retransmission that followed duplicate ACKs</td>
      </tr>
      <tr>
          <td><code>tcp.analysis.out_of_order</code></td>
          <td>a filled gap that arrived quickly after the segment before it</td>
      </tr>
  </tbody>
</table>
<p><code>tcp.analysis.flags</code> matches them all, and <strong>Analyze › Expert Information</strong> counts them by type. That&rsquo;s the
fastest summary of a capture&rsquo;s health. Just remember the multi-interface trap above before trusting the counts.</p>
<p>To find <em>where</em> the loss happens, use the method: a segment on <code>r2:eth2</code> that never appears on <code>r1:eth2</code> was lost
between them.</p>
<hr>
<h2 id="acl-drops-silent-or-icmp-administratively-prohibited">ACL drops: silent, or ICMP administratively prohibited</h2>
<p>An <strong>access list</strong> (ACL) is a router&rsquo;s list of permit and deny rules. When it denies a packet, the router has two
choices: drop it silently, or tell the sender with an ICMP <strong>Destination Unreachable</strong> message, type 3,
code 13, <em>communication administratively prohibited</em> (<a href="https://www.rfc-editor.org/rfc/rfc1812">RFC 1812</a>).</p>
<p>The two make very different captures:</p>
<table>
  <thead>
      <tr>
          <th>Router behavior</th>
          <th>What the client sees</th>
          <th>What you can learn</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>sends ICMP type 3 code 13</td>
          <td>the SYN, then an ICMP message from the router that denied it</td>
          <td>which router, straight away: it&rsquo;s the source of the ICMP</td>
      </tr>
      <tr>
          <td>drops silently</td>
          <td>the SYN, again and again, then a timeout</td>
          <td>nothing, until you capture further along</td>
      </tr>
  </tbody>
</table>
<p>The routers in the lab run CapeOS 0.11.2, which answers an inbound ACL deny with ICMP administratively
prohibited unless the interface has <code>no ip unreachables</code>. The mystery fault sets it, so the drop is silent: the
harder case, and the one you&rsquo;ll meet most often, because many networks turn these messages off.</p>
<p>In the lab&rsquo;s reference capture the fault was on r2. The SYN shows up at <code>laptop:eth1</code> and at <code>r1:eth2</code>, seven
times each, and never once at <code>r2:eth2</code>. It crossed r1, arrived at r2, and went no further. No ICMP anywhere.</p>
<hr>
<h2 id="a-missing-return-route">A missing return route</h2>
<p>The third mystery fault looks the same from the laptop, and it&rsquo;s completely different underneath. r2 loses its
route back to the home network, 192.168.1.0/24.</p>
<p>Follow the SYN and it gets all the way to web. web answers with a SYN-ACK. The SYN-ACK reaches r2, which has no
route for 192.168.1.175, and dies there. The captures show it:</p>
<ul>
<li>the SYN at all three points;</li>
<li>a SYN-ACK at <code>r2:eth2</code> only, never at <code>r1:eth2</code> or the laptop;</li>
<li>an ICMP <em>Network unreachable</em> (type 3, code 0) from r2&rsquo;s address on that link, 192.168.2.1, <strong>to web</strong>.</li>
</ul>
<p>That last one catches people out. A router that can&rsquo;t forward a packet tells the packet&rsquo;s <em>source</em>, and the
packet it couldn&rsquo;t forward was web&rsquo;s SYN-ACK. So the ICMP message goes to web, not to the laptop. The laptop never
hears a thing. You only see that message if you capture on web&rsquo;s side of r2.</p>
<p>The general lesson: a path has two directions, and a fault in the return direction looks like a fault in the
forward direction from the client. If the SYN arrives and the answer doesn&rsquo;t come back, look at routes <em>back</em>.</p>
<hr>
<h2 id="mtu-when-small-packets-work-and-big-ones-dont">MTU: when small packets work and big ones don&rsquo;t</h2>
<p>The <strong>MTU</strong> (maximum transmission unit) is the biggest IP packet a link carries in one frame. On ordinary
Ethernet it&rsquo;s 1,500 bytes, a 1,514-byte frame with the Ethernet header. Some networks use <strong>jumbo frames</strong>, often
9,000 bytes, to move data in fewer, bigger packets.</p>
<p>At the start of a connection, each side announces its <strong>MSS</strong> (maximum segment size), worked out from its own
MTU: 1,460 for 1,500, 8,960 for 9,000. The other side then sends segments up to that size. Neither side knows
anything about the links in between.</p>
<p>In the lab, someone turned on jumbo frames on the laptop and on web, but not on the switch between the laptop
and r1. Both hosts announced <code>MSS=8960</code>. The handshake is small, so it crossed fine. Then:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">11  laptop:eth1    74  57982 → 443 [SYN] Seq=0 Win=62720 Len=0 MSS=8960 ...
</span></span><span class="line"><span class="cl">13  sw1:eth1       74  443 → 57982 [SYN, ACK] Seq=0 Ack=1 ... MSS=8960 ...
</span></span><span class="line"><span class="cl">15  laptop:eth1    66  57982 → 443 [ACK] Seq=1 Ack=1 ...
</span></span><span class="line"><span class="cl">17  laptop:eth1  1624  Client Hello (SNI=web.lab)
</span></span><span class="line"><span class="cl">18  laptop:eth1  1624  [TCP Retransmission] 57982 → 443 [PSH, ACK] Seq=1 Ack=1 ... Len=1558
</span></span><span class="line"><span class="cl">19  laptop:eth1  1624  [TCP Retransmission] 57982 → 443 [PSH, ACK] Seq=1 Ack=1 ... Len=1558
</span></span><span class="line"><span class="cl">...
</span></span></code></pre></div><p>The third column is the frame length. The TLS 1.3 Client Hello from <a href="/lessons/wireshark-101/tls-without-decryption/">lesson 7</a>,
1,558 bytes, now went as <strong>one</strong> 1,624-byte frame, because the laptop believed it had 8,960 bytes to play with.
It left the laptop 16 times (the original and 15 retransmissions), about every half second, and never once appeared on <code>sw1:eth1</code>, the switch&rsquo;s port
towards r1. Filter <code>frame.len &gt; 1514</code> and the picture is complete in two lines: big frames on one side of the
switch, none on the other.</p>
<h3 id="why-a-switch-makes-a-black-hole">Why a switch makes a black hole</h3>
<p>A router that receives a packet too big for the next link, with the IP header&rsquo;s <strong>DF</strong> (don&rsquo;t fragment) bit set,
drops it and sends back ICMP type 3, code 4, <em>fragmentation needed</em>, with the next link&rsquo;s MTU in the message.
That&rsquo;s <strong>Path MTU Discovery</strong> (<a href="https://www.rfc-editor.org/rfc/rfc1191">RFC 1191</a>): the sender learns the
smaller size and sends smaller segments. TCP on Linux sets DF on its packets for exactly this reason. The lab&rsquo;s
1,624-byte frame had it set.</p>
<p>A <strong>switch</strong> can&rsquo;t do that. It works at layer 2, forwarding frames by MAC address, and has no IP address on the
path to send ICMP from. A frame bigger than its port&rsquo;s MTU is simply dropped. Nobody is told, so the sender never
learns, and it keeps retransmitting into the hole until the application gives up. That&rsquo;s a <strong>black hole</strong>:
packets go in and nothing comes out.</p>
<p>Routers can make black holes too. If the <em>fragmentation needed</em> message is filtered on the way back, often by a
firewall that blocks &ldquo;all ICMP&rdquo;, PMTUD breaks in the same silent way.
<a href="https://www.rfc-editor.org/rfc/rfc2923">RFC 2923</a> describes the problem.</p>
<h3 id="why-tls-13-breaks-first">Why TLS 1.3 breaks first</h3>
<p>An MTU problem only hurts packets bigger than the smallest link. Ping is 98 bytes. A DNS lookup is under 100.
A TCP handshake is 74. A plain HTTP request is often under 200. On the lab&rsquo;s broken path, all of those work. The
first big packet in most HTTPS connections is now the client&rsquo;s TLS 1.3 Client Hello, and with a post-quantum key
share it&rsquo;s over 1,500 bytes on its own. So the classic symptom is: <strong>ping works, HTTP works, HTTPS hangs right
after the handshake.</strong> It used to take a large download to trip over an MTU mismatch. Now a single Client Hello
does it.</p>
<hr>
<h2 id="what-i-see-go-wrong">What I see go wrong</h2>
<p><strong>Trusting the analysis in a multi-point capture.</strong> Half the <em>Retransmission</em> and <em>Dup ACK</em> labels in a
three-point capture are the same packet seen three times. Export one interface, or set the deinterlacing
preference, before you count anything.</p>
<p><strong>Capturing at one point and guessing.</strong> The client&rsquo;s capture says &ldquo;no answer&rdquo;. It can&rsquo;t say where. Two capture
points, at the same time, usually settle it in minutes.</p>
<p><strong>Forgetting the return path.</strong> A SYN that arrives and an answer that doesn&rsquo;t come back is a return-route or
return-filter problem. The ICMP message that would explain it goes to the server, not to you.</p>
<p><strong>&ldquo;Ping works, so the network&rsquo;s fine.&rdquo;</strong> Ping is small. Test with the size that fails. When the application
hangs after the handshake, filter <code>frame.len &gt; 1514</code> and look for large frames sent over and over and never
acknowledged.</p>
<p><strong>Mixed MTUs.</strong> Jumbo frames on the hosts and not on the switches, or the other way around, is a black hole
waiting for its first big packet. Make every device on a layer 2 network agree on the MTU.</p>
<hr>
<h2 id="try-it">Try it</h2>
<p><a href="/labs/wireshark-101/#chapter-8">Chapter 8 of the lab</a> breaks the path three ways: packet loss you measure, a
fault the lab picks at random that you find with three capture points, and the jumbo-frame black hole.</p>
<h2 id="where-to-go-next">Where to go next</h2>
<p>That&rsquo;s the end of Wireshark 101. Captures are for one conversation, on demand. For watching a whole network all
the time, logs and metrics do the job, and the <span class="link-soon">observability course</span> builds them. When
those say something is wrong and can&rsquo;t say why, come back to the packets. Or start again at the
<a href="/lessons/wireshark-101/dns/">DNS lesson</a> with a capture from your own network.</p>
]]></content:encoded></item><item><title>What TLS Shows Without Decrypting It: SNI, Versions and Ciphers (Wireshark 101, Lesson 7)</title><link>https://networkdoodles.com/lessons/wireshark-101/tls-without-decryption/</link><pubDate>Mon, 16 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/wireshark-101/tls-without-decryption/</guid><category>wireshark</category><category>packet-capture</category><category>networking-basics</category><category>tls</category><description>What a TLS handshake shows without decrypting: SNI, versions, cipher, ALPN and the certificate, TLS 1.2 vs 1.3, and key log files for your own traffic.</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>TLS encrypts the content of a connection, but not the start of it. Before the two ends can encrypt anything,
they have to agree how, and that negotiation, the <strong>handshake</strong>, is partly in the clear. From a capture,
without any keys, you can read the server name the client asked for, the TLS versions and cipher suites it
offered, the ones the server chose, and the application protocols on offer. In TLS 1.2 you can read the
server&rsquo;s certificate too. In TLS 1.3 you can&rsquo;t. And with a key log file from your own client, you can decrypt
the rest.</p>
<p>That&rsquo;s usually all a network engineer needs. When an HTTPS connection fails, the question is rarely &ldquo;what was in
the page&rdquo;. It&rsquo;s &ldquo;which name, which version, which certificate, and did the handshake finish&rdquo;. This lesson uses
two connections from the <a href="/labs/wireshark-101/">Wireshark 101 lab</a>: curl opening <code>https://web.lab/</code> with TLS
1.3, and <code>https://intranet.lab/secret.txt</code> with TLS 1.2.</p>
<hr>
<h2 id="what-is-tls-and-what-does-it-hide">What is TLS, and what does it hide?</h2>
<p><strong>TLS</strong> (Transport Layer Security) is the S in HTTPS. It runs on top of an ordinary TCP connection
(<a href="/lessons/wireshark-101/tcp/">lesson 6</a>) and encrypts everything the application sends: the page, the path
after the name, headers, cookies, passwords. In a capture, all of that is a series of records labeled
<em>Application Data</em>, with a length and nothing else.</p>
<p>What it doesn&rsquo;t hide:</p>
<table>
  <thead>
      <tr>
          <th>Visible</th>
          <th>Where</th>
          <th>Why it&rsquo;s there</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>IP addresses and ports</td>
          <td>IP and TCP headers</td>
          <td>TLS rides inside TCP; routers still need them</td>
      </tr>
      <tr>
          <td><strong>SNI</strong>, the server name</td>
          <td>Client Hello</td>
          <td>one server can host many names, and it needs to know which certificate to send</td>
      </tr>
      <tr>
          <td>versions and cipher suites offered</td>
          <td>Client Hello</td>
          <td>the client lists what it can do</td>
      </tr>
      <tr>
          <td>version and cipher suite chosen</td>
          <td>Server Hello</td>
          <td>the server picks one of each</td>
      </tr>
      <tr>
          <td><strong>ALPN</strong> protocols offered</td>
          <td>Client Hello</td>
          <td>which application protocol will run inside, such as <code>h2</code> or <code>http/1.1</code></td>
      </tr>
      <tr>
          <td>the server&rsquo;s certificate</td>
          <td>TLS 1.2 only</td>
          <td>in TLS 1.3 it&rsquo;s encrypted</td>
      </tr>
      <tr>
          <td>record sizes and timing</td>
          <td>every record</td>
          <td>encryption hides content, not length</td>
      </tr>
  </tbody>
</table>
<p>The <strong>Client Hello</strong> is the client&rsquo;s first message: everything it supports, in one go. The <strong>Server Hello</strong> is
the server&rsquo;s reply with its choices. Everything else follows from those two.</p>
<hr>
<h2 id="sni-the-name-you-asked-for">SNI: the name you asked for</h2>
<p><strong>SNI</strong> (Server Name Indication) is an extension in the Client Hello that carries the host name. Wireshark puts
it straight into the Info column:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl"> 9 0.321656708 192.168.1.175 → 192.168.2.10 SSL 1514
</span></span><span class="line"><span class="cl">10 0.321665750 192.168.1.175 → 192.168.2.10 TLSv1.2 176 Client Hello (SNI=web.lab)
</span></span><span class="line"><span class="cl">...
</span></span><span class="line"><span class="cl">34 0.389741458 192.168.1.175 → 192.168.2.10 SSL 1514
</span></span><span class="line"><span class="cl">35 0.389743208 192.168.1.175 → 192.168.2.10 TLSv1.2 181 Client Hello (SNI=intranet.lab)
</span></span></code></pre></div><p>Both connections go to the same address, 192.168.2.10. The IP header can&rsquo;t tell them apart. The SNI can. It
exists because one address commonly serves many names, and the server has to choose the right certificate
before any encryption starts.</p>
<p>That makes SNI the most useful field in an HTTPS capture. It&rsquo;s how you find which connection is the one to
the site that&rsquo;s broken, and it&rsquo;s what firewalls, proxies and monitoring tools that don&rsquo;t decrypt use to decide
what a connection is. The filter <code>tls.handshake.extensions_server_name == &quot;web.lab&quot;</code> finds every connection to
one name.</p>
<hr>
<h2 id="why-does-the-client-hello-say-tls-12-when-its-tls-13">Why does the Client Hello say TLS 1.2 when it&rsquo;s TLS 1.3?</h2>
<p>Look at the Protocol column above: the Client Hello says <em>TLSv1.2</em>. Open it and it gets stranger:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">TLSv1.3 Record Layer: Handshake Protocol: Client Hello
</span></span><span class="line"><span class="cl">    Version: TLS 1.0 (0x0301)
</span></span><span class="line"><span class="cl">    Handshake Protocol: Client Hello
</span></span><span class="line"><span class="cl">        Version: TLS 1.2 (0x0303)
</span></span><span class="line"><span class="cl">        ...
</span></span><span class="line"><span class="cl">        Extension: supported_versions (len=5) TLS 1.3, TLS 1.2
</span></span></code></pre></div><p>Three version numbers in one message, and only the last one is honest. This is deliberate.
<a href="https://www.rfc-editor.org/rfc/rfc8446">RFC 8446</a>, the TLS 1.3 standard, freezes the old version fields at
TLS 1.2 (and allows 1.0 on the record of the first Client Hello), because some middleboxes broke connections
that showed a version they didn&rsquo;t recognize. The real negotiation moved into an extension,
<code>supported_versions</code>, where the client lists every version it can do and the server answers with the one it
picked.</p>
<p>The Server Hello shows the result:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">TLSv1.3 Record Layer: Handshake Protocol: Server Hello
</span></span><span class="line"><span class="cl">    Version: TLS 1.2 (0x0303)
</span></span><span class="line"><span class="cl">    Handshake Protocol: Server Hello
</span></span><span class="line"><span class="cl">        Version: TLS 1.2 (0x0303)
</span></span><span class="line"><span class="cl">        Cipher Suite: TLS_AES_256_GCM_SHA384 (0x1302)
</span></span><span class="line"><span class="cl">        Extension: supported_versions (len=2) TLS 1.3
</span></span><span class="line"><span class="cl">        Extension: key_share (len=1124) X25519MLKEM768
</span></span></code></pre></div><p>Twice &ldquo;TLS 1.2&rdquo;, once &ldquo;TLS 1.3&rdquo;, and the extension wins. Wireshark knows this and labels the record TLSv1.3. The
rule for reading a version: <strong>trust <code>supported_versions</code> in the Server Hello.</strong> If there isn&rsquo;t one, the
connection is TLS 1.2 or older, and the Server Hello&rsquo;s own version field is the real one. The filter
<code>tls.handshake.extensions.supported_version == 0x0304</code> matches TLS 1.3 handshakes.</p>
<hr>
<h2 id="cipher-suites-offered-and-chosen">Cipher suites: offered and chosen</h2>
<p>A <strong>cipher suite</strong> names the algorithms a connection will use. The laptop&rsquo;s curl offered 30 of them, most
preferred first:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Cipher Suites (30 suites)
</span></span><span class="line"><span class="cl">    Cipher Suite: TLS_AES_256_GCM_SHA384 (0x1302)
</span></span><span class="line"><span class="cl">    Cipher Suite: TLS_CHACHA20_POLY1305_SHA256 (0x1303)
</span></span><span class="line"><span class="cl">    Cipher Suite: TLS_AES_128_GCM_SHA256 (0x1301)
</span></span><span class="line"><span class="cl">    Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (0xc02c)
</span></span><span class="line"><span class="cl">    Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (0xc030)
</span></span><span class="line"><span class="cl">    ...
</span></span></code></pre></div><p>The first three are TLS 1.3 suites. In 1.3 a suite names only the encryption (AES-256 in GCM mode) and the hash
(SHA-384); the key exchange is negotiated separately. The rest are TLS 1.2 suites, which name everything in one
string: <code>ECDHE_RSA_WITH_AES_256_GCM_SHA384</code> is an ECDHE key exchange, an RSA certificate, AES-256-GCM and SHA-384.</p>
<p>The two lab connections chose differently:</p>
<table>
  <thead>
      <tr>
          <th></th>
          <th>TLS 1.3 connection</th>
          <th>TLS 1.2 connection</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Version</td>
          <td>TLS 1.3 (from <code>supported_versions</code>)</td>
          <td>TLS 1.2 (no <code>supported_versions</code>)</td>
      </tr>
      <tr>
          <td>Cipher suite</td>
          <td><code>TLS_AES_256_GCM_SHA384</code> (0x1302)</td>
          <td><code>TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384</code> (0xc030)</td>
      </tr>
      <tr>
          <td>ALPN chosen</td>
          <td>encrypted</td>
          <td><code>http/1.1</code>, in the clear</td>
      </tr>
      <tr>
          <td>Certificate</td>
          <td>encrypted</td>
          <td>in the clear</td>
      </tr>
  </tbody>
</table>
<p>When a handshake fails because the two sides have nothing in common, this is where you see it: compare the
client&rsquo;s list with what the server supports. A server that answers a Client Hello with an alert instead of a
Server Hello usually didn&rsquo;t like something in that list.</p>
<hr>
<h2 id="why-is-the-labs-client-hello-1558-bytes">Why is the lab&rsquo;s Client Hello 1,558 bytes?</h2>
<p>Notice frame 9 in the listing above: <em>SSL, 1514 bytes</em>, with no description. The Client Hello didn&rsquo;t fit in one
packet. It&rsquo;s 1,558 bytes of TCP payload, more than the 1,460 a segment can carry on a 1,500-byte network, so TCP
split it, and Wireshark can only decode it once frame 10 completes it.</p>
<p>The reason is its <strong>key share</strong>. In TLS 1.3 the client guesses which key exchange the server will pick and sends
its half of it straight away, to save a round trip. curl on the lab&rsquo;s laptop offers <code>X25519MLKEM768</code> first: a
hybrid that combines the classic X25519 exchange with ML-KEM, a key exchange designed to resist future quantum
computers.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Extension: key_share (len=1258) X25519MLKEM768, x25519
</span></span><span class="line"><span class="cl">    Key Share Entry: Group: X25519MLKEM768, Key Exchange length: 1216
</span></span><span class="line"><span class="cl">    Key Share Entry: Group: x25519, Key Exchange length: 32
</span></span></code></pre></div><p>The hybrid share is 1,216 bytes; the plain X25519 one is 32. The server took the hybrid, and its own share in the
Server Hello is 1,120 bytes. A whole Client Hello from a few years ago fitted in a few hundred bytes. The
lab&rsquo;s TLS 1.2 Client Hello, which leaves out the TLS 1.3 key shares, is a 292-byte frame.</p>
<p>That size has consequences. A Client Hello that needs two segments is the first thing to break on a path with an
MTU problem, while ping, DNS and small HTTP requests keep working.
<a href="/lessons/wireshark-101/broken-path/">Lesson 8</a> breaks exactly that.</p>
<hr>
<h2 id="alpn-which-protocol-runs-inside">ALPN: which protocol runs inside</h2>
<p><strong>ALPN</strong> (Application-Layer Protocol Negotiation) lets the client say which protocols it can speak inside the
encrypted connection. curl offered two:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Extension: application_layer_protocol_negotiation (len=14)
</span></span><span class="line"><span class="cl">    ALPN Next Protocol: h2
</span></span><span class="line"><span class="cl">    ALPN Next Protocol: http/1.1
</span></span></code></pre></div><p><code>h2</code> is HTTP/2. The server&rsquo;s choice is where TLS 1.2 and 1.3 differ. In TLS 1.2 it&rsquo;s in the Server Hello, in the
clear: the lab&rsquo;s server answered <code>http/1.1</code>. In TLS 1.3 it moved into the <em>Encrypted Extensions</em> message, sent
after encryption starts, so a capture only shows what was offered.</p>
<hr>
<h2 id="the-certificate-in-the-clear-in-12-encrypted-in-13">The certificate: in the clear in 1.2, encrypted in 1.3</h2>
<p>A <strong>certificate</strong> is a signed document that says &ldquo;this public key belongs to these names&rdquo;, signed by a
<strong>certificate authority</strong> (CA) that the client already trusts. In TLS 1.2 the server sends it in the clear, right
after its Server Hello:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">11 0.252885000 192.168.2.10 → 192.168.1.175 TLSv1.2 1402 Server Hello, Certificate, Server Key Exchange, Server Hello Done
</span></span></code></pre></div><p>Open it and the details are all there:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">issuer: rdnSequence (0)
</span></span><span class="line"><span class="cl">    rdnSequence: 2 items (id-at-commonName=Network Doodles Lab CA,id-at-organizationName=Network Doodles Lab)
</span></span><span class="line"><span class="cl">subject: rdnSequence (0)
</span></span><span class="line"><span class="cl">    rdnSequence: 2 items (id-at-commonName=web.lab,id-at-organizationName=Network Doodles Lab)
</span></span><span class="line"><span class="cl">...
</span></span><span class="line"><span class="cl">    GeneralName: dNSName (2)
</span></span><span class="line"><span class="cl">        dNSName: web.lab
</span></span><span class="line"><span class="cl">    GeneralName: dNSName (2)
</span></span><span class="line"><span class="cl">        dNSName: intranet.lab
</span></span></code></pre></div><p>The client asked for <code>intranet.lab</code>, and got a certificate whose common name is <code>web.lab</code>. That isn&rsquo;t an error:
the <strong>subjectAltName</strong> (SAN) list covers both names, and the SAN list is what clients check. Reading this off the
wire is how you settle &ldquo;certificate name mismatch&rdquo; and &ldquo;unknown issuer&rdquo; arguments without logging in to the
server.</p>
<p>In TLS 1.3, the Server Hello is followed by <em>Change Cipher Spec, Application Data</em>. The Change Cipher Spec is a
leftover that RFC 8446 keeps for middlebox compatibility. The certificate is inside the Application Data,
encrypted with keys from the key exchange. A capture of a TLS 1.3 connection doesn&rsquo;t show which certificate the
server sent.</p>
<hr>
<h2 id="decrypting-your-own-traffic-with-a-key-log-file">Decrypting your own traffic with a key log file</h2>
<p>You can&rsquo;t decrypt someone else&rsquo;s TLS from a capture. With an ephemeral key exchange, which both lab connections
used (ECDHE in 1.2, the X25519MLKEM768 hybrid in 1.3), even the server&rsquo;s private key isn&rsquo;t enough: each connection makes fresh keys and throws them away.
That property is called forward secrecy.</p>
<p>But you can decrypt your <strong>own</strong> traffic, because your client knows the keys. Many TLS libraries write their
session secrets to a file when the environment variable <code>SSLKEYLOGFILE</code> names one. curl does, and so do Firefox
and Chrome. The file is plain text, one line per secret:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">CLIENT_RANDOM &lt;64 hex digits: the Client Hello&#39;s random&gt; &lt;96 hex digits: the session&#39;s secret&gt;
</span></span></code></pre></div><p>The random value tells Wireshark which connection a line belongs to. Point Wireshark at the file (the TLS
protocol preferences, <em>(Pre)-Master-Secret log filename</em>) and the Application Data becomes what it was:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">15 0.259969042 192.168.1.175 → 192.168.2.10 HTTP 181 GET /secret.txt HTTP/1.1
</span></span><span class="line"><span class="cl">16 0.260409750 192.168.2.10 → 192.168.1.175 HTTP 442 HTTP/1.1 200 OK  (text/plain)
</span></span></code></pre></div><p>The capture didn&rsquo;t change. The keys are the only thing that makes it readable. Wireshark&rsquo;s
<a href="https://wiki.wireshark.org/TLS">TLS page</a> covers the other ways to supply keys.</p>
<h3 id="why-a-key-log-file-is-as-sensitive-as-a-password">Why a key log file is as sensitive as a password</h3>
<p>Anyone who has the key log file and a capture of the same traffic can read everything in it: session cookies,
passwords typed into forms, API tokens. It defeats forward secrecy completely, after the fact, for every
connection in the file. So:</p>
<ul>
<li>set <code>SSLKEYLOGFILE</code> for one debugging session, in one shell, never in a profile that every program inherits;</li>
<li>keep the file next to the capture only as long as you need it, then delete both;</li>
<li>never attach a key log file to a ticket, a chat or a shared drive with the capture.</li>
</ul>
<hr>
<h2 id="what-about-encrypted-client-hello">What about Encrypted Client Hello?</h2>
<p><strong>ECH</strong> (Encrypted Client Hello) closes the biggest gap left in TLS 1.3. It was published in March 2026 as
<a href="https://www.rfc-editor.org/rfc/rfc9849">RFC 9849</a>. The client sends an outer Client Hello in the clear and the
real one encrypted inside it, so the real server name and the ALPN list are hidden. The outer Client Hello still
carries a server name, but it&rsquo;s a public name chosen by the server&rsquo;s operator, often shared by many sites. The
lab doesn&rsquo;t use ECH. Where it is used, the SNI in a capture tells you less than this lesson suggests.</p>
<hr>
<h2 id="what-i-see-go-wrong">What I see go wrong</h2>
<p><strong>Reading the wrong version.</strong> The Protocol column and the record header both say 1.2 for a TLS 1.3 Client
Hello. Read <code>supported_versions</code> in the Server Hello, every time.</p>
<p><strong>Hunting for the certificate in TLS 1.3.</strong> It isn&rsquo;t there to find. If you need to see which certificate a
server sends, connect with a client that shows it, or decrypt your own session.</p>
<p><strong>Missing a split Client Hello.</strong> A frame marked <em>SSL</em> with no description, followed by the Client Hello, is one
message in two segments. That&rsquo;s normal, and it&rsquo;s also the first thing to vanish on a path with an MTU problem.</p>
<p><strong>Leaving <code>SSLKEYLOGFILE</code> set.</strong> It quietly keeps writing secrets for every connection every program makes. Set
it for one command, and unset it.</p>
<hr>
<h2 id="try-it">Try it</h2>
<p><a href="/labs/wireshark-101/#chapter-7">Chapter 7 of the lab</a> has you read the SNI, the versions, the cipher and ALPN
from two connections, then read a TLS 1.2 certificate and decrypt a page with the key log file curl saved.</p>
<h2 id="whats-next">What&rsquo;s next</h2>
<p><a href="/lessons/wireshark-101/broken-path/">Lesson 8</a> puts the whole course to work on three broken paths: packet
loss, a fault the lab picks at random, and a black hole that lets ping through but not that 1,558-byte Client
Hello.</p>
]]></content:encoded></item><item><title>TCP in Wireshark: Handshake, Sequence Numbers, FIN and RST (Wireshark 101, Lesson 6)</title><link>https://networkdoodles.com/lessons/wireshark-101/tcp/</link><pubDate>Mon, 16 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/wireshark-101/tcp/</guid><category>wireshark</category><category>packet-capture</category><category>networking-basics</category><category>tcp</category><description>A TCP connection in Wireshark from SYN to FIN: handshake, sequence and ACK numbers, window, MSS, streams, and a refused connection versus silence.</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>TCP turns a network that loses and reorders packets into a reliable stream of bytes, and it does all of that
in the open, where a capture can watch. A connection opens with three packets (SYN, SYN-ACK, ACK), numbers
every byte it sends, acknowledges what arrived, and closes each direction with a FIN. A refused connection is
two packets: a SYN and a RST. Once you can read those, you can read most of what goes wrong on a network.</p>
<p>Every protocol in this course so far (ARP, DHCP, DNS) has been one question and one answer. A web page can&rsquo;t
work like that, so this lesson follows one: <code>curl http://web.lab/</code> in the
<a href="/labs/wireshark-101/">Wireshark 101 lab</a>, captured on the laptop&rsquo;s cable.</p>
<hr>
<h2 id="what-does-a-whole-tcp-connection-look-like">What does a whole TCP connection look like?</h2>
<p>Here&rsquo;s the entire connection, from the reference capture. DNS for <code>web.lab</code> came first and isn&rsquo;t shown.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl"> 6 0.021836458 192.168.1.175 → 192.168.2.10 TCP 74 47996 → 80 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM TSval=2403693004 TSecr=0 WS=128
</span></span><span class="line"><span class="cl"> 7 0.022324792 192.168.2.10 → 192.168.1.175 TCP 74 80 → 47996 [SYN, ACK] Seq=0 Ack=1 Win=65160 Len=0 MSS=1460 SACK_PERM TSval=4000512039 TSecr=2403693004 WS=128
</span></span><span class="line"><span class="cl"> 8 0.022400375 192.168.1.175 → 192.168.2.10 TCP 66 47996 → 80 [ACK] Seq=1 Ack=1 Win=64256 Len=0 ...
</span></span><span class="line"><span class="cl"> 9 0.022699583 192.168.1.175 → 192.168.2.10 HTTP 137 GET / HTTP/1.1
</span></span><span class="line"><span class="cl">10 0.022722250 192.168.2.10 → 192.168.1.175 TCP 66 80 → 47996 [ACK] Seq=1 Ack=72 Win=65152 Len=0 ...
</span></span><span class="line"><span class="cl">11 0.025193000 192.168.2.10 → 192.168.1.175 TCP 302 HTTP/1.1 200 OK
</span></span><span class="line"><span class="cl">12 0.025222875 192.168.1.175 → 192.168.2.10 TCP 66 47996 → 80 [ACK] Seq=72 Ack=237 Win=64128 Len=0 ...
</span></span><span class="line"><span class="cl">13 0.025324750 192.168.2.10 → 192.168.1.175 HTTP 99 HTTP/1.1 200 OK  (text/html)
</span></span><span class="line"><span class="cl">14 0.025327875 192.168.1.175 → 192.168.2.10 TCP 66 47996 → 80 [ACK] Seq=72 Ack=270 Win=64128 Len=0 ...
</span></span><span class="line"><span class="cl">15 0.025727375 192.168.1.175 → 192.168.2.10 TCP 66 47996 → 80 [FIN, ACK] Seq=72 Ack=270 Win=64128 Len=0 ...
</span></span><span class="line"><span class="cl">16 0.026296000 192.168.2.10 → 192.168.1.175 TCP 66 80 → 47996 [FIN, ACK] Seq=270 Ack=73 Win=65152 Len=0 ...
</span></span><span class="line"><span class="cl">17 0.026305292 192.168.1.175 → 192.168.2.10 TCP 66 47996 → 80 [ACK] Seq=73 Ack=271 Win=64128 Len=0 ...
</span></span></code></pre></div><p>Twelve frames, four and a half milliseconds, for a 33-byte page. Three open the connection, three carry data
(the request, and the answer in two pieces), three acknowledge that data, and three close it. Most of the packets are TCP
keeping its promises, not carrying the page.</p>
<p><code>47996 → 80</code> is the two <strong>ports</strong>. A port says which program at each end owns the connection. Port 80 is the
web server. 47996 is an <strong>ephemeral port</strong> the laptop picked for this one connection; the next connection gets
a different one. The four numbers together (two addresses, two ports) identify a connection uniquely.</p>
<hr>
<h2 id="the-three-way-handshake">The three-way handshake</h2>
<p>Before any data moves, the two ends agree to talk and tell each other where their numbering starts.</p>
<ol>
<li><strong>SYN</strong> (synchronise), from the laptop: &ldquo;I&rsquo;d like to connect, and my bytes start here.&rdquo;</li>
<li><strong>SYN, ACK</strong>, from web: &ldquo;Agreed. Mine start here, and I&rsquo;ve got your SYN.&rdquo;</li>
<li><strong>ACK</strong>, from the laptop: &ldquo;Got yours.&rdquo;</li>
</ol>
<p>After frame 8, both sides know each other&rsquo;s starting number, and either can send. The time from the SYN to the
final ACK is the <strong>initial round-trip time</strong>. Wireshark calculates it as <code>tcp.analysis.initial_rtt</code> and shows
it on every packet of the stream: here it&rsquo;s 0.56 ms. It&rsquo;s a useful number to have, because every later delay in
the connection can be measured against it.</p>
<hr>
<h2 id="sequence-numbers-raw-and-relative">Sequence numbers: raw and relative</h2>
<p>TCP numbers <strong>bytes</strong>, not packets. Every segment carries two numbers:</p>
<ul>
<li><strong>Seq</strong>: the number of the first byte of data in this segment;</li>
<li><strong>Ack</strong>: the next byte this side expects from the other one. It means &ldquo;I have everything before this&rdquo;.</li>
</ul>
<p>Each side starts at a random <strong>initial sequence number</strong> (ISN), chosen fresh for every connection so that
stray packets from an old connection, or a guess from an attacker, don&rsquo;t land inside a new one. In this capture
the laptop&rsquo;s ISN was 500774591 and web&rsquo;s was 702278227. Those are hard to read, so Wireshark subtracts the ISN
and shows <strong>relative</strong> numbers that start at 0. The raw values are still in the packet as <code>tcp.seq_raw</code> and
<code>tcp.ack_raw</code>. You need them when you compare captures from two points and something in between rewrites
sequence numbers, which some firewalls do.</p>
<p>Now follow the numbers through the connection:</p>
<table>
  <thead>
      <tr>
          <th>Frame</th>
          <th>Who</th>
          <th>Seq</th>
          <th>Ack</th>
          <th>Len</th>
          <th>What it says</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>6</td>
          <td>laptop</td>
          <td>0</td>
          <td></td>
          <td>0</td>
          <td>SYN. A SYN counts as one byte</td>
      </tr>
      <tr>
          <td>7</td>
          <td>web</td>
          <td>0</td>
          <td>1</td>
          <td>0</td>
          <td>&ldquo;your SYN arrived; next I expect byte 1&rdquo;</td>
      </tr>
      <tr>
          <td>9</td>
          <td>laptop</td>
          <td>1</td>
          <td>1</td>
          <td>71</td>
          <td>the HTTP request, bytes 1 to 71</td>
      </tr>
      <tr>
          <td>10</td>
          <td>web</td>
          <td>1</td>
          <td>72</td>
          <td>0</td>
          <td>&ldquo;got all 71; next I expect byte 72&rdquo;</td>
      </tr>
      <tr>
          <td>11</td>
          <td>web</td>
          <td>1</td>
          <td>72</td>
          <td>236</td>
          <td>HTTP headers</td>
      </tr>
      <tr>
          <td>13</td>
          <td>web</td>
          <td>237</td>
          <td>72</td>
          <td>33</td>
          <td>the page itself</td>
      </tr>
      <tr>
          <td>14</td>
          <td>laptop</td>
          <td>72</td>
          <td>270</td>
          <td>0</td>
          <td>&ldquo;got everything up to 269&rdquo;</td>
      </tr>
  </tbody>
</table>
<p><code>Ack=72</code> after a 71-byte request starting at 1 is the whole idea. You can check, packet by packet, exactly
what each side has received. When something goes missing, it shows up as an Ack that stops moving, which is
what <a href="/lessons/wireshark-101/broken-path/">lesson 8</a> is about.</p>
<p>Frames 11 and 13 also show something you&rsquo;ll see a lot: nginx sent its headers and the body in <strong>separate
segments</strong>, 236 bytes and then 33. TCP doesn&rsquo;t care where one HTTP message ends; it carries a stream. Wireshark
reassembles the pieces and shows the complete HTTP response on the last one, frame 13, which is why frame 11&rsquo;s
Protocol column says TCP and not HTTP.</p>
<hr>
<h2 id="the-window-and-the-options-in-the-syn">The window, and the options in the SYN</h2>
<p><strong>Win</strong> is the receive <strong>window</strong>: how many more bytes this side can accept right now, before it needs the
sender to wait. It&rsquo;s flow control. A receiver that&rsquo;s falling behind advertises a smaller window, and a window
of zero means &ldquo;stop&rdquo;.</p>
<p>The window field is only 16 bits, so it can&rsquo;t say more than 65,535 bytes. That&rsquo;s where the SYN&rsquo;s options come
in. A SYN is the only time each side can announce what it supports, and the lab&rsquo;s SYN has four:</p>
<table>
  <thead>
      <tr>
          <th>Option</th>
          <th>In the SYN</th>
          <th>Means</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>MSS</strong></td>
          <td><code>MSS=1460</code></td>
          <td>the biggest chunk of data this side can receive in one segment: a 1,500-byte MTU minus 20 bytes of IP header and 20 of TCP</td>
      </tr>
      <tr>
          <td><strong>SACK_PERM</strong></td>
          <td><code>SACK_PERM</code></td>
          <td>&ldquo;I understand selective acknowledgements&rdquo; (<a href="https://www.rfc-editor.org/rfc/rfc2018">RFC 2018</a>). Used when packets are lost, in lesson 8</td>
      </tr>
      <tr>
          <td><strong>Timestamps</strong></td>
          <td><code>TSval=… TSecr=…</code></td>
          <td>a clock value in every segment, echoed back, for measuring round-trip time (<a href="https://www.rfc-editor.org/rfc/rfc7323">RFC 7323</a>)</td>
      </tr>
      <tr>
          <td><strong>Window scale</strong></td>
          <td><code>WS=128</code></td>
          <td>multiply every later window value by 128 (RFC 7323)</td>
      </tr>
  </tbody>
</table>
<p>Window scaling explains a number that looks wrong at first. Frame 8 says <code>Win=64256</code>, but the raw window field
in the packet is 502. Wireshark saw <code>WS=128</code> in the handshake and did the multiplication: 502 × 128 = 64,256.
It can only do that if it captured the SYNs. Start a capture halfway through a connection and Wireshark doesn&rsquo;t
know the scale factor, so the windows it shows are too small.</p>
<p>Options only count if both sides send them. If one side&rsquo;s SYN has no <code>SACK_PERM</code>, the connection doesn&rsquo;t use
SACK. Comparing the options in the SYN and the SYN-ACK is how you find out what the connection really
negotiated.</p>
<hr>
<h2 id="fin-and-rst-two-ways-to-end">FIN and RST: two ways to end</h2>
<p>A connection closes politely with <strong>FIN</strong> (finish). Each direction closes separately: a FIN means &ldquo;I&rsquo;ve
finished sending&rdquo;, not &ldquo;go away&rdquo;. In the lab, curl had the whole page, so it sent the first FIN (frame 15). web
answered with its own FIN (16), and the laptop acknowledged it (17). A FIN counts as one byte, just like a SYN,
which is why the Ack goes from 72 to 73. Whoever sends the first FIN chose to end the conversation. Here it was
the client, even though nginx had offered <code>Connection: keep-alive</code>.</p>
<p><strong>RST</strong> (reset) is the other way: &ldquo;this connection doesn&rsquo;t exist, stop&rdquo;. No goodbye, no acknowledgement. A RST
mid-connection usually means one side crashed, timed out, or decided something was badly wrong. A RST in answer
to a SYN means something much more specific.</p>
<hr>
<h2 id="refused-versus-no-answer">Refused versus no answer</h2>
<p>Here&rsquo;s the laptop trying port 8080 on web, where nothing listens:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">21 0.071235375 192.168.1.175 → 192.168.2.10 TCP 74 55482 → 8080 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM ...
</span></span><span class="line"><span class="cl">22 0.071316959 192.168.2.10 → 192.168.1.175 TCP 54 8080 → 55482 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
</span></span></code></pre></div><p>Two packets, 0.08 ms apart. web&rsquo;s operating system got a SYN for a port no program has open and answered
straight away with a RST. curl reports <em>Connection refused</em> and stops.</p>
<p>A refusal is good news for troubleshooting. It proves the network path works in both directions, and that
something at the far end is up and answering. The problem is the service: wrong port, program not running,
program listening on a different address.</p>
<p>Compare that with a SYN that gets <strong>no answer at all</strong>. The client can&rsquo;t tell whether the SYN was lost, so it
sends it again, and again, until it gives up. In the lab&rsquo;s broken-path chapter,
the laptop sent the same SYN at 0, 1, 2, 3, 4, 5 and 7 seconds before curl&rsquo;s eight-second limit ran out. From the
application, that&rsquo;s a hang: <em>Connection timed out</em>, eventually.</p>
<table>
  <thead>
      <tr>
          <th>What you see</th>
          <th>What it means</th>
          <th>Where to look</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>SYN, then RST, ACK</td>
          <td>the host is reachable; nothing listens on that port</td>
          <td>the server: is the service running, on that port?</td>
      </tr>
      <tr>
          <td>SYN, SYN again, SYN again…</td>
          <td>something on the path dropped the SYN or the answer</td>
          <td>the network: a filter, a route, a firewall</td>
      </tr>
      <tr>
          <td>SYN, SYN-ACK, then nothing works</td>
          <td>the connection opened; the problem is later</td>
          <td>sizes, the application, lesson 8</td>
      </tr>
  </tbody>
</table>
<p>One caution: a RST proves <em>something</em> answered, not necessarily the server. Some firewalls reject a
connection by sending a RST on the server&rsquo;s behalf. If a refusal makes no sense, capture closer to the server
and see whether the SYN ever arrived.</p>
<hr>
<h2 id="streams-follow-tcp-stream-and-conversations">Streams, Follow TCP Stream and Conversations</h2>
<p>A real capture holds many connections at once. Wireshark numbers each one, in the order it first sees them,
as <code>tcp.stream</code>. In the lab&rsquo;s refused capture, stream 0 is the first page, stream 1 the refused attempt and
stream 2 the page again. The filter <code>tcp.stream == 1</code> shows one connection and nothing else, which is the
fastest way to pull one conversation out of thousands of frames.</p>
<p>Two views build on streams.</p>
<p><strong>Follow › TCP Stream</strong> strips away the packets and shows the bytes each side sent, in order, one color per
side. For plain HTTP that&rsquo;s the request and the response as text:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">GET / HTTP/1.1
</span></span><span class="line"><span class="cl">Host: web.lab
</span></span><span class="line"><span class="cl">User-Agent: curl/8.14.1
</span></span><span class="line"><span class="cl">Accept: */*
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">HTTP/1.1 200 OK
</span></span><span class="line"><span class="cl">Server: nginx/1.28.3
</span></span><span class="line"><span class="cl">Content-Type: text/html
</span></span><span class="line"><span class="cl">Content-Length: 33
</span></span><span class="line"><span class="cl">...
</span></span><span class="line"><span class="cl">Hello from web.lab, 192.168.2.10
</span></span></code></pre></div><p><strong>Statistics › Conversations › TCP</strong> lists every connection in the capture with its addresses, ports, frames,
bytes and duration. For this page: 12 frames and 1,148 bytes, seven frames from the laptop and five from web.
Sort it by bytes and the biggest transfers come to the top. Sort it by duration and the connections that hung
around do.</p>
<hr>
<h2 id="what-i-see-go-wrong">What I see go wrong</h2>
<p><strong>Starting the capture too late.</strong> Without the handshake, Wireshark doesn&rsquo;t know the window scale, the MSS or
the initial RTT, and its analysis is weaker. Start capturing before the connection opens.</p>
<p><strong>Counting packets instead of bytes.</strong> Seq and Ack count bytes. A missing packet shows up as a gap in the byte
numbers, and two segments of very different sizes can carry one HTTP message. Read the numbers, not the
number of lines.</p>
<p><strong>Calling every RST a failure.</strong> A RST answering a SYN is the clearest answer TCP has. It&rsquo;s silence that
should worry you.</p>
<p><strong>Assuming the client closed it.</strong> Whoever sent the first FIN (or the RST) ended the connection. When a
connection &ldquo;drops&rdquo;, check which side did it first. The answer often points straight at a timeout on the other
end.</p>
<hr>
<h2 id="try-it">Try it</h2>
<p><a href="/labs/wireshark-101/#chapter-6">Chapter 6 of the lab</a> has you capture a page load, find the handshake and
the FINs, then pick the refused connection out of three by its stream index.</p>
<h2 id="whats-next">What&rsquo;s next</h2>
<p>The same connection on port 443 starts with a handshake of its own, and most of it is still readable.
<a href="/lessons/wireshark-101/tls-without-decryption/">Lesson 7</a> is about what TLS shows without decrypting
anything, and how to decrypt your own when you need to. Back to <a href="/lessons/wireshark-101/dns/">lesson 5, DNS</a>.</p>
]]></content:encoded></item><item><title>DNS on the Wire: Queries, Answers and the Lookups You Didn't Type (Wireshark 101, Lesson 5)</title><link>https://networkdoodles.com/lessons/wireshark-101/dns/</link><pubDate>Mon, 16 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/wireshark-101/dns/</guid><category>wireshark</category><category>packet-capture</category><category>networking-basics</category><category>dns</category><description>DNS queries and responses in a capture: transaction IDs, flags, NXDOMAIN vs REFUSED, A, AAAA and CNAME records, TTLs, and the search domain's lookups.</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>A DNS lookup on the wire is usually two packets: a <strong>query</strong> sent over UDP to port 53, and a <strong>response</strong> that
copies the question back and adds the answers. A 16-bit <strong>transaction ID</strong> ties the two together. Everything
else you need to read a lookup is in a handful of fields: the flags, the reply code, the records and their
TTLs. And the most useful thing a capture shows you about DNS is often what the computer asked for that you
never typed.</p>
<p><a href="/lessons/networking-101/">Networking 101</a> described DNS as the network&rsquo;s phone book. This lesson opens the
phone book&rsquo;s envelope. Every example comes from the
<a href="/labs/wireshark-101/">Wireshark 101 lab</a>, where a laptop looks up names from a small DNS server two routers
away.</p>
<hr>
<h2 id="what-does-a-dns-query-look-like-in-wireshark">What does a DNS query look like in Wireshark?</h2>
<p>Here are three lookups from the lab: <code>dig</code> asking for <code>web.lab</code>, <code>intranet.lab</code> and <code>nas.lab</code>.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">4 1.186582542 192.168.1.175 → 192.168.2.53 DNS 90 Standard query 0x6aec A web.lab OPT
</span></span><span class="line"><span class="cl">5 1.190101167 192.168.2.53 → 192.168.1.175 DNS 94 Standard query response 0x6aec A web.lab A 192.168.2.10 OPT
</span></span><span class="line"><span class="cl">6 1.240939542 192.168.1.175 → 192.168.2.53 DNS 95 Standard query 0xc2f2 A intranet.lab OPT
</span></span><span class="line"><span class="cl">7 1.241206167 192.168.2.53 → 192.168.1.175 DNS 120 Standard query response 0xc2f2 A intranet.lab CNAME web.lab A 192.168.2.10 OPT
</span></span><span class="line"><span class="cl">8 1.302522250 192.168.1.175 → 192.168.2.53 DNS 90 Standard query 0x822d A nas.lab OPT
</span></span><span class="line"><span class="cl">9 1.303036709 192.168.2.53 → 192.168.1.175 DNS 78 Standard query response 0x822d No such name A nas.lab OPT
</span></span></code></pre></div><p>Six packets, three conversations. Each line tells you most of the story before you open anything: the
transaction ID (<code>0x6aec</code>), the record type asked for (<code>A</code>), the name, and in the response, the answer or the
reason there isn&rsquo;t one.</p>
<h3 id="why-dns-uses-udp-and-what-the-transaction-id-is-for">Why DNS uses UDP, and what the transaction ID is for</h3>
<p><strong>UDP</strong> (User Datagram Protocol) sends one packet and forgets about it. There&rsquo;s no handshake and no
connection, which is exactly what you want for a question that fits in one packet: a lookup costs one round
trip, not three. The price is that UDP doesn&rsquo;t match answers to questions for you.</p>
<p>That&rsquo;s the job of the <strong>transaction ID</strong>, a 16-bit number the client picks at random for each query. The server
copies it into the response, and the client accepts only a response whose ID (and ports) match a question it
asked. <a href="https://www.rfc-editor.org/rfc/rfc1035">RFC 1035</a> defines it. The randomness matters: a predictable ID
makes it easier for someone else to slip in a forged answer first.</p>
<p>Wireshark does the matching for you. Open a response and you&rsquo;ll find <code>[Request In: 4]</code> and
<code>[Time: 3.518625 milliseconds]</code>. That time is <code>dns.time</code>, the gap between question and answer, and it&rsquo;s the
quickest way to find a slow DNS server: filter <code>dns.time &gt; 0.1</code> to see every answer that took longer than 100
ms. In the lab, the first answer took 3.5 ms and the next two under 0.6 ms. A capture on the laptop&rsquo;s cable
can&rsquo;t tell you why the first one was slower. It can only tell you that it was, which is where every
investigation starts.</p>
<hr>
<h2 id="what-do-the-dns-flags-mean">What do the DNS flags mean?</h2>
<p>Every DNS message has a 16-bit flags field. Wireshark shows it as one hex number and then breaks it out bit by
bit. Here&rsquo;s the answer for <code>web.lab</code>:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Flags: 0x8580 Standard query response, No error
</span></span><span class="line"><span class="cl">    1... .... .... .... = Response: Message is a response
</span></span><span class="line"><span class="cl">    .000 0... .... .... = Opcode: Standard query (0)
</span></span><span class="line"><span class="cl">    .... .1.. .... .... = Authoritative: Server is an authority for domain
</span></span><span class="line"><span class="cl">    .... ..0. .... .... = Truncated: Message is not truncated
</span></span><span class="line"><span class="cl">    .... ...1 .... .... = Recursion desired: Do query recursively
</span></span><span class="line"><span class="cl">    .... .... 1... .... = Recursion available: Server can do recursive queries
</span></span><span class="line"><span class="cl">    .... .... .... 0000 = Reply code: No error (0)
</span></span></code></pre></div><table>
  <thead>
      <tr>
          <th>Flag</th>
          <th>Set by</th>
          <th>Means</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>QR</strong> (Response)</td>
          <td>both</td>
          <td>0 in a query, 1 in a response. Filter <code>dns.flags.response == 0</code> for questions only</td>
      </tr>
      <tr>
          <td><strong>AA</strong> (Authoritative)</td>
          <td>server</td>
          <td>&ldquo;I own this name. This answer comes from my own data, not from a cache&rdquo;</td>
      </tr>
      <tr>
          <td><strong>TC</strong> (Truncated)</td>
          <td>server</td>
          <td>&ldquo;the full answer didn&rsquo;t fit; ask again over TCP&rdquo;</td>
      </tr>
      <tr>
          <td><strong>RD</strong> (Recursion desired)</td>
          <td>client</td>
          <td>&ldquo;if you don&rsquo;t know, go and find out for me&rdquo;</td>
      </tr>
      <tr>
          <td><strong>RA</strong> (Recursion available)</td>
          <td>server</td>
          <td>&ldquo;I&rsquo;m willing to do that&rdquo;</td>
      </tr>
  </tbody>
</table>
<p>The two recursion flags describe the two kinds of DNS server. A <strong>recursive resolver</strong> (your home router, your
company&rsquo;s DNS servers, a public resolver) takes your question and chases it across the internet for you. An
<strong>authoritative server</strong> holds the records for a zone and only answers for those. The lab&rsquo;s server is a small
<code>dnsmasq</code> that does a bit of both, which is why its answer for <code>web.lab</code> has AA and RA set at once.</p>
<p>Notice that the answer for <code>nas.lab</code> came back with flags <code>0x8183</code>: AA is <strong>off</strong>. The server is saying &ldquo;no
such name&rdquo; without claiming to be the authority for it. Small details like that tell you what kind of server
you&rsquo;re talking to.</p>
<hr>
<h2 id="nxdomain-refused-servfail-what-does-each-reply-code-tell-you">NXDOMAIN, REFUSED, SERVFAIL: what does each reply code tell you?</h2>
<p>The last four bits of the flags are the <strong>reply code</strong> (rcode). It&rsquo;s the server&rsquo;s one-word verdict on your
question, and it&rsquo;s worth more than anything else in the packet when a lookup fails.</p>
<table>
  <thead>
      <tr>
          <th>rcode</th>
          <th>Name</th>
          <th>Wireshark shows</th>
          <th>What it tells you</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>0</td>
          <td>NOERROR</td>
          <td>No error</td>
          <td>the server answered. It may still have no records of the type you asked for</td>
      </tr>
      <tr>
          <td>2</td>
          <td>SERVFAIL</td>
          <td>Server failure</td>
          <td>the server tried and couldn&rsquo;t get an answer: often a broken upstream or a DNSSEC failure</td>
      </tr>
      <tr>
          <td>3</td>
          <td>NXDOMAIN</td>
          <td>No such name</td>
          <td>the name doesn&rsquo;t exist. The server is sure</td>
      </tr>
      <tr>
          <td>5</td>
          <td>REFUSED</td>
          <td>Refused</td>
          <td>the server won&rsquo;t answer this question for you, by policy</td>
      </tr>
  </tbody>
</table>
<p>The difference between NXDOMAIN and REFUSED is the difference between &ldquo;the name is wrong&rdquo; and &ldquo;you asked the
wrong server&rdquo;. NXDOMAIN is about the <strong>name</strong>: check the spelling, the domain, the record. REFUSED is about
the <strong>server</strong>: it isn&rsquo;t configured to answer that question, or to answer you. A capture tells them apart in
one glance, while most applications report both as the same vague &ldquo;host not found&rdquo;.</p>
<p>One code that catches people out is NOERROR with an empty answer section. It means the name exists but has no
record of the type you asked for, such as a name with an IPv4 address and no IPv6 one.
<a href="https://www.rfc-editor.org/rfc/rfc2308">RFC 2308</a> calls this NODATA. It isn&rsquo;t an error, even though nothing
useful came back.</p>
<hr>
<h2 id="a-aaaa-and-cname-records">A, AAAA and CNAME records</h2>
<p>An answer is a list of <strong>resource records</strong>. Each has a name, a type, a class (always <code>IN</code>, for internet), a
<strong>TTL</strong> and a value.</p>
<table>
  <thead>
      <tr>
          <th>Type</th>
          <th>Value</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>A</strong></td>
          <td>an IPv4 address, 4 bytes</td>
      </tr>
      <tr>
          <td><strong>AAAA</strong></td>
          <td>an IPv6 address, 16 bytes</td>
      </tr>
      <tr>
          <td><strong>CNAME</strong></td>
          <td>another name: &ldquo;this name is an alias; the real one is over there&rdquo;</td>
      </tr>
  </tbody>
</table>
<p>The <code>intranet.lab</code> response shows a CNAME at work:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Answers
</span></span><span class="line"><span class="cl">    intranet.lab: type CNAME, class IN, cname web.lab
</span></span><span class="line"><span class="cl">        Time to live: 60 (1 minute)
</span></span><span class="line"><span class="cl">    web.lab: type A, class IN, addr 192.168.2.10
</span></span><span class="line"><span class="cl">        Time to live: 60 (1 minute)
</span></span></code></pre></div><p>Two records in one response. The server didn&rsquo;t just say &ldquo;it&rsquo;s really web.lab, go and ask about that&rdquo;. It
followed the alias itself and put web.lab&rsquo;s address in the same packet, so the laptop got its answer in one
round trip. That&rsquo;s why the response is 120 bytes and web.lab&rsquo;s alone is 94.</p>
<p>CNAMEs are everywhere on the real internet. A company&rsquo;s <code>www</code> name is often a CNAME for a content delivery
network&rsquo;s name, which can be a CNAME for another. A chain of three or four aliases in one response is normal.
When a site resolves to an address you didn&rsquo;t expect, the CNAME chain in the response is the first thing to
read.</p>
<hr>
<h2 id="how-long-can-an-answer-be-cached-ttl">How long can an answer be cached? TTL</h2>
<p>The <strong>TTL</strong> (time to live) on each record is the number of seconds the answer may be kept and reused before
asking again. It has nothing to do with the TTL field in the IP header, which counts router hops. Same name,
different job.</p>
<p>TTLs are a trade-off. A low TTL means a change (a new server address, a failover) reaches everyone quickly,
at the cost of more lookups. A high TTL means fewer lookups and faster page loads, and a change that takes
hours to reach everyone. The lab&rsquo;s server hands out 60 seconds for everything.</p>
<p>Now the part that confuses people with their first DNS capture: <strong>caching happens off the wire</strong>. Windows,
macOS and most Linux desktops keep a local cache, and browsers keep their own on top. If the answer is cached,
the second lookup never leaves the machine, and your capture shows nothing at all. That&rsquo;s not a failure to
capture. It&rsquo;s the cache doing its job. To see a lookup, clear the cache first, or capture on a host that
doesn&rsquo;t have one.</p>
<p>The lab&rsquo;s hosts don&rsquo;t cache. They&rsquo;re small Alpine Linux machines with no caching service, so every lookup goes
on the wire, every time. That&rsquo;s handy for learning, and it&rsquo;s worth remembering that your laptop at work
behaves differently.</p>
<p>Negative answers can be cached too. RFC 2308 has an authoritative server send its zone&rsquo;s SOA record (the
zone&rsquo;s &ldquo;start of authority&rdquo;, with its timers) along with an NXDOMAIN, and that record says how long the &ldquo;no&rdquo;
may be kept. The lab&rsquo;s NXDOMAIN carries no SOA at all: <code>Authority RRs: 0</code>.</p>
<hr>
<h2 id="what-is-the-opt-record-on-the-end-of-every-line">What is the OPT record on the end of every line?</h2>
<p>Every <code>dig</code> query and answer in the lab ends with <code>OPT</code>. That&rsquo;s <strong>EDNS</strong> (Extension Mechanisms for DNS,
<a href="https://www.rfc-editor.org/rfc/rfc6891">RFC 6891</a>). The original DNS limited a UDP answer to 512 bytes. EDNS
adds a pseudo-record, type OPT (41), to the additional section, where the client says how big an answer it can
take, and leaves room for options:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">&lt;Root&gt;: type OPT
</span></span><span class="line"><span class="cl">    UDP payload size: 1232
</span></span><span class="line"><span class="cl">    EDNS0 version: 0
</span></span><span class="line"><span class="cl">    Option: COOKIE
</span></span></code></pre></div><p>dig offers 1,232 bytes and adds a DNS cookie, a small token that helps a server tell a real client from a
spoofed one. None of it is part of the answer. If an answer is still too big, the server sets the TC flag and
the client asks again over TCP.</p>
<hr>
<h2 id="why-did-one-short-name-cause-six-queries">Why did one short name cause six queries?</h2>
<p><code>dig</code> asks exactly what you tell it. Almost nothing else does. Ping, curl, your browser and your mail client
ask the operating system&rsquo;s <strong>resolver</strong>, the library code that does lookups for programs, and the resolver
has its own ideas.</p>
<p>In the lab, the laptop got its resolver settings from DHCP (lesson 4):</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">search lab
</span></span><span class="line"><span class="cl">nameserver 192.168.2.53
</span></span></code></pre></div><p><code>nameserver</code> came from DHCP option 6. <code>search lab</code> is the <strong>search domain</strong>, from option 15: when a name looks
short, try it with <code>.lab</code> on the end. The rule for &ldquo;short&rdquo; is <code>ndots</code>, which defaults to 1 (see the
<a href="https://man7.org/linux/man-pages/man5/resolv.conf.5.html">resolv.conf man page</a>): a name with fewer dots than
that gets the search list tried first.</p>
<p>So here&rsquo;s what the laptop sent when it ran <code>ping nas</code>:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl"> 3 0.219553792 192.168.1.175 → 192.168.2.53 DNS 67 Standard query 0xc991 A nas.lab
</span></span><span class="line"><span class="cl"> 4 0.220102917 192.168.1.175 → 192.168.2.53 DNS 67 Standard query 0xcb5b AAAA nas.lab
</span></span><span class="line"><span class="cl"> 5 0.221055167 192.168.2.53 → 192.168.1.175 DNS 67 Standard query response 0xc991 No such name A nas.lab
</span></span><span class="line"><span class="cl"> 6 0.221235334 192.168.2.53 → 192.168.1.175 DNS 67 Standard query response 0xcb5b No such name AAAA nas.lab
</span></span><span class="line"><span class="cl"> 7 0.221357750 192.168.1.175 → 192.168.2.53 DNS 63 Standard query 0x968f A nas
</span></span><span class="line"><span class="cl"> 8 0.221519209 192.168.1.175 → 192.168.2.53 DNS 63 Standard query 0x97b8 AAAA nas
</span></span><span class="line"><span class="cl"> 9 0.221737250 192.168.2.53 → 192.168.1.175 DNS 63 Standard query response 0x968f Refused A nas
</span></span><span class="line"><span class="cl">10 0.221890417 192.168.2.53 → 192.168.1.175 DNS 63 Standard query response 0x97b8 Refused AAAA nas
</span></span><span class="line"><span class="cl">13 2.729063751 192.168.1.175 → 192.168.2.53 DNS 63 Standard query 0x968f A nas
</span></span><span class="line"><span class="cl">14 2.729521918 192.168.1.175 → 192.168.2.53 DNS 63 Standard query 0x97b8 AAAA nas
</span></span><span class="line"><span class="cl">15 2.730466668 192.168.2.53 → 192.168.1.175 DNS 63 Standard query response 0x968f Refused A nas
</span></span><span class="line"><span class="cl">16 2.730674918 192.168.2.53 → 192.168.1.175 DNS 63 Standard query response 0x97b8 Refused AAAA nas
</span></span></code></pre></div><p>Read it in four steps:</p>
<ol>
<li><strong>The search domain first.</strong> <code>nas</code> has no dots, so the resolver tried <code>nas.lab</code> before <code>nas</code>.</li>
<li><strong>A and AAAA, side by side.</strong> The resolver doesn&rsquo;t know whether the program wants IPv4 or IPv6, so it asks
for both at once, two queries per name, even on a network where nobody uses IPv6.</li>
<li><strong>The bare name.</strong> <code>nas.lab</code> was NXDOMAIN, so it tried plain <code>nas</code>. The lab&rsquo;s server only answers for names
under <code>lab</code> and has nowhere else to ask, so it refused.</li>
<li><strong>A retry.</strong> 2.5 seconds later the resolver sent the same two questions again, with the <strong>same transaction
IDs</strong> (<code>0x968f</code>, <code>0x97b8</code>), got refused again, and gave up.</li>
</ol>
<p>Six queries and two and a half seconds, for one word. Ping just said <code>Try again</code>.</p>
<p>Two more things in that listing are worth noticing. The queries are 67 and 63 bytes, against 90 for dig&rsquo;s,
because the laptop&rsquo;s resolver (Alpine&rsquo;s C library, musl) sends no OPT record at all. Different clients send
different DNS, and that&rsquo;s one reason &ldquo;it works with dig&rdquo; doesn&rsquo;t prove an application&rsquo;s lookup will work. And
the retry reused its transaction IDs, which is how you can tell a retry from a new lookup at a glance.</p>
<hr>
<h2 id="what-you-wont-see-in-a-capture">What you won&rsquo;t see in a capture</h2>
<p>Plain DNS over UDP port 53 is the easy case. Three others show up less clearly, or not at all:</p>
<table>
  <thead>
      <tr>
          <th>Transport</th>
          <th>What the capture shows</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>DNS over TCP, port 53 (<a href="https://www.rfc-editor.org/rfc/rfc7766">RFC 7766</a>)</td>
          <td>a normal TCP connection carrying DNS. Wireshark decodes it. Used after a truncated answer, and for zone transfers</td>
      </tr>
      <tr>
          <td>DNS over TLS, port 853 (<a href="https://www.rfc-editor.org/rfc/rfc7858">RFC 7858</a>)</td>
          <td>a TLS connection to port 853. You can see that DNS happened, not what was asked</td>
      </tr>
      <tr>
          <td>DNS over HTTPS (<a href="https://www.rfc-editor.org/rfc/rfc8484">RFC 8484</a>)</td>
          <td>HTTPS on port 443, like any other web traffic. Nothing marks it as DNS</td>
      </tr>
  </tbody>
</table>
<p>The last one matters for troubleshooting. A browser that uses DNS over HTTPS doesn&rsquo;t ask the resolver in
<code>resolv.conf</code> at all, so a capture filtered on <code>dns</code> stays empty while pages load fine. If you see no DNS and
expected some, ask whether the application is doing its own. <a href="/lessons/wireshark-101/tls-without-decryption/">Lesson 7</a>
covers what an encrypted connection still shows.</p>
<hr>
<h2 id="what-i-see-go-wrong">What I see go wrong</h2>
<p><strong>&ldquo;DNS is slow&rdquo; that&rsquo;s really the search list.</strong> A short or mistyped name that walks the search list, gets
refused or times out, and retries, can cost seconds before the application gives up or falls back. From the
application it looks like a slow network. In a capture, it&rsquo;s a run of queries for names nobody typed. Count
the queries a single lookup causes before blaming the server.</p>
<p><strong>Reading only the first answer.</strong> Wireshark&rsquo;s Info column shows the answers in order, and the first one is
often a CNAME. The address you care about is at the end of the chain.</p>
<p><strong>Treating REFUSED like NXDOMAIN.</strong> They send you to different places. NXDOMAIN: fix the name or the record.
REFUSED: fix which server is asked, or what that server is allowed to answer.</p>
<p><strong>Expecting every lookup on the wire.</strong> A cached answer never leaves the machine. An empty capture right after
a successful lookup usually means the cache worked, not that capturing failed.</p>
<p><strong>Forgetting AAAA.</strong> Hosts ask for both. A broken or slow AAAA answer can delay an application that only ever
uses IPv4, because it waits for both answers before it connects.</p>
<hr>
<h2 id="try-it">Try it</h2>
<p><a href="/labs/wireshark-101/#chapter-5">Chapter 5 of the lab</a> has you capture three lookups, read an address, a TTL,
an alias and a name that doesn&rsquo;t exist, then count what one short name really costs.</p>
<h2 id="whats-next">What&rsquo;s next</h2>
<p>Once the laptop has an address for <code>web.lab</code>, it opens a connection to it.
<a href="/lessons/wireshark-101/tcp/">Lesson 6</a> follows that connection from the first SYN to the last FIN.</p>
]]></content:encoded></item><item><title>DHCP on the Wire: How a Host Gets an Address (Wireshark 101, Lesson 4)</title><link>https://networkdoodles.com/lessons/wireshark-101/dhcp/</link><pubDate>Mon, 16 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/wireshark-101/dhcp/</guid><category>wireshark</category><category>packet-capture</category><category>networking-basics</category><category>dhcp</category><description>DHCP's four messages in a capture, the options that matter, leases and renewal, and how a relay turns a broadcast into unicast with giaddr in it.</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>DHCP, the Dynamic Host Configuration Protocol, gives a host its address and everything else it needs to use
the network, in four messages: <strong>Discover</strong>, <strong>Offer</strong>, <strong>Request</strong>, <strong>ACK</strong>. The first is sent before the
host has any address, from <code>0.0.0.0</code> to <code>255.255.255.255</code>. The address is only ever <strong>leased</strong>, so the host
renews it, directly with the server, before the lease runs out. And because routers don&rsquo;t pass broadcasts on,
a router acting as a <strong>DHCP relay</strong> carries those messages to a server on another network, writing its own
address into them so the server knows which network the client is on.</p>
<p>Networking 101&rsquo;s <a href="/lessons/networking-101/task-4-1/">DHCP lesson</a> walked through DORA as an animation. This
lesson is the same story in real packets from the lab, where the DHCP server is two hops away from the laptop
and r1 relays every message.</p>
<hr>
<h2 id="how-does-a-host-send-anything-without-an-address">How does a host send anything without an address?</h2>
<p>It cheats, politely. A host that has no IP address still has a MAC address, and it can still send an IP
packet: it just has to make up the addresses. The <strong>Discover</strong> goes:</p>
<ul>
<li><strong>from</strong> <code>0.0.0.0</code>, which means <em>this host, no address yet</em>;</li>
<li><strong>to</strong> <code>255.255.255.255</code>, the <strong>limited broadcast</strong>: everyone on this network;</li>
<li>in an Ethernet frame to <code>ff:ff:ff:ff:ff:ff</code>, the broadcast MAC address;</li>
<li>over UDP, from port <strong>68</strong> (the client&rsquo;s port) to port <strong>67</strong> (the server&rsquo;s).</li>
</ul>
<p>Here are the DHCP frames of the lab&rsquo;s capture, taken on the laptop&rsquo;s cable:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">    6 0.613249583 192.168.1.175 → 192.168.2.53 DHCP 342 DHCP Release  - Transaction ID 0x54c3a747
</span></span><span class="line"><span class="cl">    7 2.240006876      0.0.0.0 → 255.255.255.255 DHCP 342 DHCP Discover - Transaction ID 0xd9e69210
</span></span><span class="line"><span class="cl">    8 2.246596042  192.168.1.1 → 192.168.1.175 DHCP 342 DHCP Offer    - Transaction ID 0xd9e69210
</span></span><span class="line"><span class="cl">    9 2.273590042      0.0.0.0 → 255.255.255.255 DHCP 342 DHCP Request  - Transaction ID 0xd9e69210
</span></span><span class="line"><span class="cl">   10 2.281617209  192.168.1.1 → 192.168.1.175 DHCP 347 DHCP ACK      - Transaction ID 0xd9e69210
</span></span></code></pre></div><p>The lab makes the laptop give its address back first (the Release in frame 6, more on that below), then ask
for a new one. Frames 7 to 10 are DORA. From Discover to ACK took 41.6 milliseconds.</p>
<p>The four messages share one <strong>transaction ID</strong>, <code>0xd9e69210</code>: a random number the client picks for each
exchange. Every answer carries it back. On a network where twenty laptops boot at once, it&rsquo;s how each one
picks its own answers out of the broadcast noise, and in Wireshark it&rsquo;s how you pick one client&rsquo;s exchange out
of a busy capture: filter <code>dhcp.id == 0xd9e69210</code>.</p>
<table>
  <thead>
      <tr>
          <th></th>
          <th>Message</th>
          <th>IP from → to</th>
          <th>What it says</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>D</strong></td>
          <td>Discover</td>
          <td><code>0.0.0.0</code> → <code>255.255.255.255</code></td>
          <td><em>I need an address. Any servers out there?</em></td>
      </tr>
      <tr>
          <td><strong>O</strong></td>
          <td>Offer</td>
          <td>server (here, the relay) → offered address</td>
          <td><em>You can have 192.168.1.175, with these settings</em></td>
      </tr>
      <tr>
          <td><strong>R</strong></td>
          <td>Request</td>
          <td><code>0.0.0.0</code> → <code>255.255.255.255</code></td>
          <td><em>I&rsquo;ll take 192.168.1.175, from server 192.168.2.53</em></td>
      </tr>
      <tr>
          <td><strong>A</strong></td>
          <td>ACK</td>
          <td>server (the relay) → the address</td>
          <td><em>It&rsquo;s yours, for 600 seconds</em></td>
      </tr>
  </tbody>
</table>
<p>Why is the Request still a broadcast, when the laptop already knows the server? Because more than one server
may have made an offer. The Request names the one the laptop chose (option 54, the server identifier) and
the address it&rsquo;s taking (option 50), and broadcasting it tells <em>every</em> server at once: the chosen one
confirms, and the others can put their offered addresses back.</p>
<p>The Offer and ACK go to the offered address directly, not to everyone. The laptop&rsquo;s Discover had its
<strong>broadcast flag</strong> set to 0, which tells the server the client can receive a unicast before its address is
configured. A client that can&rsquo;t would set it to 1, and the answers would be broadcast.</p>
<hr>
<h2 id="which-dhcp-options-matter">Which DHCP options matter?</h2>
<p>The address itself is in a fixed field near the top of the message, <strong>Your (client) IP address</strong>. Everything
else is an <strong>option</strong>: a numbered setting with a length and a value. The numbers come from
<a href="https://www.rfc-editor.org/rfc/rfc2132">RFC 2132</a>, and they&rsquo;re worth learning, because Wireshark shows them
by number. Here&rsquo;s the lab&rsquo;s Offer:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Dynamic Host Configuration Protocol (Offer)
</span></span><span class="line"><span class="cl">    Message type: Boot Reply (2)
</span></span><span class="line"><span class="cl">    Hops: 1
</span></span><span class="line"><span class="cl">    Transaction ID: 0xd9e69210
</span></span><span class="line"><span class="cl">    Your (client) IP address: 192.168.1.175
</span></span><span class="line"><span class="cl">    Relay agent IP address: 192.168.1.1
</span></span><span class="line"><span class="cl">    Client MAC address: aa:aa:aa:11:11:11 (aa:aa:aa:11:11:11)
</span></span><span class="line"><span class="cl">    Option: (53) DHCP Message Type (Offer)
</span></span><span class="line"><span class="cl">    Option: (54) DHCP Server Identifier (192.168.2.53)
</span></span><span class="line"><span class="cl">    Option: (51) IP Address Lease Time
</span></span><span class="line"><span class="cl">        IP Address Lease Time: 10 minutes (600)
</span></span><span class="line"><span class="cl">    Option: (58) Renewal Time Value
</span></span><span class="line"><span class="cl">        Renewal Time Value: 5 minutes (300)
</span></span><span class="line"><span class="cl">    Option: (59) Rebinding Time Value
</span></span><span class="line"><span class="cl">        Rebinding Time Value: 8 minutes, 45 seconds (525)
</span></span><span class="line"><span class="cl">    Option: (1) Subnet Mask (255.255.255.0)
</span></span><span class="line"><span class="cl">    Option: (15) Domain Name
</span></span><span class="line"><span class="cl">        Domain Name: lab
</span></span><span class="line"><span class="cl">    Option: (6) Domain Name Server
</span></span><span class="line"><span class="cl">        Domain Name Server: 192.168.2.53
</span></span><span class="line"><span class="cl">    Option: (3) Router
</span></span><span class="line"><span class="cl">        Router: 192.168.1.1
</span></span></code></pre></div><p>(Some lines left out.) The ones to know:</p>
<table>
  <thead>
      <tr>
          <th>Option</th>
          <th>Name</th>
          <th>Lab value</th>
          <th>Why it matters</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>53</strong></td>
          <td>DHCP Message Type</td>
          <td>Offer</td>
          <td>which of the messages this is: Wireshark&rsquo;s summary comes from it</td>
      </tr>
      <tr>
          <td><strong>54</strong></td>
          <td>Server Identifier</td>
          <td><code>192.168.2.53</code></td>
          <td>the real server, whoever delivered the message</td>
      </tr>
      <tr>
          <td><strong>51</strong></td>
          <td>Lease Time</td>
          <td>600 s</td>
          <td>how long the address is lent for</td>
      </tr>
      <tr>
          <td><strong>58</strong></td>
          <td>Renewal Time (T1)</td>
          <td>300 s</td>
          <td>when to start renewing</td>
      </tr>
      <tr>
          <td><strong>59</strong></td>
          <td>Rebinding Time (T2)</td>
          <td>525 s</td>
          <td>when to ask any server, if the first won&rsquo;t answer</td>
      </tr>
      <tr>
          <td><strong>1</strong></td>
          <td>Subnet Mask</td>
          <td><code>255.255.255.0</code></td>
          <td>which addresses are neighbors (ARP) and which go to the gateway</td>
      </tr>
      <tr>
          <td><strong>3</strong></td>
          <td>Router</td>
          <td><code>192.168.1.1</code></td>
          <td>the default gateway</td>
      </tr>
      <tr>
          <td><strong>6</strong></td>
          <td>DNS Server</td>
          <td><code>192.168.2.53</code></td>
          <td>where to send name lookups</td>
      </tr>
      <tr>
          <td><strong>15</strong></td>
          <td>Domain Name</td>
          <td><code>lab</code></td>
          <td>added to short names, so <code>web</code> becomes <code>web.lab</code></td>
      </tr>
  </tbody>
</table>
<p>The client has its own say, too. Its Discover carries option <strong>55</strong>, the Parameter Request List: the
options it wants. The lab&rsquo;s laptop asks for 1, 3, 6, 12, 15, 28 and 42. A server only has to send what it has,
and a missing option is a common reason a host &ldquo;has an address but can&rsquo;t reach anything&rdquo;: no option 3, no
gateway.</p>
<p>Every setting the laptop has, apart from its MAC address, came from those few hundred bytes. When a host&rsquo;s
network settings look wrong, the Offer and the ACK are the first place to look, because they&rsquo;re the only
record of what it was told.</p>
<hr>
<h2 id="how-do-leases-and-renewal-work">How do leases and renewal work?</h2>
<p>An address is lent, not given. <a href="https://www.rfc-editor.org/rfc/rfc2131">RFC 2131</a>, the DHCP standard, gives
the client two timers, and the lab&rsquo;s numbers show its defaults exactly:</p>
<table>
  <thead>
      <tr>
          <th>Time</th>
          <th>Lab value</th>
          <th>Share of the lease</th>
          <th>What the client does</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>T1</strong>, renewal</td>
          <td>300 s</td>
          <td>50%</td>
          <td>sends a Request <strong>unicast</strong> to the server that gave the lease</td>
      </tr>
      <tr>
          <td><strong>T2</strong>, rebinding</td>
          <td>525 s</td>
          <td>87.5%</td>
          <td>no answer yet: broadcasts a Request to any server</td>
      </tr>
      <tr>
          <td>lease end</td>
          <td>600 s</td>
          <td>100%</td>
          <td>still no answer: stops using the address</td>
      </tr>
  </tbody>
</table>
<p>The renewal is the interesting one on the wire. By T1 the client has an address and knows the server&rsquo;s
(option 54), so it sends an ordinary unicast packet, from its own address to the server&rsquo;s, routed like any
other traffic. No broadcast, no relay. If you capture a renewal, it looks nothing like DORA: one Request and one
ACK, with real addresses on both.</p>
<p>Ten minutes is a short lease. It suits a lab where you want to watch a renewal, and networks where devices
come and go quickly. Longer leases mean fewer renewals and a pool that empties more slowly when devices leave
without saying goodbye.</p>
<h3 id="release">Release</h3>
<p>A client that&rsquo;s leaving can hand the address back with a <strong>Release</strong>, and the lab&rsquo;s capture starts with one.
Frame 6 goes from the laptop&rsquo;s address, <code>192.168.1.175</code>, to the server&rsquo;s, <code>192.168.2.53</code>: unicast, like a
renewal. Just before it, the laptop sent an ARP request for <code>192.168.1.1</code>. The server is on another network,
so the Release went to the gateway&rsquo;s MAC address like any other routed packet (that&rsquo;s
<a href="/lessons/wireshark-101/arp/">lesson 3</a>&rsquo;s rule at work). A Release is optional (RFC 2131 says a client <em>may</em>
send one), and a device that&rsquo;s simply unplugged can&rsquo;t send one at all. That&rsquo;s why the lease time, not the
Release, is what really frees addresses.</p>
<hr>
<h2 id="why-do-dhcp-broadcasts-need-a-relay">Why do DHCP broadcasts need a relay?</h2>
<p>Because the Discover is a broadcast, and <strong>routers don&rsquo;t forward broadcasts</strong>. That&rsquo;s the point of a router,
and it&rsquo;s what keeps a broadcast domain to one network (Networking 101&rsquo;s
<a href="/lessons/networking-101/task-2-2/">lesson on domains</a>). Without help, every network would need its own DHCP
server.</p>
<p>Real networks don&rsquo;t work like that. A company with dozens of offices runs a handful of DHCP servers in its data
centers. What connects them is the <strong>DHCP relay</strong>: the router on the client&rsquo;s network listens for DHCP
broadcasts and passes each one on to a server, as a unicast packet that can be routed anywhere.</p>
<p>On Cisco-style routers, CapeOS included, one line on the client-facing interface turns it on. Here&rsquo;s r1&rsquo;s:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">interface GigabitEthernet1
</span></span><span class="line"><span class="cl"> description home network (sw1)
</span></span><span class="line"><span class="cl"> ip address 192.168.1.1 255.255.255.0
</span></span><span class="line"><span class="cl"> ip helper-address 192.168.2.53
</span></span></code></pre></div><p><code>ip helper-address 192.168.2.53</code> means: <em>DHCP broadcasts that arrive here, send to 192.168.2.53</em>.</p>
<hr>
<h2 id="what-does-a-relayed-discover-look-like">What does a relayed Discover look like?</h2>
<p>The lab captures both sides of r1 at once: its home side (sw1&rsquo;s port towards r1) and its side towards r2. Here
are the first DHCP frames, as frame, interface, IP source and destination, UDP ports, hops, the relay address
and the summary:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">7	sw1:eth1	0.0.0.0	255.255.255.255	68	67	0	0.0.0.0	DHCP Discover - Transaction ID 0x5fc77b2d
</span></span><span class="line"><span class="cl">8	r1:eth2	192.168.1.1	192.168.2.53	67	67	1	192.168.1.1	DHCP Discover - Transaction ID 0x5fc77b2d
</span></span><span class="line"><span class="cl">9	r1:eth2	192.168.2.53	192.168.1.1	67	67	1	192.168.1.1	DHCP Offer    - Transaction ID 0x5fc77b2d
</span></span><span class="line"><span class="cl">10	sw1:eth1	192.168.1.1	192.168.1.175	67	68	1	192.168.1.1	DHCP Offer    - Transaction ID 0x5fc77b2d
</span></span></code></pre></div><p>It&rsquo;s a different exchange from the one above, so a different transaction ID, but one ID throughout: one
conversation, carried in two hops. Follow the Discover through r1:</p>
<table>
  <thead>
      <tr>
          <th></th>
          <th>On the home network (<code>sw1:eth1</code>)</th>
          <th>After r1 (<code>r1:eth2</code>)</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>IP source</td>
          <td><code>0.0.0.0</code></td>
          <td><code>192.168.1.1</code>, r1</td>
      </tr>
      <tr>
          <td>IP destination</td>
          <td><code>255.255.255.255</code></td>
          <td><code>192.168.2.53</code>, the server</td>
      </tr>
      <tr>
          <td>UDP ports</td>
          <td>68 → 67</td>
          <td>67 → 67</td>
      </tr>
      <tr>
          <td>Hops</td>
          <td>0</td>
          <td>1</td>
      </tr>
      <tr>
          <td>Relay agent IP address (giaddr)</td>
          <td><code>0.0.0.0</code></td>
          <td><code>192.168.1.1</code></td>
      </tr>
  </tbody>
</table>
<p>r1 didn&rsquo;t forward the broadcast. It received it, and sent a <strong>new</strong> packet with the same DHCP message inside,
changed in two places. It added one to <strong>hops</strong>, a counter that stops messages being relayed in circles. And
it wrote its own address on the receiving interface into the <strong>Relay agent IP address</strong> field, which RFC 2131
calls <strong>giaddr</strong> (<em>gateway IP address</em>).</p>
<h3 id="how-giaddr-picks-the-pool">How giaddr picks the pool</h3>
<p>giaddr is the most important field in a relayed message. The server can&rsquo;t tell where the client is from the
packet&rsquo;s source: the client has no address, and the packet arrived from r1 anyway. giaddr tells it: <em>this
client is on the network where 192.168.1.1 lives</em>. The server finds the range that contains that address and
offers from it.</p>
<p>The lab&rsquo;s DHCP server, dnsmasq on the dns host, isn&rsquo;t on <code>192.168.1.0/24</code> at all. It has one range, for that
network, <code>192.168.1.100</code> to <code>192.168.1.199</code>, and it picks that range because giaddr is <code>192.168.1.1</code>. The
laptop got <code>192.168.1.175</code>.</p>
<h3 id="why-the-offer-comes-from-the-relay">Why the Offer comes from the relay</h3>
<p>The server sends its answer back to giaddr, to UDP port 67 on the relay (frame 9). r1 then delivers it on the
home network, from its own address, <code>192.168.1.1</code>, to the client (frame 10). So the laptop only ever talks to
r1: its Offer and ACK arrive <strong>from 192.168.1.1</strong>, while option 54 inside them names the real server,
<code>192.168.2.53</code>.</p>
<p>That&rsquo;s not a contradiction, and it&rsquo;s useful. The IP source tells you who delivered the message. Option 54
tells you who made the decision. When something&rsquo;s wrong with what a client was given, option 54 is the
server whose logs you need.</p>
<hr>
<h2 id="what-i-see-go-wrong">What I see go wrong</h2>
<p><strong>DHCP works on one network and not another.</strong> Nearly always a relay problem. Capture both sides of the
router. No relayed copy on the server side means the router isn&rsquo;t relaying: a missing <code>ip helper-address</code>, or
one on the wrong interface. A relayed copy with no answer means the server has no range for that giaddr, or
something between the relay and the server blocks UDP port 67.</p>
<p><strong>Two servers answering.</strong> A second DHCP server on the network, often a home router or a test box plugged into
the wrong port, sends Offers too. In a capture that&rsquo;s two Offers with the same transaction ID and different
option 54 values. Clients take whichever they like, and some of them end up with the wrong gateway or DNS server.
Filter <code>dhcp.option.dhcp == 2</code> and look at the server identifiers.</p>
<p><strong>A client with an address and no connectivity.</strong> Read the ACK. A missing or wrong option 3 (no gateway) or 6
(no DNS server) explains it before you touch anything else.</p>
<p><strong>Discovers with no Offer at all.</strong> The pool may be full, especially with long leases and a lot of
short-lived devices. The client keeps sending Discovers, each with a new transaction ID. Many operating
systems then give themselves a link-local address from <code>169.254.0.0/16</code>
(<a href="https://www.rfc-editor.org/rfc/rfc3927">RFC 3927</a>), which is a reliable sign that DHCP failed.</p>
<p><strong>Expecting to see renewals in a broadcast capture.</strong> Renewals are unicast to the server. A capture on another
host&rsquo;s switch port won&rsquo;t show them. A capture on the client&rsquo;s cable, or near the server, will.</p>
<hr>
<h2 id="try-it">Try it</h2>
<p><a href="/labs/wireshark-101/#chapter-4">Chapter 4 of the lab</a> has you capture the laptop releasing its address and
asking for a new one, read the lease, the gateway and the DNS server out of the Offer, and then capture both
sides of r1 at once to watch the Discover change as it&rsquo;s relayed.</p>
<h2 id="whats-next">What&rsquo;s next</h2>
<p>With an address, a gateway and a DNS server, the laptop is ready to look up a name. <a href="/lessons/wireshark-101/dns/">Lesson 5</a> is about DNS:
the question and answer behind every name you type, and the extra lookups the domain name from option 15 adds.</p>
]]></content:encoded></item><item><title>ARP on the Wire: Who Has This Address? (Wireshark 101, Lesson 3)</title><link>https://networkdoodles.com/lessons/wireshark-101/arp/</link><pubDate>Mon, 16 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/wireshark-101/arp/</guid><category>wireshark</category><category>packet-capture</category><category>networking-basics</category><category>arp</category><description>ARP on the wire: the broadcast request and unicast reply, the neighbor cache, ARP for the gateway, gratuitous ARP, and a duplicate IP address caught.</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>ARP, the Address Resolution Protocol, is how a host finds the MAC address that goes with an IP address on its
own network. It&rsquo;s one question, sent to everyone (<em>who has 192.168.1.20?</em>), and one answer, sent only to the
host that asked (<em>192.168.1.20 is at aa:aa:aa:22:22:22</em>). Hosts remember the answer for a while in a
<strong>neighbor cache</strong>, and only ask for addresses on their own network: for anything further away, they ask
for their gateway.</p>
<p>It&rsquo;s the first thing you&rsquo;ll see in almost every capture you take, and it&rsquo;s where a lot of &ldquo;the network is
flaky&rdquo; problems turn out to live. This lesson reads ARP field by field from the lab&rsquo;s captures, then covers
the cache, the gateway, gratuitous ARP, and what two hosts with one address look like on the wire.</p>
<hr>
<h2 id="why-does-ip-need-arp">Why does IP need ARP?</h2>
<p>An IP packet never travels on its own. On an Ethernet network it&rsquo;s carried inside a <strong>frame</strong>, and the frame
needs a destination MAC address: the address of the network card that should pick it up. The laptop knows
the printer&rsquo;s IP address, <code>192.168.1.20</code>, because someone typed it or DNS gave it. It doesn&rsquo;t know the
printer&rsquo;s MAC address. Nothing in IP tells it.</p>
<p>ARP fills that gap. It&rsquo;s defined in <a href="https://www.rfc-editor.org/rfc/rfc826">RFC 826</a>, from 1982, and it
hasn&rsquo;t needed to change much since. You met it in <a href="/lessons/wireshark-101/what-a-capture-shows/">lesson 1</a>:
before the laptop could send its first ping, it sent an ARP request. Every first conversation with a
neighbor starts like that.</p>
<hr>
<h2 id="whats-in-an-arp-request-and-reply">What&rsquo;s in an ARP request and reply?</h2>
<p>Here&rsquo;s the start of the lab&rsquo;s ARP capture, taken on the laptop&rsquo;s cable while it pings the printer:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">    2 1.071035042 aa:aa:aa:11:11:11 → Broadcast    ARP 42 Who has 192.168.1.20? Tell 192.168.1.175
</span></span><span class="line"><span class="cl">    3 1.071288709 aa:aa:aa:22:22:22 → aa:aa:aa:11:11:11 ARP 42 192.168.1.20 is at aa:aa:aa:22:22:22
</span></span><span class="line"><span class="cl">    4 1.071292167 192.168.1.175 → 192.168.1.20 ICMP 98 Echo (ping) request  id=0x092b, seq=1/256, ttl=64
</span></span></code></pre></div><p>The question, the answer 254 microseconds later, and the ping straight after: 3.5 microseconds after the
answer arrived. The laptop was holding the ping until it knew where to send it.</p>
<p>Open the request in Wireshark&rsquo;s details pane and the ARP layer has nine fields. Four of them are the ones
that matter: two pairs of addresses.</p>
<table>
  <thead>
      <tr>
          <th>Field</th>
          <th>In the request</th>
          <th>In the reply</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>Opcode</strong></td>
          <td><code>request (1)</code></td>
          <td><code>reply (2)</code></td>
      </tr>
      <tr>
          <td><strong>Sender MAC address</strong></td>
          <td>the laptop&rsquo;s, <code>aa:aa:aa:11:11:11</code></td>
          <td>the printer&rsquo;s: <strong>the answer</strong></td>
      </tr>
      <tr>
          <td><strong>Sender IP address</strong></td>
          <td>the laptop&rsquo;s, <code>192.168.1.175</code></td>
          <td>the printer&rsquo;s, <code>192.168.1.20</code></td>
      </tr>
      <tr>
          <td><strong>Target MAC address</strong></td>
          <td><code>00:00:00:00:00:00</code>: unknown, that&rsquo;s the question</td>
          <td>the laptop&rsquo;s</td>
      </tr>
      <tr>
          <td><strong>Target IP address</strong></td>
          <td><code>192.168.1.20</code>: the address being asked about</td>
          <td>the laptop&rsquo;s</td>
      </tr>
  </tbody>
</table>
<p>The other five (hardware type Ethernet, protocol type IPv4, sizes 6 and 4) say what kind of addresses are
being mapped. ARP was designed to work for more than Ethernet and IPv4, and those fields are where that
shows. On an Ethernet network carrying IPv4 they never change.</p>
<p>Notice that the MAC addresses are in the frame twice: once in the <strong>Ethernet header</strong>, which the switch reads
to deliver the frame, and once in the <strong>ARP body</strong>, which the hosts read to learn the mapping. They usually
agree. When you&rsquo;re investigating something odd, check that they do.</p>
<p>An ARP message is small: 42 bytes on the wire, header included. That&rsquo;s 14 bytes of Ethernet header and 28 bytes
of ARP.</p>
<hr>
<h2 id="why-is-the-request-a-broadcast-and-the-reply-unicast">Why is the request a broadcast and the reply unicast?</h2>
<p>The request goes to <code>ff:ff:ff:ff:ff:ff</code>, the <strong>broadcast</strong> MAC address, which Wireshark shows as
<code>Broadcast</code>. It has to: the laptop doesn&rsquo;t know who has the address, so it asks everyone. Every host on the
network receives it, and every host except the owner ignores it.</p>
<p>The reply goes <strong>unicast</strong>, straight to the laptop&rsquo;s MAC address. The printer knows exactly who asked,
because the request told it (the Sender fields). There&rsquo;s no reason to bother anyone else.</p>
<p>That difference decides what a capture sees. In lesson 1&rsquo;s capture of two switch ports, the printer&rsquo;s cable
carried the laptop&rsquo;s ARP request for r1, because it was a broadcast, but not r1&rsquo;s reply, which the switch sent
only to the laptop. If you&rsquo;re capturing on a third host&rsquo;s port and see an ARP request with no reply, that&rsquo;s
normal. It&rsquo;s only a problem if you&rsquo;re on the <em>asker&rsquo;s</em> cable.</p>
<p>The broadcast is also why ARP stops at the router. A router doesn&rsquo;t forward broadcasts: the edge of a
broadcast domain, from Networking 101&rsquo;s <a href="/lessons/networking-101/task-2-2/">lesson on domains</a>, is the edge of
where ARP can ask.</p>
<hr>
<h2 id="why-does-a-host-arp-for-its-gateway-and-not-the-far-host">Why does a host ARP for its gateway and not the far host?</h2>
<p>Because the far host can&rsquo;t hear the question. A host only ARPs for addresses <strong>on its own network</strong>, which it
works out from its own address and subnet mask. For anything else, it sends the packet to its <strong>default
gateway</strong>, the router on its network, so the MAC address it needs is the gateway&rsquo;s.</p>
<p>The lab&rsquo;s capture shows the laptop doing both. After pinging the printer, it pings web, <code>192.168.2.10</code>, on
another network:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">    8 1.423931125 aa:aa:aa:11:11:11 → Broadcast    ARP 42 Who has 192.168.1.1? Tell 192.168.1.175
</span></span><span class="line"><span class="cl">    9 1.424048667 aa:c1:ab:d8:b6:be → aa:aa:aa:11:11:11 ARP 42 192.168.1.1 is at aa:c1:ab:d8:b6:be
</span></span><span class="line"><span class="cl">   10 1.424050834 192.168.1.175 → 192.168.2.10 ICMP 98 Echo (ping) request  id=0x092c, seq=1/256, ttl=64
</span></span></code></pre></div><p>It never asks <em>who has 192.168.2.10?</em>. It asks for <code>192.168.1.1</code>, r1. And the ping in frame 10 carries two
destinations that look like they disagree:</p>
<table>
  <thead>
      <tr>
          <th>Layer</th>
          <th>Destination</th>
          <th>Means</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Ethernet</td>
          <td><code>aa:c1:ab:d8:b6:be</code> (r1)</td>
          <td>the next stop</td>
      </tr>
      <tr>
          <td>IP</td>
          <td><code>192.168.2.10</code> (web)</td>
          <td>the final stop</td>
      </tr>
  </tbody>
</table>
<p>That one frame is the whole of routing. The IP destination stays the same for the whole journey. The Ethernet
destination is rewritten at every hop, and ARP is how each sender finds the next one. (r1&rsquo;s MAC address is
generated when the lab starts, so yours will be different.)</p>
<p>This is also how a wrong subnet mask shows up in a capture. Give the laptop a mask that&rsquo;s too wide and it
thinks web is a neighbor, so it broadcasts <em>who has 192.168.2.10?</em>, and nobody on its network answers (unless the router is set up to
answer on the far host&rsquo;s behalf, which is called <em>proxy ARP</em>). The
capture shows the same question, over and over, with no reply, and no ping ever leaves.</p>
<hr>
<h2 id="what-is-the-neighbor-cache-and-why-do-entries-go-stale">What is the neighbor cache, and why do entries go stale?</h2>
<p>Asking before every packet would be wasteful, so every host keeps the answers in a table: the <strong>ARP cache</strong>,
or <strong>neighbor cache</strong>. On Linux, <code>ip neigh</code> shows it. On Cisco-style routers, <code>show ip arp</code>. When the
laptop wants to send to an address that&rsquo;s in the table, it uses the stored MAC address and sends no ARP at
all.</p>
<p>That&rsquo;s why the lab empties the laptop&rsquo;s cache before each ARP task. Without that, a capture of the laptop
pinging the printer would show the ping and no ARP, because the laptop already knew. It&rsquo;s worth remembering
when you&rsquo;re troubleshooting: <strong>no ARP in a capture doesn&rsquo;t mean ARP is broken</strong>. Usually it means the
answer was already cached.</p>
<p>Entries don&rsquo;t last forever, because the answer can change: a host gets a new network card, a virtual
machine moves to another server, a device is replaced and its address reused. A cached entry that&rsquo;s wrong
sends traffic to a MAC address that isn&rsquo;t there any more. So hosts let entries age, and check them again
before trusting them. How long an entry lives varies by operating system and is configurable. Linux&rsquo;s
<code>ip neigh</code> shows each entry&rsquo;s state, such as <code>REACHABLE</code> (recently confirmed) or <code>STALE</code> (needs checking
before it&rsquo;s trusted again).</p>
<p>You can see a recheck on the wire. The lab&rsquo;s DHCP capture starts with this:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">    1 0.000000000 aa:aa:aa:33:33:33 → aa:aa:aa:11:11:11 ARP 42 Who has 192.168.1.175? Tell 192.168.1.30
</span></span><span class="line"><span class="cl">    2 0.000042375 aa:aa:aa:11:11:11 → aa:aa:aa:33:33:33 ARP 42 192.168.1.175 is at aa:aa:aa:33:33:33
</span></span></code></pre></div><p>Look at the destination of frame 1: not <code>Broadcast</code>, but the laptop&rsquo;s own MAC address. broken-pc already had
an entry for the laptop and was checking it with a <strong>unicast</strong> request, straight to the MAC address it
expected. The laptop confirmed it. Nobody else on the network had to hear the question.</p>
<hr>
<h2 id="what-is-gratuitous-arp">What is gratuitous ARP?</h2>
<p>A <strong>gratuitous ARP</strong> is an ARP message nobody asked for: a host announcing its own mapping to everyone. In the
lab it looks like this:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">    1 0.000000000 aa:aa:aa:33:33:33 → Broadcast    ARP 42 Gratuitous ARP for 192.168.1.20 (Request)
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Address Resolution Protocol (request/gratuitous ARP)
</span></span><span class="line"><span class="cl">    Opcode: request (1)
</span></span><span class="line"><span class="cl">    [Is gratuitous: True]
</span></span><span class="line"><span class="cl">    Sender MAC address: aa:aa:aa:33:33:33 (aa:aa:aa:33:33:33)
</span></span><span class="line"><span class="cl">    Sender IP address: 192.168.1.20
</span></span><span class="line"><span class="cl">    Target MAC address: Broadcast (ff:ff:ff:ff:ff:ff)
</span></span><span class="line"><span class="cl">    Target IP address: 192.168.1.20
</span></span></code></pre></div><p>The giveaway is that the sender IP and the target IP are the same address. It isn&rsquo;t a question; it&rsquo;s an
announcement: <em>192.168.1.20 is me, at this MAC address</em>. <code>[Is gratuitous: True]</code> is in square brackets
because Wireshark worked it out; it isn&rsquo;t a field in the packet. You can filter on it with
<code>arp.isgratuitous == 1</code>.</p>
<p>Hosts send them for good reasons:</p>
<ul>
<li><strong>Bringing an address up.</strong> A host announces its new address so that anyone with an old entry for it
updates straight away.</li>
<li><strong>Failover.</strong> When a standby device takes over an address from a failed one (a redundant router pair, a
server cluster), it sends a gratuitous ARP so every neighbor starts sending to the new MAC address
immediately, instead of waiting for their caches to age.</li>
<li><strong>Conflict detection.</strong> <a href="https://www.rfc-editor.org/rfc/rfc5227">RFC 5227</a> describes how a host can check
that nobody else is using an address before claiming it, and announce it afterwards.</li>
</ul>
<hr>
<h2 id="what-does-a-duplicate-ip-address-look-like-on-the-wire">What does a duplicate IP address look like on the wire?</h2>
<p>Two hosts with the same IP address is a common mistake: a static address typed onto a device that DHCP had
already given out, a cloned virtual machine, a replacement device configured from the old one&rsquo;s notes. The
network doesn&rsquo;t stop it. Both hosts carry on, and both answer ARP for the address.</p>
<p>In the lab, broken-pc briefly takes the printer&rsquo;s address and announces it (the gratuitous ARP above). Then
the laptop looks for the printer:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">    3 0.584692875 aa:aa:aa:11:11:11 → Broadcast    ARP 42 Who has 192.168.1.20? Tell 192.168.1.175
</span></span><span class="line"><span class="cl">    4 0.584883875 aa:aa:aa:33:33:33 → aa:aa:aa:11:11:11 ARP 42 192.168.1.20 is at aa:aa:aa:33:33:33
</span></span><span class="line"><span class="cl">    5 0.584884584 aa:aa:aa:22:22:22 → aa:aa:aa:11:11:11 ARP 42 192.168.1.20 is at aa:aa:aa:22:22:22
</span></span></code></pre></div><p><strong>One question, two different answers</strong>, less than a microsecond apart. Wireshark notices, and marks
frame 5 with <strong>expert info</strong>, its name for problems it spots across packets rather than inside one:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">[Duplicate IP address detected for 192.168.1.20 (aa:aa:aa:22:22:22) - also in use by aa:aa:aa:33:33:33 (frame 4)]
</span></span><span class="line"><span class="cl">    [Expert Info (Warning/Sequence): Duplicate IP address configured (192.168.1.20)]
</span></span></code></pre></div><p>It&rsquo;s a Warning in the Sequence group, so it shows up in <strong>Analyze › Expert Information</strong> and with the
filter <code>_ws.expert</code>. It&rsquo;s worth opening that window on any capture you&rsquo;re handed: it&rsquo;s the quickest way to
find what&rsquo;s odd.</p>
<p>Which answer does the laptop believe? That depends on the operating system. In the lab&rsquo;s reference capture,
the laptop&rsquo;s pings went to the <em>first</em> reply. Here are the pings that followed, as frame number, Ethernet
source and destination, IP source and destination, and ICMP type (8 is a request, 0 a reply):</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">6	aa:aa:aa:11:11:11	aa:aa:aa:33:33:33	192.168.1.175	192.168.1.20	8
</span></span><span class="line"><span class="cl">7	aa:aa:aa:33:33:33	aa:aa:aa:11:11:11	192.168.1.20	192.168.1.175	0
</span></span></code></pre></div><p>broken-pc answered the pings meant for the printer, with the printer&rsquo;s IP address. From the laptop&rsquo;s point of
view, everything worked. That&rsquo;s what makes duplicate addresses so miserable to troubleshoot: depending on
who answered last time and whose cache entry has aged, traffic goes to one host, then the other. Users report
&ldquo;it works, then it doesn&rsquo;t&rdquo;. The ping succeeds, and still the print job vanishes. The capture is the only
place you can see two MAC addresses claiming one IP.</p>
<hr>
<h2 id="why-does-arps-trust-matter">Why does ARP&rsquo;s trust matter?</h2>
<p>ARP has no authentication. A host believes any reply, and often any announcement, without checking who sent
it. The duplicate address above was an accident, but nothing stops a host doing the same thing on purpose:
claiming the gateway&rsquo;s address so that its neighbors send it their traffic. That&rsquo;s <strong>ARP spoofing</strong>, and
it&rsquo;s the reason enterprise switches offer features such as dynamic ARP inspection, which check ARP messages
against the addresses DHCP actually handed out. For troubleshooting, the lesson is simpler: an ARP reply is
a claim, not a proof. When two MAC addresses claim one IP, find out which one should.</p>
<hr>
<h2 id="what-i-see-go-wrong">What I see go wrong</h2>
<p><strong>&ldquo;There&rsquo;s no ARP in the capture, so ARP is the problem.&rdquo;</strong> Usually the answer was cached. Look for the
traffic that follows instead, and at the cache itself.</p>
<p><strong>A request with no reply, read on the wrong cable.</strong> Replies are unicast. On a third host&rsquo;s port you&rsquo;ll
never see one. On the asker&rsquo;s own cable, a request with no reply means nobody has that address, or the host
that has it is down, or the asker has the wrong subnet mask and is asking for a host that isn&rsquo;t on its
network.</p>
<p><strong>Replaced hardware, old entries.</strong> A device is swapped, keeps its IP address, and gets a new MAC address.
Neighbors keep sending to the old one until their entries age out, unless the new device sends a gratuitous
ARP. A capture shows frames to a MAC address that never answers.</p>
<p><strong>Duplicate addresses that come and go.</strong> The symptom moves between hosts and times of day. Capture on the
asker&rsquo;s cable and look for two different <strong>is at</strong> answers, or open Expert Information.</p>
<p><strong>Ignoring the Ethernet header.</strong> The ARP body says one thing, and the Ethernet source says another? Then
something is answering on another host&rsquo;s behalf. Find out what, and why.</p>
<hr>
<h2 id="try-it">Try it</h2>
<p><a href="/labs/wireshark-101/#chapter-3">Chapter 3 of the lab</a> has you capture the laptop finding the printer and
then the web server, read which address it asked for each time, and then catch broken-pc claiming the
printer&rsquo;s address, with Wireshark&rsquo;s expert info pointing at the frame.</p>
<h2 id="whats-next">What&rsquo;s next</h2>
<p>ARP needs the host to have an IP address already. <a href="/lessons/wireshark-101/dhcp/">Lesson 4</a> is about how it
gets one: the four DHCP messages, sent before the laptop has any address at all, and the router that carries
them to a server two hops away.</p>
]]></content:encoded></item><item><title>Capture Filters vs Display Filters (Wireshark 101, Lesson 2)</title><link>https://networkdoodles.com/lessons/wireshark-101/capture-vs-display-filters/</link><pubDate>Mon, 16 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/wireshark-101/capture-vs-display-filters/</guid><category>wireshark</category><category>packet-capture</category><category>networking-basics</category><category>bpf</category><description>Capture filters (BPF) decide what's saved; display filters decide what's shown. Field names, operators, the != change in Wireshark 3.6, and precedence.</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>Wireshark has two kinds of filter, written in two different languages, and they work at two different
times. A <strong>capture filter</strong> runs while you capture and decides which frames are saved at all: whatever it
rejects is gone for good. A <strong>display filter</strong> runs on a capture you already have and only hides frames:
clear it and they&rsquo;re all back. So the rule is simple. Capture wide, with no filter or a loose one, and filter
narrow afterwards.</p>
<p><a href="/lessons/wireshark-101/what-a-capture-shows/">Lesson 1</a> was about what a capture is and where to take it.
This one is about finding the frames you care about in it. Every count below comes from tshark 4.6.5,
Wireshark&rsquo;s command-line twin, run against the lab&rsquo;s reference capture of r1&rsquo;s switch port: 64 frames of ARP,
DNS, pings, HTTP, HTTPS and the switch&rsquo;s own STP messages, from about four seconds of a quiet network.</p>
<hr>
<h2 id="what-is-a-capture-filter">What is a capture filter?</h2>
<p>A capture filter is written in <strong>BPF</strong>, the <em>Berkeley Packet Filter</em> language: the same one tcpdump uses.
It&rsquo;s old, small and fast, because of where it runs. The capture library compiles your filter into a tiny
program, and the operating system&rsquo;s kernel runs that program on every frame before it&rsquo;s handed to the
capture tool. A frame the program rejects is never copied out of the kernel, never written to disk, and can
never be recovered.</p>
<p>You can see the program. <code>tcpdump -d 'udp port 53'</code> prints it, and it starts like this:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">(000) ldh      [12]
</span></span><span class="line"><span class="cl">(001) jeq      #0x86dd          jt 2	jf 8
</span></span><span class="line"><span class="cl">...
</span></span><span class="line"><span class="cl">(018) ret      #262144
</span></span><span class="line"><span class="cl">(019) ret      #0
</span></span></code></pre></div><p>Load the two bytes at offset 12 of the frame (the Ethernet type), check whether they say IPv6, and so on.
<code>ret #262144</code> means <em>keep up to 262,144 bytes of this frame</em>, and <code>ret #0</code> means <em>drop it</em>. That&rsquo;s the whole
idea: a capture filter is arithmetic on header bytes at fixed positions.</p>
<p>Which is also its limit. BPF knows addresses, ports and protocol numbers, and that&rsquo;s about it:</p>
<table>
  <thead>
      <tr>
          <th>BPF capture filter</th>
          <th>Keeps</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>host 192.168.2.10</code></td>
          <td>frames to or from that address</td>
      </tr>
      <tr>
          <td><code>src host 192.168.1.20</code></td>
          <td>frames from it</td>
      </tr>
      <tr>
          <td><code>udp port 53</code></td>
          <td>UDP to or from port 53</td>
      </tr>
      <tr>
          <td><code>tcp port 443</code></td>
          <td>TCP to or from port 443</td>
      </tr>
      <tr>
          <td><code>ether host aa:aa:aa:11:11:11</code></td>
          <td>frames to or from that MAC address</td>
      </tr>
      <tr>
          <td><code>arp</code>, <code>not arp</code></td>
          <td>ARP, or everything else</td>
      </tr>
      <tr>
          <td><code>host 192.168.2.10 and tcp port 80</code></td>
          <td>both must be true (<code>and</code>, <code>or</code>, <code>not</code>)</td>
      </tr>
  </tbody>
</table>
<p>BPF can&rsquo;t say <em>DNS</em>. It can say <em>port 53</em> and trust that whatever uses port 53 is DNS. It can&rsquo;t say
<em>the HTTP request for /login</em>, because that&rsquo;s inside the payload, at no fixed offset. If the answer you need
is past the headers, a capture filter can&rsquo;t find it.</p>
<p>One BPF detail catches people. <code>host 192.168.1.1</code> matches the address wherever BPF knows to look, and that
includes ARP. On the reference capture it keeps 4 frames, all of them ARP: the laptop and the printer asking
for r1, and r1 answering. Write <code>ip host 192.168.1.1</code> and it keeps 0, because nothing in that capture sent an
IP packet to or from r1 itself. The pings went <em>through</em> r1, to a server further away.</p>
<hr>
<h2 id="what-is-a-display-filter">What is a display filter?</h2>
<p>A display filter is written in Wireshark&rsquo;s own language, and it works on the decoded capture. Every line in
the packet details pane is a <strong>field</strong> with a name, made by the <strong>dissector</strong>, the part of Wireshark that
decodes one protocol. Click a field and its name appears in the status bar: <code>ip.src</code>, <code>dns.qry.name</code>,
<code>tcp.flags.syn</code>, <code>tls.handshake.extensions_server_name</code>. tshark 4.6.5 lists 269,301 of them, from
every protocol it can decode.</p>
<p>So a display filter can ask anything a dissector understood:</p>
<table>
  <thead>
      <tr>
          <th>Display filter</th>
          <th>On the reference capture</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>dns</code></td>
          <td>12 frames: every frame with a DNS layer</td>
      </tr>
      <tr>
          <td><code>ip.src == 192.168.1.20</code></td>
          <td>3: the printer&rsquo;s own packets</td>
      </tr>
      <tr>
          <td><code>ip.addr == 192.168.1.20</code></td>
          <td>6: the printer as source <strong>or</strong> destination</td>
      </tr>
      <tr>
          <td><code>ip.addr == 192.168.2.0/24</code></td>
          <td>57: anything to or from the server network</td>
      </tr>
      <tr>
          <td><code>tcp.port in {80, 443}</code></td>
          <td>33: both web connections</td>
      </tr>
      <tr>
          <td><code>http.host == &quot;web.lab&quot;</code></td>
          <td>1: the HTTP request that asked for that name</td>
      </tr>
      <tr>
          <td><code>tcp.flags.syn == 1 &amp;&amp; tcp.flags.ack == 0</code></td>
          <td>2: the first packet of each TCP connection</td>
      </tr>
      <tr>
          <td><code>tls.handshake.extensions_server_name == &quot;web.lab&quot;</code></td>
          <td>1: the HTTPS request&rsquo;s name, before encryption</td>
      </tr>
  </tbody>
</table>
<p>That last one is a field inside an encrypted connection&rsquo;s handshake, at a position that changes from packet
to packet. No capture filter could reach it. A display filter just names it.</p>
<p>A filter with a typo is an error, not a silent empty result, which is good:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">tshark: &#34;ip.adr&#34; is not a valid protocol or protocol field.
</span></span><span class="line"><span class="cl">    ip.adr == 1.2.3.4
</span></span><span class="line"><span class="cl">    ^~~~~~
</span></span></code></pre></div><p>In Wireshark the filter bar turns red instead, and green when the filter makes sense.</p>
<table>
  <thead>
      <tr>
          <th></th>
          <th>Capture filter</th>
          <th>Display filter</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Language</td>
          <td>BPF (tcpdump&rsquo;s)</td>
          <td>Wireshark&rsquo;s display filter language</td>
      </tr>
      <tr>
          <td>Runs</td>
          <td>in the kernel, while capturing</td>
          <td>in Wireshark, on a saved capture</td>
      </tr>
      <tr>
          <td>Can see</td>
          <td>header fields at fixed offsets</td>
          <td>every field any dissector decoded</td>
      </tr>
      <tr>
          <td>What it does to rejected frames</td>
          <td>never saved</td>
          <td>hidden, still in the file</td>
      </tr>
      <tr>
          <td>Undo</td>
          <td>no</td>
          <td>clear the filter</td>
      </tr>
      <tr>
          <td>Cost</td>
          <td>very cheap, so it keeps up with busy links</td>
          <td>needs the whole capture decoded first</td>
      </tr>
  </tbody>
</table>
<hr>
<h2 id="how-do-contains-and-matches-work">How do contains and matches work?</h2>
<p>Two operators search for text rather than compare values.</p>
<p><code>contains</code> looks for an exact sequence of bytes or characters in a field, or in the whole frame.
<code>frame contains &quot;web&quot;</code> keeps 13 frames on the reference capture: the DNS questions and answers for <code>web.lab</code>,
the HTTP request (its Host header), the page that came back, and the TLS Client Hello, whose server name is
sent in clear text. It&rsquo;s case-sensitive: <code>dns.qry.name contains &quot;PRINT&quot;</code> finds nothing, because the name is
<code>printer.lab</code>.</p>
<p><code>matches</code> takes a regular expression, and it&rsquo;s case-insensitive by default.
<code>dns.qry.name matches &quot;^PRINT&quot;</code> finds both printer frames. Put <code>(?-i)</code> at the front of the expression and it
becomes case-sensitive again, and finds none.</p>
<p>Use <code>contains</code> when you know the exact text, and <code>matches</code> when you need a pattern or don&rsquo;t trust the case.</p>
<hr>
<h2 id="why-is-ipaddr-a-two-way-field">Why is ip.addr a two-way field?</h2>
<p>A frame has one IP source and one IP destination, but Wireshark also gives it <code>ip.addr</code>, a field that appears
<strong>twice</strong>: once with the source and once with the destination. <code>ip.addr == 192.168.1.20</code> is true if <em>either</em>
copy matches, which is exactly what you want for &ldquo;everything to or from the printer&rdquo;. <code>eth.addr</code>, <code>tcp.port</code>
and <code>udp.port</code> work the same way.</p>
<p>It&rsquo;s the most useful shortcut in Wireshark, and it&rsquo;s the reason for the most famous trap in it.</p>
<hr>
<h2 id="what-does-ipaddr--x-really-match">What does ip.addr != x really match?</h2>
<p>The question is what <em>not equal</em> means for a field with two values. Is <code>ip.addr != 192.168.2.10</code> true when
<em>any</em> copy is different, or only when <em>all</em> of them are?</p>
<p>For years, Wireshark used <em>any</em>. Every packet between the laptop and the web server has one address that isn&rsquo;t
the web server&rsquo;s, so <code>ip.addr != 192.168.2.10</code> matched nearly everything, including all the traffic you were
trying to remove. Every guide warned you never to write it.</p>
<p><strong>Wireshark 3.6 changed that.</strong> Its <a href="https://www.wireshark.org/docs/relnotes/wireshark-3.6.0.html">release notes</a>
say &ldquo;a != b&rdquo; now has the &ldquo;same meaning as !(a == b)&rdquo;, and kept the old meaning available as <code>~=</code>. Wireshark
4.0 <a href="https://www.wireshark.org/docs/relnotes/wireshark-4.0.0.html">deprecated <code>~=</code></a> in favor of <code>!==</code>. In
tshark 4.6.5, <code>~=</code> is a syntax error.</p>
<p>So the old warning is out of date. But there&rsquo;s one difference left, and it&rsquo;s the one that bites now. Here are
the three versions on the reference capture:</p>
<table>
  <thead>
      <tr>
          <th>Filter</th>
          <th>Frames</th>
          <th>What it means</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>ip.addr != 192.168.2.10</code></td>
          <td>20</td>
          <td>frames that <strong>have</strong> an IP address, none of them web&rsquo;s</td>
      </tr>
      <tr>
          <td><code>!(ip.addr == 192.168.2.10)</code></td>
          <td>27</td>
          <td>every frame that doesn&rsquo;t mention web, IP or not</td>
      </tr>
      <tr>
          <td><code>ip.addr !== 192.168.2.10</code></td>
          <td>57</td>
          <td>the old meaning: any address that isn&rsquo;t web&rsquo;s, so every IP frame</td>
      </tr>
  </tbody>
</table>
<p>The difference between 20 and 27 is 4 ARP frames and 3 STP frames. They have no <code>ip.addr</code> field at all, and a
comparison on a field that isn&rsquo;t there is false, so <code>!=</code> drops them. <code>!(ip.addr == ...)</code> asks the positive
question first (<em>is web in it?</em>: no, for ARP), then turns the answer round, so they stay.</p>
<p>That&rsquo;s usually what you want when you say &ldquo;everything except web&rdquo;. The habit to build: write the filter for
the thing you want to hide, then put <code>!( )</code> round it.</p>
<hr>
<h2 id="does--bind-tighter-than-">Does &amp;&amp; bind tighter than ||?</h2>
<p>Yes, since <strong>Wireshark 4.0</strong>, whose release notes say logical AND &ldquo;now has higher precedence than logical OR,
in line with most programming languages&rdquo;. Before 4.0 it didn&rsquo;t, so a filter that mixes the two can give a
different answer on an older version.</p>
<p>It changes results. Take <em>DNS or ARP, sent by the laptop</em>:</p>
<table>
  <thead>
      <tr>
          <th>Filter</th>
          <th>Frames</th>
          <th>Read as</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>dns || arp &amp;&amp; eth.src == aa:aa:aa:11:11:11</code></td>
          <td>13</td>
          <td>DNS from anyone, or ARP from the laptop</td>
      </tr>
      <tr>
          <td><code>(dns || arp) &amp;&amp; eth.src == aa:aa:aa:11:11:11</code></td>
          <td>6</td>
          <td>what you meant</td>
      </tr>
  </tbody>
</table>
<p>Use brackets whenever you mix them. They make a filter mean the same thing in every version, and to every
person who reads it.</p>
<hr>
<h2 id="how-much-should-you-capture">How much should you capture?</h2>
<p>Capture wide, filter narrow. You can always hide a frame you saved. You can never get back a frame a capture
filter threw away, and the clue you didn&rsquo;t expect is usually in the traffic you&rsquo;d have thought irrelevant: an
ARP storm, a second DHCP server, a retransmission from a host you weren&rsquo;t watching.</p>
<p>Capture filters still have their place, for three reasons:</p>
<ul>
<li><strong>Volume.</strong> A busy link fills a disk quickly. A filter keeps the file to what you need.</li>
<li><strong>Load.</strong> Capturing every frame on a fast link can drop frames on a slow capture machine. Filtering in the
kernel is the cheapest way to keep up.</li>
<li><strong>Privacy and policy.</strong> Sometimes you&rsquo;re only allowed to keep one application&rsquo;s traffic. The safest copy of
someone else&rsquo;s data is the one you never saved.</li>
</ul>
<p>Two more settings decide how much a capture keeps.</p>
<h3 id="snap-length">Snap length</h3>
<p>The <strong>snap length</strong> is how many bytes of each frame are saved. The lab&rsquo;s files save up to 262,144 bytes per
frame, the same number as that <code>ret #262144</code> in the BPF program: in practice, all of every frame. Set it
small and you keep the headers and drop the payload. Here&rsquo;s the HTTP request from the reference capture,
cut to 54 bytes per frame with <code>editcap -s 54</code>:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Frame 24: Packet, 137 bytes on wire (1096 bits), 54 bytes captured (432 bits) on interface sw1:eth1, id 0
</span></span><span class="line"><span class="cl">   24 2.382133001 192.168.1.175 → 192.168.2.10 TCP 137 50124 → 80 [PSH, ACK] Seq=1 Ack=1 Win=502 Len=71[Packet size limited during capture]
</span></span></code></pre></div><p>The addresses and ports survived, the <code>GET</code> is gone, and Wireshark says so. A small snap length is a good
way to capture <em>who talked to whom</em> for a long time without keeping <em>what they said</em>. It&rsquo;s a bad idea when
you&rsquo;re troubleshooting the application.</p>
<h3 id="ring-buffers">Ring buffers</h3>
<p>A <strong>ring buffer</strong> is a set of capture files used in turn: write file 1 until it reaches a size or an age,
then file 2, and when the last one is full, overwrite the oldest. tshark&rsquo;s <code>-b</code> option does it (<code>filesize</code>,
<code>duration</code>, <code>files</code>). It&rsquo;s how you wait for an intermittent problem: leave a capture running for days with,
say, ten files of 100 MB, and when the problem happens, stop it. The last gigabyte of traffic before the
problem is on disk, and the disk never filled.</p>
<hr>
<h2 id="what-i-see-go-wrong">What I see go wrong</h2>
<p><strong>A capture filter that removed the answer.</strong> <code>host 192.168.2.10</code> looks like a sensible filter for &ldquo;web&rsquo;s
traffic&rdquo;, until the problem turns out to be the client&rsquo;s ARP or DNS, which never involved that address. If you
filter at capture time, filter on the client, not the server, and keep it loose.</p>
<p><strong><code>ip.addr != x</code> from an old guide.</strong> It&rsquo;s no longer the disaster those guides describe, but it still drops
every frame without an IP address. When you want &ldquo;everything except&rdquo;, use <code>!(field == value)</code>.</p>
<p><strong>Mixing <code>&amp;&amp;</code> and <code>||</code> without brackets.</strong> It works, in Wireshark 4.0 and later, by precedence. Someone on an
older version, or someone reading it quickly, gets a different answer.</p>
<p><strong>Treating BPF and display filters as one language.</strong> <code>port 53</code> is BPF; <code>udp.port == 53</code> is a display filter.
The filter bar rejects the first, and tcpdump rejects the second. Know which box you&rsquo;re typing in.</p>
<p><strong>Trusting an empty result.</strong> A display filter that shows nothing might mean the traffic isn&rsquo;t there, or
that you asked for a field from the wrong protocol. Before you conclude anything, take a frame you <em>know</em>
should match and check that the filter matches it.</p>
<hr>
<h2 id="try-it">Try it</h2>
<p><a href="/labs/wireshark-101/#chapter-2">Chapter 2 of the lab</a> gives you the same reference capture used here. You
write display filters that have to pick exactly the right frames, see the <code>!=</code> difference for yourself, and
then write capture filters in BPF and find out what they threw away.</p>
<h2 id="whats-next">What&rsquo;s next</h2>
<p><a href="/lessons/wireshark-101/arp/">Lesson 3</a> uses those filters on the first protocol every conversation needs:
ARP, the question a host asks before it can send anything to its neighbor.</p>
]]></content:encoded></item><item><title>What a Packet Capture Shows You (Wireshark 101, Lesson 1)</title><link>https://networkdoodles.com/lessons/wireshark-101/what-a-capture-shows/</link><pubDate>Mon, 16 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/wireshark-101/what-a-capture-shows/</guid><category>wireshark</category><category>packet-capture</category><category>networking-basics</category><category>ethernet</category><description>What a packet capture records, how Wireshark's three panes map to the layers, pcap vs pcapng, and why where you capture decides what you can see.</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>A packet capture is a recording of every frame that crossed one point in the network while the recording
ran: each one bit for bit, with the time it was seen. Wireshark opens that recording and decodes it, layer by
layer. The most important thing to know about a capture is that it only shows <strong>its own point</strong>. Pick the
wrong cable and you see nothing, and <em>nothing</em> looks exactly like <em>it never happened</em>.</p>
<p><a href="/lessons/networking-101/">Networking 101</a> explained what MAC addresses, IP addresses, switches and routers
are. This course shows you what they actually put on the wire. This first lesson is about the tool itself:
what&rsquo;s in a capture, how Wireshark lays it out, what the timestamps mean, the two file formats, and the
question every capture starts with: <em>where am I listening?</em></p>
<hr>
<h2 id="what-is-a-packet-capture">What is a packet capture?</h2>
<p>Everything you&rsquo;ve used to look at a network so far is a summary. <code>ip neigh</code> shows what a host <em>concluded</em>
about its neighbors. <code>show mac address-table</code> shows what a switch <em>learned</em>. A routing table shows what a
router <em>decided</em>. They&rsquo;re all useful, and they&rsquo;re all someone&rsquo;s interpretation.</p>
<p>A capture isn&rsquo;t. It&rsquo;s the frames themselves, in the order they were seen, with nothing left out and nothing
summarized. When a show command and a capture disagree, the capture is the one that&rsquo;s telling you what
happened. That&rsquo;s why engineers reach for it when everything else says the network is fine and the
application says it isn&rsquo;t.</p>
<p>Two words before we go on. A <strong>frame</strong> is a message in its layer 2 envelope: an Ethernet header with a <em>to</em>
and a <em>from</em> MAC address, and something inside. A <strong>packet</strong> is, strictly, the layer 3 thing inside it, with
IP addresses. Wireshark and everyone else say &ldquo;packet&rdquo; for both, and so will I, except where the difference
matters.</p>
<p>Each frame in a capture is stored with a few extra facts the capture added:</p>
<ul>
<li><strong>when</strong> it was seen, to the nanosecond in the lab&rsquo;s files;</li>
<li><strong>where</strong> it was seen: the name of the interface it was captured on;</li>
<li><strong>how long</strong> it was on the wire, and how many of those bytes were saved (more on that in
<a href="/lessons/wireshark-101/capture-vs-display-filters/">lesson 2</a>).</li>
</ul>
<p>Then the bytes, exactly as they were.</p>
<hr>
<h2 id="how-do-wiresharks-three-panes-map-to-the-layers">How do Wireshark&rsquo;s three panes map to the layers?</h2>
<p>Open a capture and Wireshark shows three panes, top to bottom.</p>
<table>
  <thead>
      <tr>
          <th>Pane</th>
          <th>What it shows</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>Packet list</strong></td>
          <td>one line per frame: number, time, source, destination, protocol, length, a one-line summary</td>
      </tr>
      <tr>
          <td><strong>Packet details</strong></td>
          <td>the frame you clicked, one layer per line, each one opens to show its fields</td>
      </tr>
      <tr>
          <td><strong>Packet bytes</strong></td>
          <td>the same frame as raw hex. Click a field in the details and its bytes light up</td>
      </tr>
  </tbody>
</table>
<p>The packet list is for finding things. Here&rsquo;s the start of the lab&rsquo;s first capture, taken on the laptop&rsquo;s
cable while it pings the printer, as tshark (Wireshark&rsquo;s command-line twin, version 4.6.5 here) prints it:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">    3 2.177114918 aa:aa:aa:11:11:11 → Broadcast    ARP 42 Who has 192.168.1.20? Tell 192.168.1.175
</span></span><span class="line"><span class="cl">    4 2.177311459 aa:aa:aa:22:22:22 → aa:aa:aa:11:11:11 ARP 42 192.168.1.20 is at aa:aa:aa:22:22:22
</span></span><span class="line"><span class="cl">    5 2.177313709 192.168.1.175 → 192.168.1.20 ICMP 98 Echo (ping) request  id=0x0926, seq=1/256, ttl=64
</span></span><span class="line"><span class="cl">    6 2.177450834 192.168.1.20 → 192.168.1.175 ICMP 98 Echo (ping) reply    id=0x0926, seq=1/256, ttl=64 (request in 5)
</span></span></code></pre></div><p>Two things in that list are worth knowing straight away. The <strong>Protocol</strong> column is the <em>highest</em> layer
Wireshark recognized, not the only one: a ping is ICMP inside IP inside Ethernet. And the source and
destination columns show IP addresses when there&rsquo;s an IP layer, and fall back to MAC addresses when there
isn&rsquo;t, which is why the ARP lines look different.</p>
<p>The details pane is where the layers from Networking 101&rsquo;s
<a href="/lessons/networking-101/task-1-2/">OSI lesson</a> become visible. Click frame 5 and you get:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Frame 5: Packet, 98 bytes on wire (784 bits), 98 bytes captured (784 bits) on interface laptop:eth1, id 0
</span></span><span class="line"><span class="cl">Ethernet II, Src: aa:aa:aa:11:11:11 (aa:aa:aa:11:11:11), Dst: aa:aa:aa:22:22:22 (aa:aa:aa:22:22:22)
</span></span><span class="line"><span class="cl">Internet Protocol Version 4, Src: 192.168.1.175, Dst: 192.168.1.20
</span></span><span class="line"><span class="cl">Internet Control Message Protocol
</span></span></code></pre></div><table>
  <thead>
      <tr>
          <th>Line</th>
          <th>Layer</th>
          <th>What it holds</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>Frame</strong></td>
          <td>none: Wireshark&rsquo;s own notes</td>
          <td>when and where the capture saw it, its length</td>
      </tr>
      <tr>
          <td><strong>Ethernet II</strong></td>
          <td>2, data link</td>
          <td>the MAC addresses, and the type of what&rsquo;s inside</td>
      </tr>
      <tr>
          <td><strong>Internet Protocol Version 4</strong></td>
          <td>3, network</td>
          <td>the IP addresses, the TTL, the protocol inside</td>
      </tr>
      <tr>
          <td><strong>Internet Control Message Protocol</strong></td>
          <td>3, carried in IP</td>
          <td>the ping itself</td>
      </tr>
  </tbody>
</table>
<p>For a web request you&rsquo;d see TCP (layer 4) under IP, and HTTP under that. The order is the order of the
envelopes on the wire: outermost first. Reading top to bottom is unwrapping the package.</p>
<p>The <strong>Frame</strong> line is the one people misread. It isn&rsquo;t a protocol and nothing on the wire sent it. It&rsquo;s the
capture&rsquo;s own label on the frame: the arrival time, the interface, the lengths. You&rsquo;ll use it more than you&rsquo;d
think, because &ldquo;on interface laptop:eth1&rdquo; is the answer to &ldquo;where was this seen?&rdquo;.</p>
<p>The bytes pane is the honest one. The details pane is Wireshark&rsquo;s <em>interpretation</em> of those bytes, made by a
<strong>dissector</strong>: the piece of Wireshark that knows how to decode one protocol. Dissectors are very good, but
when one guesses wrong (a protocol on an unusual port, say), the bytes are still right.</p>
<hr>
<h2 id="what-do-the-timestamps-mean">What do the timestamps mean?</h2>
<p>Every frame gets a timestamp from the machine doing the capturing, at the moment the capture saw it. Not when
the sender built it, and not when the receiver read it. That distinction matters as soon as you capture at
more than one place, because two capture points have two clocks.</p>
<p>Wireshark shows the time in the packet list as <strong>seconds since the first frame</strong> by default. You can switch
it (View › Time Display Format) to the time of day, or to the time since the previous frame, which is what
you want when you&rsquo;re looking for a pause. The real time is always in the Frame line:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Arrival Time: Nov 11, 2026 01:46:20.722588928 UTC
</span></span></code></pre></div><p>Timestamps are where a capture turns into measurements. In the capture above, the printer&rsquo;s ARP reply came
196.5 microseconds after the laptop&rsquo;s question (frame 3 to frame 4), and the first ping&rsquo;s reply came 137
microseconds after the request (frame 5 to frame 6). Those numbers are from the laptop&rsquo;s cable, so they include
the switch, the printer&rsquo;s own processing, and the switch again. A ping in the lab&rsquo;s second capture, to a web
server two routers away, took 566 microseconds, measured on the switch&rsquo;s port towards the first router. Time
between a question and its answer, measured on the asker&rsquo;s cable, is the round trip that user actually
experienced. Measured anywhere else, it&rsquo;s the round trip from that point onwards.</p>
<hr>
<h2 id="whats-the-difference-between-pcap-and-pcapng">What&rsquo;s the difference between pcap and pcapng?</h2>
<p>Captures are saved in one of two file formats.</p>
<p><strong>pcap</strong> is the original, from the tcpdump world. It&rsquo;s simple: a short file header, then one record per
frame. <strong>pcapng</strong> (<em>pcap next generation</em>) is what Wireshark saves by default today, and what the lab&rsquo;s
captures use. It&rsquo;s built from blocks, so it can say much more about the capture.</p>
<table>
  <thead>
      <tr>
          <th></th>
          <th>pcap</th>
          <th>pcapng</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Interfaces per file</td>
          <td>one link type, no names</td>
          <td>several, each with its name</td>
      </tr>
      <tr>
          <td>Timestamp resolution</td>
          <td>microseconds (the classic format)</td>
          <td>per interface; nanoseconds in the lab&rsquo;s files</td>
      </tr>
      <tr>
          <td>Comments</td>
          <td>no</td>
          <td>on the file and on each frame</td>
      </tr>
      <tr>
          <td>Which program made it</td>
          <td>no</td>
          <td>yes</td>
      </tr>
      <tr>
          <td>Who can read it</td>
          <td>nearly everything</td>
          <td>Wireshark, tshark, tcpdump&rsquo;s libpcap and most current tools</td>
      </tr>
  </tbody>
</table>
<p>Here&rsquo;s what that means in practice. The lab&rsquo;s capture of two switch ports, converted from pcapng to pcap with
Wireshark&rsquo;s <code>editcap</code>, went from 1,524 bytes to 1,186. The bytes saved are the bad news: the interface names
<code>sw1:eth1</code> and <code>sw1:eth3</code> were gone (every frame now came from one nameless interface), and every timestamp
lost its last three digits:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">pcapng: 1794361588.669028918
</span></span><span class="line"><span class="cl">pcap:   1794361588.669028000
</span></span></code></pre></div><p>The interface name is the bit you&rsquo;ll miss. When one file holds two capture points, that name is the only way
to tell them apart. So keep captures in pcapng, and only convert when a tool demands pcap.</p>
<hr>
<h2 id="why-does-where-you-capture-decide-what-you-see">Why does where you capture decide what you see?</h2>
<p>This is the section to remember. A capture records one point in the network, and what crosses that point
depends on what&rsquo;s around it.</p>
<h3 id="a-hosts-own-port">A host&rsquo;s own port</h3>
<p>Capture on a host&rsquo;s cable, as the lab&rsquo;s first task does on the laptop, and you see everything that host sends
and everything sent to it, plus the network&rsquo;s broadcasts. That&rsquo;s the easy case, because the host is one end of
every conversation you&rsquo;re looking at.</p>
<h3 id="a-switch-port-other-peoples-unicast-isnt-there">A switch port: other people&rsquo;s unicast isn&rsquo;t there</h3>
<p>Networking 101&rsquo;s <a href="/lessons/networking-101/task-2-1/">lesson on switches</a> gave the rule. A switch sends a
frame for one MAC address out of <strong>one port</strong>, the one where it learned that address. It sends a broadcast
out of <strong>every</strong> port. It floods a frame for an address it hasn&rsquo;t learned yet out of every port too, but only
until it learns it.</p>
<p>So a capture on a switch port sees that port&rsquo;s own host, the broadcasts, and the occasional flood. Nothing
else. The lab shows it with two captures taken at once, on sw1&rsquo;s port towards r1 and its port towards the
printer, while the laptop pings a server on another network:</p>
<table>
  <thead>
      <tr>
          <th>Seen on</th>
          <th>ARP</th>
          <th>ICMP (pings and replies)</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>r1&rsquo;s port, <code>sw1:eth1</code></td>
          <td>the laptop&rsquo;s request and r1&rsquo;s reply</td>
          <td>all 6</td>
      </tr>
      <tr>
          <td>the printer&rsquo;s port, <code>sw1:eth3</code></td>
          <td>the laptop&rsquo;s request only</td>
          <td>0</td>
      </tr>
  </tbody>
</table>
<p>The printer&rsquo;s cable carried exactly one frame of that conversation: the ARP request, because it was a
broadcast. r1&rsquo;s reply was addressed to the laptop alone, and the pings were addressed to r1&rsquo;s MAC address, so
the switch never sent them anywhere near the printer. That&rsquo;s the switch doing its job.</p>
<p>It&rsquo;s also why &ldquo;I&rsquo;ll plug my laptop into a spare switch port and capture&rdquo; doesn&rsquo;t work. You&rsquo;ll see broadcasts,
your own traffic, and very little else. In the days of hubs, which repeated everything to everyone, it did
work. Switches ended that.</p>
<h3 id="mirror-ports-and-taps">Mirror ports and taps</h3>
<p>Real networks solve this in two ways.</p>
<p>A <strong>mirror port</strong> (Cisco calls it <strong>SPAN</strong>, for <em>switched port analyzer</em>) is a switch feature: you tell the
switch to send a copy of everything on one or more ports, or a whole VLAN, out of another port, where your
capture machine sits. It costs nothing but configuration. The catch is that it&rsquo;s the switch&rsquo;s best effort:
a mirror port can only send as much as its own link carries, so if you mirror more traffic than that, some
copies are dropped, and your capture is missing frames the real network delivered.</p>
<p>A <strong>tap</strong> is a small device you put in the cable itself. It passes the traffic through and copies it to a
monitoring port. It sees exactly what was on the wire, but you have to break the cable to install it, which
is why taps go in during planned work and stay there.</p>
<p>The lab does something closer to a tap: <code>containerlab capture</code> records a port from outside the node, so
nothing on the laptop or the switch knows it&rsquo;s being watched, and you can capture any cable in the network.</p>
<h3 id="inside-a-host-versus-on-the-wire">Inside a host versus on the wire</h3>
<p>There&rsquo;s one more place to capture: on the host itself, with Wireshark installed on the laptop. That&rsquo;s the
most common capture there is, and it comes with a surprise.</p>
<p>Modern network cards do work the operating system used to do. Two kinds of this <strong>offload</strong> change what a
capture on the host shows. With <em>checksum offload</em>, the card fills in the IP and TCP checksums just before
the frame leaves, so a capture of outgoing traffic, taken before the card, sees checksums that haven&rsquo;t been
calculated yet. With <em>segmentation offload</em>, the operating system hands the card one big block of data and
the card cuts it into frames, so the capture shows &ldquo;packets&rdquo; larger than the network&rsquo;s MTU, which no
real cable could have carried. Wireshark&rsquo;s own
<a href="https://wiki.wireshark.org/CaptureSetup/Offloading">page on offloading</a> explains both.</p>
<p>Neither is a fault. Both are the capture being honest about where it is: above the card, not on the wire.
If a host capture shows bad checksums on everything it sent, or 1,500-byte limits apparently ignored,
check offloads before you suspect the network.</p>
<table>
  <thead>
      <tr>
          <th>Capture point</th>
          <th>Sees</th>
          <th>Doesn&rsquo;t see</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>on the host itself</td>
          <td>what that host sent and received, as the OS saw it</td>
          <td>other hosts&rsquo; traffic; the final checksums and frame sizes</td>
      </tr>
      <tr>
          <td>a switch port</td>
          <td>that port&rsquo;s host, broadcasts, floods</td>
          <td>other hosts&rsquo; unicast</td>
      </tr>
      <tr>
          <td>a mirror (SPAN) port</td>
          <td>copies of the ports or VLAN you chose</td>
          <td>copies the switch dropped when the mirror was full</td>
      </tr>
      <tr>
          <td>a tap</td>
          <td>exactly what was on that cable</td>
          <td>anything on another cable</td>
      </tr>
  </tbody>
</table>
<hr>
<h2 id="what-i-see-go-wrong">What I see go wrong</h2>
<p><strong>Capturing in the wrong place, and believing the silence.</strong> Someone captures on the server, sees no
request, and concludes the client never sent one. Maybe it didn&rsquo;t. Or maybe it was dropped on the way, or
went to a different server. A capture can prove a frame crossed a point. Its absence only proves it didn&rsquo;t
cross <em>that</em> point. The fix is a second capture closer to the sender, and lesson 8 of this course is built
around it.</p>
<p><strong>Expecting a switch port to show everyone.</strong> It won&rsquo;t, as the table above shows. If you need someone else&rsquo;s
traffic, capture on their port, on the uplink they use, or on a mirror of it.</p>
<p><strong>Comparing timestamps from two machines.</strong> Two captures taken on two computers use two clocks. A few
milliseconds&rsquo; difference between them is often just the clocks disagreeing. Compare times <em>within</em> one capture,
or use one machine that records both points into one file, which is what the lab does.</p>
<p><strong>Reading checksum errors as damage.</strong> On a host capture, outgoing frames with &ldquo;incorrect&rdquo; checksums are
almost always checksum offload. Damaged frames on a real wire usually don&rsquo;t reach a capture at all, because
the receiving card throws them away.</p>
<p><strong>Saving in a format that loses the answer.</strong> A multi-point capture converted to pcap has lost the one field
that says which point each frame came from.</p>
<hr>
<h2 id="try-it">Try it</h2>
<p><a href="/labs/wireshark-101/#chapter-1">Chapter 1 of the lab</a> has you take your first capture on the laptop&rsquo;s cable,
open it in Wireshark in your browser, read the three panes, and then capture two switch ports at once to see
for yourself which cable carried which frames.</p>
<h2 id="whats-next">What&rsquo;s next</h2>
<p>A busy network gives you thousands of frames a second.
<a href="/lessons/wireshark-101/capture-vs-display-filters/">Lesson 2</a> is about cutting that down: capture filters,
which decide what&rsquo;s saved at all, and display filters, which decide what you look at, and the one small
operator whose meaning changed under everyone&rsquo;s feet.</p>
]]></content:encoded></item></channel></rss>