portfolio terminal
Networking
From Ethernet to HTTP (Wireshark)
A practical walkthrough of Ethernet, IPv4, TCP, and HTTP headers, using Packet Diagram and Flow Graph to examine a single Wireshark conversation.
A browser requests a web page, and the server sends it back. From the browser's perspective, that might look like a single action. In a packet capture, we can see the addresses, connection setup, acknowledgments, and application messages that make it happen.
Wireshark separates this information into protocol layers. Each layer answers a different question: where should the data go on the local network, which IP address is the destination, which connection does it belong to, and what is the application requesting?
For this walkthrough, I am usinghttp-wireshark-trace1-1.pcapng from the Kurose and Ross Wireshark labs. The capture was recorded on January 30, 2021, and contains a browser retrieving a small HTML page. It uses unencrypted HTTP/1.1, which make it ideal to examine the application headers directly.
We will follow one connection and use Packet Diagram to inspect its headers and Flow Graph to understand the exchange between the client and server.
Start with the conversation
Open the capture and apply this display filter:
tcp.stream == 4
This selects the TCP conversation between client 10.0.0.44, using port 54968, and server 128.119.245.12, using port 80. Nine packets remain visible.
The stream number is assigned by Wireshark. It is not a value transmitted inside the TCP header. Similarly, the frame numbers identify packets within this capture file.
The conversation begins with frame 87, where the client sends a TCP segment with the SYN flag set. The server replies with SYN, ACK in frame 89, and the client acknowledges that response in frame 91. This handshake establishes the connection and synchronizes the sequence numbers used to track data in each direction.
The HTTP request follows in frame 93. The server acknowledges its bytes in frame 94, then sends an HTTP response in frame 95. The client acknowledges the response in frame 96.
To display these exchanges visually, open Statistics → Flow Graph and enable Limit to display filter.
Select TCP Flows to focus on the TCP exchange.
Near the end, frame 117 contains a FIN, ACK from the server. The client acknowledges it in frame 118.
This shows the server finishing its side of the connection. The capture does not contain the client's own FIN and the corresponding acknowledgment, so this is not a complete TCP shutdown.
Keeping the surrounding packets visible helps us interpret individual headers. A packet carrying application data makes more sense when we can also see the connection it belongs to and the acknowledgment that follows.
Reading frame 93 from the outside in
Select frame 93, the HTTP GET request. Wireshark identifies several protocols within the same captured frame: Ethernet II, IPv4, TCP, and HTTP.
These are nested structures. The Ethernet frame carries an IP packet, the IP packet carries a TCP segment, and the TCP segment carries the HTTP request. What counts as payload at one layer can contain another layer's header.
For this particular frame, the captured bytes break down as follows:
| Part | Size | Purpose |
|---|---|---|
| Ethernet II header | 14 bytes | Delivery over the local link |
| IPv4 header | 20 bytes | IP addressing and packet handling |
| TCP header | 32 bytes | Connection and transport information |
| HTTP request | 507 bytes | Request line and HTTP header fields |
| Total captured frame | 573 bytes |
Enable View → Packet Diagram.
By the way, if this is greyed out, you should enable it first by going to Edit → Preferences... → Layout.
Right-click inside the diagram and select Show Field Values to include the values from the selected packet.
This pane presents protocol fields in a layout similar to those used in networking specifications.
Start with the Ethernet header. Its source MAC address is 78:4f:43:98:d9:27, and its destination MAC address is 00:50:f1:80:00:00. These addresses describe delivery over the link represented in the capture.
The destination MAC address should not be interpreted as the remote web server's MAC address. When traffic travels to another network, the local destination is normally the next hop, such as a gateway. The IP destination can remain the remote server while the link-layer addresses change along the route.
The Ethernet Type field contains 0x0800, identifying the enclosed payload as IPv4.
Moving into the IPv4 header, we find source address 10.0.0.44 and destination address 128.119.245.12. The Protocol field contains 6, identifying TCP as the protocol carried inside this IP packet.
The IPv4 Header Length is 20 bytes, while Total Length is 559 bytes. Total Length includes the IP header and its payload. Adding the 14-byte Ethernet header gives us the 573 bytes recorded for this frame.
Another useful IPv4 field is Time to Live, or TTL, which is 64 in this request. Routers reduce this value as they forward the packet, preventing traffic from circulating indefinitely. It is not a timeout for the browser or the TCP connection. The Don't Fragment flag is also set, intstructing routers not to fragment this IPv4 packet. These fields belong to IP packet handling, as described in RFC 791.
Now look at the TCP header.
Its source port is 54968, and its destination port is 80. Together with the IP addresses, these identify the endpoints of this TCP connection.
Port 80 is commonly associated with HTTP, but the port number alone does not establish which application protocol is present. Here, we can examine the payload and see an actual HTTP request.
The TCP header is 32 bytes long, rather than the minimum of 20 bytes. Expanding Options reveals a timestamp option and two padding bytes.
The header-length field tells the receiver where those options end and the application data begins.
The sequence and acknowledgment numbers become easier to understand when we compare neighboring packets. By default, Wireshark displays relative sequence numbers, using smaller values to make the exchange easier to follow. These are calculated display values. The original numbers remain available in Packet Details. Wireshark documents this behavior here.
In frame 93, the client’s relative sequence number is 1, and the TCP payload contains 507 bytes. Those bytes occupy positions 1 through 507. In frame 94, the server returns an acknowledgment number of 508: that is the next byte it expects.
TCP acknowledges bytes, not packet numbers. The acknowledgment does not mean “I received frame 93,” and it does not establish that the web application successfully processed the request. It confirms receipt at the transport layer. The HTTP response provides the application-level result.
Frame 93 also has PSH and ACK set.
ACK indicates that its acknowledgment field is valid. PSH requests that the receiving TCP implementation pass the data onward without waiting for additional data merely to fill a buffer. It does not identify an HTTP message boundary. In this capture, the request happens to fit inside one segment; larger messages can span several segments.
Finally, the TCP Window field (next to the flags field) advertises receive capacity. Frame 93 contains a raw window value of 2058, while Wireshark shows a calculated window of 131712 bytes. The difference comes from window scaling negotiated during the handshake:2058 × 64 = 131712. This is an example of why interpreting one header sometimes requires earlier packets.
Reading the HTTP request and response
Expand Hypertext Transfer Protocol in frame 93.
For this part, Packet Details is especially useful because HTTP/1.1 expresses its request line and header fields as readable text.
The request begins with:
GET /wireshark-labs/HTTP-wireshark-file1.html HTTP/1.1
Host: gaia.cs.umass.edu
The first line contains the method, request target, and HTTP version. The client is requesting the resource at /wireshark-labs/HTTP-wireshark-file1.html.
The Host header identifies the hostname being requested. An IP address can serve multiple websites, so the destination IP address alone may not tell us which site the client intended to reach. HTTP uses this additional information to identify the requested resource.
The request also contains a User-Agent value identifying itself as Chrome 88 on macOS. That is useful context, but it is supplied by the client and can be changed. It is not proof that a particular browser or operating system generated the traffic.
The Accept fields describe preferences for the response. In this capture, Accept-Encoding: gzip, deflate indicates supported content encodings, while Accept-Language: en-US,en;q=0.9 expresses language preferences. These describe what the client is willing to receive. They do not establish what the server actually sends.
Now select frame 95. The server's response begins with:
HTTP/1.1 200 OK
Among its response headers are:
Content-Length: 128
Content-Type: text/html; charset=UTF-8
The status line reports a successful response. Content-Type describes the returned representation as HTML using UTF-8, while Content-Length indicates that the response content is 128 bytes long.
That number is smaller than the TCP payload, which is 486 bytes. There is no contradiction: the TCP payload contains the HTTP status line and headers as well as the 128-byte HTML body.
The response also includes a Server header advertising Apache and several software versions. Such information can help identify technologies worth investigating, but a banner alone does not establish the server’s current patch state or prove that a particular vulnerability is present.
Returning to TCP, frame 95 starts at relative sequence number 1 and carries 486 bytes. The client acknowledges 487 in frame 96. The same relationship we saw for the request now appears in the opposite direction.
Because this exchange uses plaintext HTTP, anyone with access to these captured packets can read the hostname, path, headers, and response body. An HTTPS capture would normally protect the HTTP messages inside TLS, so this application-level view would require successful decryption.
Even this small exchange supports several different observations: the client established a TCP connection, sent a specific request, received a successful HTTP response, and acknowledged the response bytes. Each observation comes from particular fields and packets.
The next time you open a capture, start with one conversation and one packet. Work through the headers, then look at the surrounding packets to see how their values change. A sequence number advances, an acknowledgment follows, or the direction reverses. Connecting those small changes is how you truly learn to read the conversation, rather than just recognize the fields.