Skip to content

Opening and closing TCP connections

Module
TCP, UDP, and Ports
Difficulty
Easy
Updated
Tested on
Ubuntu 24.04.5 LTS, netlab 1.0, GNU Bash 5.2.21, tcpdump 4.99.4
On this page

In Following an exchange, you left some rows before and after the request unexplained. They contain no page words, yet belong to the same conversation. Read those rows to see how laptop and web agree to talk, check which bytes arrived, and finish.

Finish Processes, sockets, and ports. Keep modes off, leave machine shells and run netlab reset from the VM if needed. Open two terminals on laptop with netlab shell laptop. Start the listener before sending. Type your Ubuntu password when sudo asks; nothing appears while you type it.

In terminal 1 run sudo tcpdump -n -i eth0 tcp port 80. This filter selects TCP traffic involving port 80. In terminal 2 run curl -sS http://10.77.20.80/hello.txt. Return to the listener and press Ctrl+C after curl finishes.

Fetch hello.txt over TCP — listener
learner@laptop:~$ sudo tcpdump -n -i eth0 tcp port 80[sudo] password for learner: tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes08:25:31.710723 IP 10.77.10.10.45326 > 10.77.20.80.80: Flags [S], seq 1205958452, win 64240, options [mss 1460,sackOK,TS val 306269755 ecr 0,nop,wscale 10], length 0
08:25:31.710768 IP 10.77.20.80.80 > 10.77.10.10.45326: Flags [S.], seq 1661005969, ack 1205958453, win 65160, options [mss 1460,sackOK,TS val 4281951379 ecr 306269755,nop,wscale 10], length 0
08:25:31.710776 IP 10.77.10.10.45326 > 10.77.20.80.80: Flags [.], ack 1, win 63, options [nop,nop,TS val 306269755 ecr 4281951379], length 0
08:25:31.711008 IP 10.77.10.10.45326 > 10.77.20.80.80: Flags [P.], seq 1:84, ack 1, win 63, options [nop,nop,TS val 306269755 ecr 4281951379], length 83: HTTP: GET /hello.txt HTTP/1.1
08:25:31.711056 IP 10.77.20.80.80 > 10.77.10.10.45326: Flags [.], ack 84, win 64, options [nop,nop,TS val 4281951379 ecr 306269755], length 0
08:25:31.714454 IP 10.77.20.80.80 > 10.77.10.10.45326: Flags [P.], seq 1:173, ack 84, win 64, options [nop,nop,TS val 4281951382 ecr 306269755], length 172: HTTP: HTTP/1.0 200 OK
08:25:31.714486 IP 10.77.10.10.45326 > 10.77.20.80.80: Flags [.], ack 173, win 63, options [nop,nop,TS val 306269758 ecr 4281951382], length 0
08:25:31.715103 IP 10.77.20.80.80 > 10.77.10.10.45326: Flags [P.], seq 173:189, ack 84, win 64, options [nop,nop,TS val 4281951383 ecr 306269758], length 16: HTTP
08:25:31.715127 IP 10.77.10.10.45326 > 10.77.20.80.80: Flags [.], ack 189, win 63, options [nop,nop,TS val 306269759 ecr 4281951383], length 0
08:25:31.715161 IP 10.77.20.80.80 > 10.77.10.10.45326: Flags [F.], seq 189, ack 84, win 64, options [nop,nop,TS val 4281951383 ecr 306269759], length 0
08:25:31.715234 IP 10.77.10.10.45326 > 10.77.20.80.80: Flags [F.], seq 84, ack 190, win 63, options [nop,nop,TS val 306269759 ecr 4281951383], length 0
08:25:31.715281 IP 10.77.20.80.80 > 10.77.10.10.45326: Flags [.], ack 85, win 64, options [nop,nop,TS val 4281951383 ecr 306269759], length 0^C12 packets captured
12 packets received by filter
0 packets dropped by kernellearner@laptop:~$ 

Step-by-step replay of a verified session · Recorded on Ubuntu 24.04.5 LTS, networking lab (netlab 1.0), GNU Bash 5.2.21. Laptop's listener records the complete TCP exchange, including the rows around the file request.
Steps (10)
  1. Type sudo tcpdump -n -i eth0 tcp port 80
  2. Press Enter
  3. Output: [sudo] password for learner:
  4. Type the password (the terminal shows nothing)
  5. Press Enter
  6. Output: tcpdump: verbose output suppressed, use -v[v]... for full protocol decode listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
  7. The second terminal finished. Return here and press Ctrl+C to stop listening.
  8. Output: 08:25:31.710723 IP 10.77.10.10.45326 > 10.77.20.80.80: Flags [S], seq 1205958452, win 64240, options [mss 1460,sackOK,TS val 306269755 ecr 0,nop,wscale 10], length 0 08:25:31.710768 IP 10.77.20.80.80 > 10.77.10.10.45326: Flags [S.], seq 1661005969, ack 1205958453, win 65160, options [mss 1460,sackOK,TS val 4281951379 ecr 306269755,nop,wscale 10], length 0 08:25:31.710776 IP 10.77.10.10.45326 > 10.77.20.80.80: Flags [.], ack 1, win 63, options [nop,nop,TS val 306269755 ecr 4281951379], length 0 08:25:31.711008 IP 10.77.10.10.45326 > 10.77.20.80.80: Flags [P.], seq 1:84, ack 1, win 63, options [nop,nop,TS val 306269755 ecr 4281951379], length 83: HTTP: GET /hello.txt HTTP/1.1 08:25:31.711056 IP 10.77.20.80.80 > 10.77.10.10.45326: Flags [.], ack 84, win 64, options [nop,nop,TS val 4281951379 ecr 306269755], length 0 08:25:31.714454 IP 10.77.20.80.80 > 10.77.10.10.45326: Flags [P.], seq 1:173, ack 84, win 64, options [nop,nop,TS val 4281951382 ecr 306269755], length 172: HTTP: HTTP/1.0 200 OK 08:25:31.714486 IP 10.77.10.10.45326 > 10.77.20.80.80: Flags [.], ack 173, win 63, options [nop,nop,TS val 306269758 ecr 4281951382], length 0 08:25:31.715103 IP 10.77.20.80.80 > 10.77.10.10.45326: Flags [P.], seq 173:189, ack 84, win 64, options [nop,nop,TS val 4281951383 ecr 306269758], length 16: HTTP 08:25:31.715127 IP 10.77.10.10.45326 > 10.77.20.80.80: Flags [.], ack 189, win 63, options [nop,nop,TS val 306269759 ecr 4281951383], length 0 08:25:31.715161 IP 10.77.20.80.80 > 10.77.10.10.45326: Flags [F.], seq 189, ack 84, win 64, options [nop,nop,TS val 4281951383 ecr 306269759], length 0 08:25:31.715234 IP 10.77.10.10.45326 > 10.77.20.80.80: Flags [F.], seq 84, ack 190, win 63, options [nop,nop,TS val 306269759 ecr 4281951383], length 0 08:25:31.715281 IP 10.77.20.80.80 > 10.77.10.10.45326: Flags [.], ack 85, win 64, options [nop,nop,TS val 4281951383 ecr 306269759], length 0
  9. Press Ctrl + C
  10. Output: 12 packets captured 12 packets received by filter 0 packets dropped by kernel
Fetch hello.txt over TCP — send
learner@laptop:~$ curl -sS http://10.77.20.80/hello.txtHello from web.learner@laptop:~$ 

Step-by-step replay of a verified session · Recorded on Ubuntu 24.04.5 LTS, networking lab (netlab 1.0), GNU Bash 5.2.21. The second terminal requests hello.txt and receives the file text.
Steps (3)
  1. Type curl -sS http://10.77.20.80/hello.txt
  2. Press Enter
  3. Output: Hello from web.

TCP, the Transmission Control Protocol, delivers bytes from one program to the other in order and notices when some are missing. A connection is the record both ends keep while they talk. A handshake is the opening exchange that sets up the connection.

The first row has SYN, a request to start and agree on the starting numbers. Tcpdump writes it as S. Web answers with SYN and ACK, an acknowledgment of what it has received. Tcpdump uses a dot, ., for ACK, so this row shows [S.]. Laptop’s third row is [.]: acknowledgment alone.

Open, then send data

  1. laptop10.77.10.10
  2. web10.77.20.80
  1. SYN: laptop to web
  2. SYN and ACK: web to laptop
  3. ACK: laptop to web
  4. Request bytes: laptop to web

In the capture4 messages at laptop:eth0

  1. 1. SYN08:25:31.710724 02:77:10:00:00:10 > 02:77:10:00:00:01, ethertype IPv4 (0x0800), length 74: 10.77.10.10.45326 > 10.77.20.80.80: Flags [S], seq 1205958452, win 64240, options [mss 1460,sackOK,TS val 306269755 ecr 0,nop,wscale 10], length 0
  2. 2. SYN and ACK08:25:31.710768 02:77:10:00:00:01 > 02:77:10:00:00:10, ethertype IPv4 (0x0800), length 74: 10.77.20.80.80 > 10.77.10.10.45326: Flags [S.], seq 1661005969, ack 1205958453, win 65160, options [mss 1460,sackOK,TS val 4281951379 ecr 306269755,nop,wscale 10], length 0
  3. 3. ACK08:25:31.710776 02:77:10:00:00:10 > 02:77:10:00:00:01, ethertype IPv4 (0x0800), length 66: 10.77.10.10.45326 > 10.77.20.80.80: Flags [.], ack 1, win 63, options [nop,nop,TS val 306269755 ecr 4281951379], length 0
  4. 4. Request bytes08:25:31.711009 02:77:10:00:00:10 > 02:77:10:00:00:01, ethertype IPv4 (0x0800), length 149: 10.77.10.10.45326 > 10.77.20.80.80: Flags [P.], seq 1:84, ack 1, win 63, options [nop,nop,TS val 306269755 ecr 4281951379], length 83: HTTP: GET /hello.txt HTTP/1.1

Step-by-step model built from captured frames · Frames captured at laptop:eth0 while running curl -sS http://10.77.20.80/hello.txt, on Ubuntu 24.04.5 LTS, netlab 1.0, tcpdump 4.99.4. The values are the capture's. The opening and first data segment share one laptop-link capture with IP-address lanes naming the endpoints and routers omitted.Machines by IP address; captured at laptop:eth0. Routers on the path are not drawn.
Steps (4)

Machines by IP address; captured at laptop:eth0. Routers on the path are not drawn.

  1. SYN. laptop to web. Laptop asks to start. The data length is zero.08:25:31.710724 02:77:10:00:00:10 > 02:77:10:00:00:01, ethertype IPv4 (0x0800), length 74: 10.77.10.10.45326 > 10.77.20.80.80: Flags [S], seq 1205958452, win 64240, options [mss 1460,sackOK,TS val 306269755 ecr 0,nop,wscale 10], length 0
  2. SYN and ACK. web to laptop. Web agrees to start and acknowledges laptop’s SYN.08:25:31.710768 02:77:10:00:00:01 > 02:77:10:00:00:10, ethertype IPv4 (0x0800), length 74: 10.77.20.80.80 > 10.77.10.10.45326: Flags [S.], seq 1661005969, ack 1205958453, win 65160, options [mss 1460,sackOK,TS val 4281951379 ecr 306269755,nop,wscale 10], length 0
  3. ACK. laptop to web. Laptop acknowledges web’s SYN. No request bytes have been sent yet.08:25:31.710776 02:77:10:00:00:10 > 02:77:10:00:00:01, ethertype IPv4 (0x0800), length 66: 10.77.10.10.45326 > 10.77.20.80.80: Flags [.], ack 1, win 63, options [nop,nop,TS val 306269755 ecr 4281951379], length 0
  4. Request bytes. laptop to web. The first request bytes follow the opening. The data length is positive.08:25:31.711009 02:77:10:00:00:10 > 02:77:10:00:00:01, ethertype IPv4 (0x0800), length 149: 10.77.10.10.45326 > 10.77.20.80.80: Flags [P.], seq 1:84, ack 1, win 63, options [nop,nop,TS val 306269755 ecr 4281951379], length 83: HTTP: GET /hello.txt HTTP/1.1

The first three messages have zero data bytes. The request comes afterward. In the stage, the ports tell you who is talking. The flags show what each end is doing. Data length tells you whether the row carries application bytes.

The listener’s next [P.] row carries the request. P marks the push flag; this row carries data, but a push flag does not tell you where an application message ends. The dot still means ACK.

Find seq 1:84 and length 83 in that row. Tcpdump displays later sequence values relative to the start: bytes numbered 1 through 83 are being sent. The last number in the range is not included. Web’s following ack 84 says it expects byte 84 next. The stage’s acknowledgment field shows the full captured number instead. Tcpdump and the stage display the same numbering in different ways.

TCP uses these numbers and acknowledgments to notice missing bytes and send them again. No bytes are lost or sent again in this recording. Detailed sequence arithmetic, windows and retransmission belong to TCP Behavior and Packet Size.

FIN says an end has finished sending bytes. Tcpdump writes F; [F.] also acknowledges the other direction. Each side must finish its sending direction and have that finish acknowledged.

Finish both sending directions

  1. laptop10.77.10.10
  2. web10.77.20.80
  1. Web finishes: web to laptop
  2. Laptop finishes: laptop to web
  3. Web acknowledges: web to laptop

In the capture3 messages at laptop:eth0

  1. 1. Web finishes08:25:31.715161 02:77:10:00:00:01 > 02:77:10:00:00:10, ethertype IPv4 (0x0800), length 66: 10.77.20.80.80 > 10.77.10.10.45326: Flags [F.], seq 189, ack 84, win 64, options [nop,nop,TS val 4281951383 ecr 306269759], length 0
  2. 2. Laptop finishes08:25:31.715235 02:77:10:00:00:10 > 02:77:10:00:00:01, ethertype IPv4 (0x0800), length 66: 10.77.10.10.45326 > 10.77.20.80.80: Flags [F.], seq 84, ack 190, win 63, options [nop,nop,TS val 306269759 ecr 4281951383], length 0
  3. 3. Web acknowledges08:25:31.715281 02:77:10:00:00:01 > 02:77:10:00:00:10, ethertype IPv4 (0x0800), length 66: 10.77.20.80.80 > 10.77.10.10.45326: Flags [.], ack 85, win 64, options [nop,nop,TS val 4281951383 ecr 306269759], length 0

Step-by-step model built from captured frames · Frames captured at laptop:eth0 while running curl -sS http://10.77.20.80/hello.txt, on Ubuntu 24.04.5 LTS, netlab 1.0, tcpdump 4.99.4. The values are the capture's. The same connection closes in three captured messages because laptop combines its acknowledgment with its own finish.Machines by IP address; captured at laptop:eth0. Routers on the path are not drawn.
Steps (3)

Machines by IP address; captured at laptop:eth0. Routers on the path are not drawn.

  1. Web finishes. web to laptop. Web has no more bytes to send. It also acknowledges the request.08:25:31.715161 02:77:10:00:00:01 > 02:77:10:00:00:10, ethertype IPv4 (0x0800), length 66: 10.77.20.80.80 > 10.77.10.10.45326: Flags [F.], seq 189, ack 84, win 64, options [nop,nop,TS val 4281951383 ecr 306269759], length 0
  2. Laptop finishes. laptop to web. Laptop acknowledges web’s finish and sends its own FIN in the same message.08:25:31.715235 02:77:10:00:00:10 > 02:77:10:00:00:01, ethertype IPv4 (0x0800), length 66: 10.77.10.10.45326 > 10.77.20.80.80: Flags [F.], seq 84, ack 190, win 63, options [nop,nop,TS val 306269759 ecr 4281951383], length 0
  3. Web acknowledges. web to laptop. Web acknowledges laptop’s finish. Both sending directions have closed.08:25:31.715281 02:77:10:00:00:01 > 02:77:10:00:00:10, ethertype IPv4 (0x0800), length 66: 10.77.20.80.80 > 10.77.10.10.45326: Flags [.], ack 85, win 64, options [nop,nop,TS val 4281951383 ecr 306269759], length 0
Message Direction Flags Meaning
First opening laptop → web S Start
Second opening web → laptop S. Start and accept
Third opening laptop → web . Accept opening
Data laptop → web P. Request bytes
Web finish web → laptop F. No more bytes
Laptop finish laptop → web F. Accept and finish
Last reply web → laptop . Accept finish

A normal close does not always need four rows. Here laptop uses one message to do two jobs. Read all the flags in each row before counting the steps.

Predict: web has no listener on port 81. Does it stay silent or answer?

Repeat the experiment with listener filter tcp port 81 and curl -sS http://10.77.20.80:81/ in terminal 2.

Ask a closed TCP port — listener
learner@laptop:~$ sudo tcpdump -n -i eth0 tcp port 81[sudo] password for learner: tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes08:25:56.119850 IP 10.77.10.10.47718 > 10.77.20.80.81: Flags [S], seq 3200542471, win 64240, options [mss 1460,sackOK,TS val 3211202797 ecr 0,nop,wscale 10], length 0
08:25:56.119914 IP 10.77.20.80.81 > 10.77.10.10.47718: Flags [R.], seq 0, ack 3200542472, win 0, length 0^C2 packets captured
2 packets received by filter
0 packets dropped by kernellearner@laptop:~$ 

Step-by-step replay of a verified session · Recorded on Ubuntu 24.04.5 LTS, networking lab (netlab 1.0), GNU Bash 5.2.21. The attempted opening receives a reset from web's closed port.
Steps (10)
  1. Type sudo tcpdump -n -i eth0 tcp port 81
  2. Press Enter
  3. Output: [sudo] password for learner:
  4. Type the password (the terminal shows nothing)
  5. Press Enter
  6. Output: tcpdump: verbose output suppressed, use -v[v]... for full protocol decode listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
  7. The second terminal finished. Return here and press Ctrl+C to stop listening.
  8. Output: 08:25:56.119850 IP 10.77.10.10.47718 > 10.77.20.80.81: Flags [S], seq 3200542471, win 64240, options [mss 1460,sackOK,TS val 3211202797 ecr 0,nop,wscale 10], length 0 08:25:56.119914 IP 10.77.20.80.81 > 10.77.10.10.47718: Flags [R.], seq 0, ack 3200542472, win 0, length 0
  9. Press Ctrl + C
  10. Output: 2 packets captured 2 packets received by filter 0 packets dropped by kernel
Ask a closed TCP port — send
learner@laptop:~$ curl -sS http://10.77.20.80:81/curl: (7) Failed to connect to 10.77.20.80 port 81 after 0 ms: Couldn't connect to serverlearner@laptop:~$ 

Step-by-step replay of a verified session · Recorded on Ubuntu 24.04.5 LTS, networking lab (netlab 1.0), GNU Bash 5.2.21. Curl reports the failed connection rather than receiving a page.
Steps (3)
  1. Type curl -sS http://10.77.20.80:81/
  2. Press Enter
  3. Output: curl: (7) Failed to connect to 10.77.20.80 port 81 after 0 ms: Couldn't connect to server
Check your answer

Web answers [R.]. RST, written R, resets or rejects a connection. Curl prints curl: (7) Failed to connect to 10.77.20.80 port 81 after 0 ms: Couldn't connect to server. The connection was refused, but web answered.

“The handshake carries the page request.” The first data follows the three empty opening messages.

“Refused means the machine is down.” Web supplied the reset. The tested port did not accept this connection.

Ports, timestamps and starting sequence numbers vary; your number will differ. Keep long option lists as recorded, even when only the flags matter to your question.

Run the listener again and request index.html instead. Stop and compare: mark the opening, data and closing rows using their flags and lengths. Explain any message doing two jobs.

Solution
Mark index.html connection phases — listener
learner@laptop:~$ sudo tcpdump -n -i eth0 tcp port 80[sudo] password for learner: tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes08:26:21.454168 IP 10.77.10.10.34440 > 10.77.20.80.80: Flags [S], seq 1371011265, win 64240, options [mss 1460,sackOK,TS val 1715806243 ecr 0,nop,wscale 10], length 0
08:26:21.454224 IP 10.77.20.80.80 > 10.77.10.10.34440: Flags [S.], seq 699934166, ack 1371011266, win 65160, options [mss 1460,sackOK,TS val 1875603645 ecr 1715806243,nop,wscale 10], length 0
08:26:21.454232 IP 10.77.10.10.34440 > 10.77.20.80.80: Flags [.], ack 1, win 63, options [nop,nop,TS val 1715806243 ecr 1875603645], length 0
08:26:21.454272 IP 10.77.10.10.34440 > 10.77.20.80.80: Flags [P.], seq 1:85, ack 1, win 63, options [nop,nop,TS val 1715806243 ecr 1875603645], length 84: HTTP: GET /index.html HTTP/1.1
08:26:21.454279 IP 10.77.20.80.80 > 10.77.10.10.34440: Flags [.], ack 85, win 64, options [nop,nop,TS val 1875603645 ecr 1715806243], length 0
08:26:21.456736 IP 10.77.20.80.80 > 10.77.10.10.34440: Flags [P.], seq 1:173, ack 85, win 64, options [nop,nop,TS val 1875603647 ecr 1715806243], length 172: HTTP: HTTP/1.0 200 OK
08:26:21.456765 IP 10.77.10.10.34440 > 10.77.20.80.80: Flags [.], ack 173, win 63, options [nop,nop,TS val 1715806245 ecr 1875603647], length 0
08:26:21.459017 IP 10.77.20.80.80 > 10.77.10.10.34440: Flags [P.], seq 173:444, ack 85, win 64, options [nop,nop,TS val 1875603650 ecr 1715806245], length 271: HTTP
08:26:21.459038 IP 10.77.10.10.34440 > 10.77.20.80.80: Flags [.], ack 444, win 63, options [nop,nop,TS val 1715806248 ecr 1875603650], length 0
08:26:21.459076 IP 10.77.20.80.80 > 10.77.10.10.34440: Flags [F.], seq 444, ack 85, win 64, options [nop,nop,TS val 1875603650 ecr 1715806248], length 0
08:26:21.459174 IP 10.77.10.10.34440 > 10.77.20.80.80: Flags [F.], seq 85, ack 445, win 63, options [nop,nop,TS val 1715806248 ecr 1875603650], length 0
08:26:21.459246 IP 10.77.20.80.80 > 10.77.10.10.34440: Flags [.], ack 86, win 64, options [nop,nop,TS val 1875603650 ecr 1715806248], length 0^C12 packets captured
12 packets received by filter
0 packets dropped by kernellearner@laptop:~$ 

Step-by-step replay of a verified session · Recorded on Ubuntu 24.04.5 LTS, networking lab (netlab 1.0), GNU Bash 5.2.21. A separate laptop listener records the index.html exercise.
Steps (10)
  1. Type sudo tcpdump -n -i eth0 tcp port 80
  2. Press Enter
  3. Output: [sudo] password for learner:
  4. Type the password (the terminal shows nothing)
  5. Press Enter
  6. Output: tcpdump: verbose output suppressed, use -v[v]... for full protocol decode listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
  7. The second terminal finished. Return here and press Ctrl+C to stop listening.
  8. Output: 08:26:21.454168 IP 10.77.10.10.34440 > 10.77.20.80.80: Flags [S], seq 1371011265, win 64240, options [mss 1460,sackOK,TS val 1715806243 ecr 0,nop,wscale 10], length 0 08:26:21.454224 IP 10.77.20.80.80 > 10.77.10.10.34440: Flags [S.], seq 699934166, ack 1371011266, win 65160, options [mss 1460,sackOK,TS val 1875603645 ecr 1715806243,nop,wscale 10], length 0 08:26:21.454232 IP 10.77.10.10.34440 > 10.77.20.80.80: Flags [.], ack 1, win 63, options [nop,nop,TS val 1715806243 ecr 1875603645], length 0 08:26:21.454272 IP 10.77.10.10.34440 > 10.77.20.80.80: Flags [P.], seq 1:85, ack 1, win 63, options [nop,nop,TS val 1715806243 ecr 1875603645], length 84: HTTP: GET /index.html HTTP/1.1 08:26:21.454279 IP 10.77.20.80.80 > 10.77.10.10.34440: Flags [.], ack 85, win 64, options [nop,nop,TS val 1875603645 ecr 1715806243], length 0 08:26:21.456736 IP 10.77.20.80.80 > 10.77.10.10.34440: Flags [P.], seq 1:173, ack 85, win 64, options [nop,nop,TS val 1875603647 ecr 1715806243], length 172: HTTP: HTTP/1.0 200 OK 08:26:21.456765 IP 10.77.10.10.34440 > 10.77.20.80.80: Flags [.], ack 173, win 63, options [nop,nop,TS val 1715806245 ecr 1875603647], length 0 08:26:21.459017 IP 10.77.20.80.80 > 10.77.10.10.34440: Flags [P.], seq 173:444, ack 85, win 64, options [nop,nop,TS val 1875603650 ecr 1715806245], length 271: HTTP 08:26:21.459038 IP 10.77.10.10.34440 > 10.77.20.80.80: Flags [.], ack 444, win 63, options [nop,nop,TS val 1715806248 ecr 1875603650], length 0 08:26:21.459076 IP 10.77.20.80.80 > 10.77.10.10.34440: Flags [F.], seq 444, ack 85, win 64, options [nop,nop,TS val 1875603650 ecr 1715806248], length 0 08:26:21.459174 IP 10.77.10.10.34440 > 10.77.20.80.80: Flags [F.], seq 85, ack 445, win 63, options [nop,nop,TS val 1715806248 ecr 1875603650], length 0 08:26:21.459246 IP 10.77.20.80.80 > 10.77.10.10.34440: Flags [.], ack 86, win 64, options [nop,nop,TS val 1875603650 ecr 1715806248], length 0
  9. Press Ctrl + C
  10. Output: 12 packets captured 12 packets received by filter 0 packets dropped by kernel
Mark index.html connection phases — send
learner@laptop:~$ curl -sS http://10.77.20.80/index.html<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>web.lab.test</title>
</head>
<body>
<h1>web.lab.test</h1>
<p>This page comes from the lab machine web.</p>
<p><a href="hello.txt">hello.txt</a> · <a href="signin.html">Sign in</a></p>
</body>
</html>learner@laptop:~$ 

Step-by-step replay of a verified session · Recorded on Ubuntu 24.04.5 LTS, networking lab (netlab 1.0), GNU Bash 5.2.21. The second terminal fetches index.html while that listener runs.
Steps (3)
  1. Type curl -sS http://10.77.20.80/index.html
  2. Press Enter
  3. Output: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>web.lab.test</title> </head> <body> <h1>web.lab.test</h1> <p>This page comes from the lab machine web.</p> <p><a href="hello.txt">hello.txt</a> · <a href="signin.html">Sign in</a></p> </body> </html>

Mark SYN, SYN with ACK, and ACK as opening. A data length above zero marks a row that carries bytes. Follow each FIN to its acknowledgment for the close.

  • Read opening flags before application data.
  • Connect sequence ranges to acknowledgment numbers.
  • Separate an orderly finish from a reset.

Next, UDP datagrams shows an exchange without this opening and close.