Use it when connections are refused or reset: work out at which point the reset came and which device really sent it.
TCP Flags & Reset Forensics
1. Find the reset and what came just before: a SYN, a request, a long silence?
2. After a SYN → ss -ltn on the server; no listener, or a firewall reject.
3. After silence → an idle timeout on the path; add keepalives.
4. Compare the reset's TTL with the server's other packets.
5. Capture at the server too: did it send the reset — or receive one?
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
tcpdump -ni eth0 'tcp[tcpflags] & (tcp-rst) != 0'Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational verification Verify boundary
tcpdump -ni eth0 'tcp[tcpflags] & (tcp-rst) != 0'
tcpdump -ni eth0 -v host 192.0.2.10 and tcp port 443
ss -ltn
The first prints only resets. With -v, tcpdump also prints the IP TTL and identification of each packet, for comparing a reset with the same host's other packets. ss -ltn on the server confirms whether anything listens on the port.
In Wireshark: tcp.flags.reset == 1 finds resets; then open the connection (Follow → TCP Stream) and look at what immediately preceded the reset — a SYN, a data segment after a long pause, a particular request.
Known-good: connections open with SYN, SYN-ACK, ACK and end with FIN from both sides, without resets.
Step 2 Failure isolation workflow Narrow the fault
- RST straight after the SYN. No listener on that port, or a firewall rejecting; compare the TTL with a ping reply from the same server.
- RST after the first request is sent. The application or an inspection device rejects the content; a reset whose TTL differs from the server's points to the device.
- RST on the first packet after a long silence. Something in the path, or the server, dropped the idle connection; add keepalives or lengthen the timeout.
- RST from the server during a download. The application aborted — check its logs — or the server ran out of resources.
- Both ends report "reset by peer" and neither sent one. A device in the middle reset both sides.
- RST from a client immediately after SYN-ACK. The client did not send the SYN — a spoofed source or a scan — or its firewall forgot its own request.
- No reset, just a timeout. A silent drop, not a rejection; look for a filter or a routing problem.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
tcpdump -ni <if> 'tcp[tcpflags] & (tcp-rst) != 0'— only resets.tcpdump -ni <if> -v host <ip> and tcp port <port>— with TTL and IP ID, to compare a reset with the host's other packets.ss -ltnon the server — a listener on the port?- Wireshark:
tcp.flags.reset == 1, then follow the stream.
ReferenceWhat it is1 section · depth on demand
Mechanics & mental model
TCP flags are single bits in the header that mark what a segment is for: opening a connection, acknowledging data, closing politely, or aborting. A reset (RST) is the abort — it ends the connection immediately, with no further exchange.
ReferenceWhy it matters1 section · depth on demand
Why it matters operationally
A reset is the clearest signal TCP gives, and the most misattributed. The device that receives it sees only "connection reset by peer" — but the reset may have been sent by the server's operating system, by the application, or by a firewall in between pretending to be the server. Working out who sent it, and at what point in the connection, usually identifies the fault.
ReferenceHow it works1 section · depth on demand
How it works
| Flag | Value | Meaning |
|---|---|---|
| FIN | 0x01 | "I have no more data to send" — orderly close of one direction |
| SYN | 0x02 | Opens a connection and sets the starting sequence number |
| RST | 0x04 | Abort: the connection does not exist or must end now |
| PSH | 0x08 | Deliver the data to the application without waiting for more |
| ACK | 0x10 | The acknowledgment number is valid; set on every segment after the first SYN |
| URG | 0x20 | Urgent data; rarely used |
| ECE, CWR | 0x40, 0x80 | Explicit congestion notification |
Normal combinations: SYN; SYN+ACK; ACK; PSH+ACK (data); FIN+ACK. Tools abbreviate them — [S], [S.], [.], [P.], [F.], [R], [R.] in tcpdump.
When a reset is sent — and by whom.
| Moment | Sender | Meaning |
|---|---|---|
| In reply to a SYN | The server's operating system | The host is up, but nothing listens on that port |
| In reply to a SYN | A firewall | The rule says "reject" — it answers on the server's behalf |
| In the middle of a connection | The application, through the operating system | The application closed abruptly, crashed, or closed while unread data remained |
| On a packet for a connection the host no longer knows | The operating system | The host restarted, or timed the connection out, and the other side did not notice |
| After an idle period, on the next packet | A firewall or load balancer | Its entry for the connection expired |
| In the middle of a connection, to both sides | An inspection device | It decided to block the content |
A firewall that drops silently produces no reset at all — only retransmissions and a timeout.
Telling the real sender. A reset forged by a device on the path carries the server's address, but usually betrays itself:
- Its IP TTL differs from that of the server's other packets, since it travelled fewer hops.
- Its IP identification field or TCP options do not fit the pattern of the server's other packets.
- A capture taken at the server shows no reset leaving — or shows the server receiving a reset too.
Capturing at both ends settles it.
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
Reset forensics: who sent the RST and why
A reset ends a connection immediately, so finding its origin is often the key to a "connection dropped" problem. RFC 9293 defines when TCP sends one. A segment that arrives for a connection that doesn't exist (CLOSED) gets a RST. An ACK that arrives at a listening socket gets a RST. In SYN-SENT, an ACK that doesn't acknowledge the SYN gets a RST. In synchronised states, RFC 5961 checks apply: only a RST whose sequence number exactly equals RCV.NXT resets the connection, while an in-window but inexact RST triggers a challenge ACK.
Who sends resets
| Source | Typical trigger | Clue in the capture |
|---|---|---|
| The destination host | Nothing listening on the port | RST, ACK in direct reply to the SYN |
| The destination host | The application aborts (linger 0, crash) | RST in the middle of a connection, from the server's address |
| A firewall or IPS | Policy reject, or a session that timed out | TTL or IP ID that differs from the server's other packets |
| A load balancer | Health or idle timeout | RST from the VIP, often after an idle period |
| Either host after a reboot | Old connection no longer known | RST answering data on a connection |
Separating host resets from middlebox resets
| Check | Host-generated | Middlebox-generated |
|---|---|---|
| IP TTL | Same as the host's other packets | Often different |
| Timing | Immediate | May follow a fixed idle time |
| Sequence number | Fits the connection exactly | Sometimes slightly off, causing challenge ACKs |
| Both directions | Seen at both ends | May be sent to both ends while the real hosts never sent one |
host$ sudo tcpdump -ni eth0 -v 'tcp[tcpflags] & tcp-rst != 0 and host 10.30.0.15'
10:52:11.402 IP (tos 0x0, ttl 61, id 0, ...) 10.30.0.15.443 > 10.110.0.64.50414: Flags [R], seq 409982, win 0, length 0
host$ sudo tcpdump -ni eth0 -v 'tcp and host 10.30.0.15' | grep -o "ttl [0-9]*" | sort | uniq -c
812 ttl 62
1 ttl 61
fw# show conn address 10.110.0.64 detail
fw# show asp drop | include tcp
One RST with TTL 61 among server packets with TTL 62 means something one hop closer than the server sent that reset. Here that is most likely the firewall.
Documented example, not captured output.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Network & Protocols → TCP Flags & Reset Forensics. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc9293.html · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Operational notes
Former standalone Cheat Sheet content now lives directly inside the Topic where it belongs.
TCP Flags Decoder
SYN/ACK/FIN/RST/PSH/URG/ECE/CWR.
30-second lookup
- Open Packet Field Explorer for field-level metadata.
- Use Packet Decoders for bit/flag values where relevant.
- Use Paste Output / Structured Parser for CLI evidence.
- Use Packet Filters to prove the wire boundary.
Evidence rule
A decoded field proves what is present in that packet/output at that moment. Continue through the verification chain before concluding end-to-end behavior.