A connection to a port that is closed fails in about a millisecond. A connection to a port behind a firewall that silently drops packets can hang for more than a minute, and tcpdump shows exactly why: the client sends the same opening packet eleven times, at gaps that start at one second and keep doubling. Both outcomes begin with the same packet, the first step of TCP’s three-way handshake. Everything below was captured with tcpdump between two isolated network namespaces on a Linux 6.18 kernel, one running a tiny web server on port 8080, so every line shown is real traffic.
Three packets before any data
What the handshake is for
RFC 9293, the current TCP specification, calls the three-way handshake the procedure used to establish a connection. Before either side sends a byte of real data, both agree on starting sequence numbers so every later byte can be counted, acknowledged and resent if lost.
The capture
The client at 10.9.0.2 connected to the server at 10.9.0.1, port 8080. tcpdump, run with -nn to skip name lookups and -S to print raw sequence numbers, recorded:
10.9.0.2.58582 > 10.9.0.1.8080: Flags [S], seq 4163037152, win 64240, options [mss 1460,sackOK,TS val 3115473929 ecr 0,nop,wscale 10], length 0
10.9.0.1.8080 > 10.9.0.2.58582: Flags [S.], seq 494652663, ack 4163037153, win 65160, options [mss 1460,sackOK,...,wscale 10], length 0
10.9.0.2.58582 > 10.9.0.1.8080: Flags [.], ack 494652664, win 63, options [nop,nop,TS val 3115473929 ecr 3466861944], length 0
Three packets: SYN, SYN-ACK, ACK. Only after the third one did data move.
Reading the flags
The tcpdump manual lists the letters: S for SYN, F for FIN, P for PSH, R for RST, and a dot for ACK. So [S] is a bare SYN, [S.] is SYN plus ACK, [.] is a plain acknowledgment, and [P.] is data pushed with an acknowledgment. Spotting those four combinations is most of what reading a TCP capture requires.

What each number means
Sequence numbers start at random
The client chose 4,163,037,152 as its starting sequence number. The server chose 494,652,663. RFC 9293 requires that the function generating these numbers must not be computable from the outside, because an attacker who can predict them could inject packets into a connection without seeing its traffic. Large, unrelated numbers in a capture are a sign things are working.
Acknowledgments count one past
The server’s SYN-ACK acknowledged 4,163,037,153, exactly one more than the client’s starting number. The client’s final ACK acknowledged 494,652,664, one more than the server’s. A SYN consumes one sequence number even though it carries no data, so “ack N” means “everything up to N−1 arrived; send N next.”
Relative numbers are easier
Without -S, tcpdump prints the first sequence number of a conversation in full and every later one as an offset from it, which the manual describes as its default. The same capture then read ack 1 and seq 1:19, which makes it easy to see that the client’s request was bytes 1 through 18.
The options negotiate the rest
Inside the brackets, each side announced its maximum segment size (mss 1460, the largest chunk of data it accepts in one packet), support for selective acknowledgment (sackOK), timestamps (TS val), and a window scale (wscale 10) that multiplies the advertised window size. The win 63 in the third packet is not 63 bytes; scaled by 2 to the 10th power, it is about 64 KB.
Data, then a four-packet goodbye
The request and response
[P.], seq 4163037153:4163037171, ack 494652664, length 18: HTTP: GET / HTTP/1.0
[.], ack 4163037171, length 0
[P.], seq 494652664:494652686, ack 4163037171, length 22: HTTP: HTTP/1.0 200 OK
[.], ack 494652686, length 0
The client sent 18 bytes; the server acknowledged byte 4,163,037,171, the next one it expected. The server sent 22 bytes back; the client acknowledged those. Every byte in both directions is accounted for by number.
Closing takes four packets
10.9.0.1.8080 > 10.9.0.2.58582: Flags [F.], seq 494652686
10.9.0.2.58582 > 10.9.0.1.8080: Flags [F.], seq 4163037171, ack 494652687
10.9.0.1.8080 > 10.9.0.2.58582: Flags [.], ack 4163037172
Here the server closed first with a FIN, and the client answered with its own FIN combined with an acknowledgment, then the server acknowledged that. A full close can take four packets because each direction shuts down separately; this one fit in three because the client combined its acknowledgment with its own FIN.
The side that closes first waits
Immediately afterwards, ss -tan on the server showed:
TIME-WAIT 0 0 10.9.0.1:8080 10.9.0.2:51548
RFC 9293 says the side that closes first must linger in the TIME-WAIT state for twice the maximum segment lifetime, so any delayed packets from the old connection die out before the same address and port pair can be reused. Busy servers that close many short connections can accumulate thousands of these; Linux limits the total with a setting called tcp_max_tw_buckets, according to the kernel’s networking sysctl documentation.

A closed port answers with RST
Two packets and done
A second test connected to port 9999, where nothing was listening:
10.9.0.2.33834 > 10.9.0.1.9999: Flags [S], seq 631486174, win 64240, ...
10.9.0.1.9999 > 10.9.0.2.33834: Flags [R.], seq 0, ack 631486175, win 0, length 0
The server replied with a reset. RFC 9293 covers exactly this case: if no connection exists, a reset is sent in response to any incoming segment, and a SYN that matches no existing connection is rejected this way. The client’s program received “Connection refused” almost instantly.
What RST tells a troubleshooter
A reset proves three things at once: the packet reached the machine, the machine is up, and nothing is listening on that port (or a firewall chose to send a rejection). When a service is “refused,” the problem is on the server: the service isn’t running, is bound to a different address, or is on another port.
A firewall drop and the retransmit schedule
The silent case
An nftables rule on the server dropped everything to port 7777 without replying. The client’s connection attempt, given 70 seconds before being stopped, produced this in tcpdump, with each line showing the time since the previous packet:
| SYN | Gap before it |
|---|---|
| 1st | (start) |
| 2nd to 6th | about 1 second each |
| 7th | 2.0 s |
| 8th | 4.2 s |
| 9th | 8.2 s |
| 10th | 16.1 s |
| 11th | 33.3 s |
Eleven identical SYNs, same sequence number every time, each one unanswered.
Where that schedule comes from
The kernel’s sysctl documentation explains both phases. tcp_syn_retries, default 6, sets how many times the initial SYN is retransmitted with exponential backoff. tcp_syn_linear_timeouts, default 4, sets how many retransmissions use a fixed linear timeout first. The documentation says the defaults correspond to 67 seconds until the last retransmission, with the final failure after 131 seconds. The test machine reported both defaults (tcp_syn_retries = 6, tcp_syn_linear_timeouts = 4), and the capture matched: a burst of one-second retries, then 2, 4, 8, 16 and 33 seconds, with the eleventh SYN about 68 seconds after the first.
Older kernels and the documentation for them describe only the exponential part, starting at one second, which is why many guides quote different totals. Checking sysctl net.ipv4.tcp_syn_retries net.ipv4.tcp_syn_linear_timeouts on the actual machine settles it.
Why this matters
A program that “hangs” when connecting is often looking at a silent drop, not a slow server. tcpdump on the client makes the difference obvious within seconds: repeated [S] lines with nothing coming back mean the SYNs are disappearing somewhere along the path, usually a firewall, a wrong route or a host that is down. Programs avoid the two-minute wait by setting their own connect timeout, which is why browsers and command-line tools usually give up sooner than the kernel would.

Commands for reading handshakes
Useful tcpdump filters
tcpdump -nn -i eth0 'tcp port 443': everything on one port.tcpdump -nn 'tcp[tcpflags] & (tcp-syn|tcp-rst) != 0': only SYNs and resets, a quick view of who is trying to connect and who is refusing.tcpdump -nn -w file.pcap ...thentcpdump -nn -r file.pcap: capture now, read later, or open the file in Wireshark.- Add
-Sfor absolute sequence numbers when comparing captures from both ends of a connection.
Patterns at a glance
| What tcpdump shows | What it means |
|---|---|
[S], [S.], [.] |
Healthy connection set up |
[S] then [R.] |
Reached the host; port closed or rejected |
Repeated [S], no reply |
Packets dropped on the way or host down |
[S], [S.] repeated, no [.] |
Reply not getting back to the server; often a return-path or asymmetric routing problem |
Three packets to open, a handful to close, and a numbering scheme that accounts for every byte. Most connection problems turn out to be one of those few packets missing, and the capture shows which one within a few lines.
Sources
- RFC 9293, Transmission Control Protocol (TCP), RFC Editor: https://www.rfc-editor.org/rfc/rfc9293.html
- tcpdump(1) manual page, tcpdump.org: https://www.tcpdump.org/manpages/tcpdump.1.html
- IP Sysctl, The Linux Kernel documentation: https://docs.kernel.org/networking/ip-sysctl.html
