Use it when show commands and logs disagree with what the application reports, and you need proof of what was on the wire.
Packet Capture
Packet capture on Linux records the packets an interface sends and receives, usually with tcpdump, so you can see exactly what left, what arrived and when.
1. ip route get <dst> — capture on that interface.
2. Start tcpdump -ni <if> -w /tmp/cap.pcap host <ip> and port <port>.
3. Reproduce the problem, note the time, stop with Ctrl+C.
4. Requests leave, no replies arrive → beyond this host.
5. Nothing leaves → the host never sent it: routing, firewall or the application.
right interface chosen → filter matches the flow → full packets written → problem reproduced during capture → packets in both directions examined → conclusion tied to timestamps
For Network Troubleshooting → Packet Capture, continue with the first unproven Topic check: Choose the capture point deliberately: namespace/interface/any, ingress/egress if supported, host pairs and protocol/port filter. If that boundary is healthy, advance to the adjacent check: Record exact time, interface counters and offload state; use sufficient snap length and avoid overly narrow filters during initial localization. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
tcpdump -ni <iface> icmp6Primary Commands
Configuration and operational commands for this Topic.
tcpdump -ni <iface> icmp6ReferenceCapture ICMPv6 including ND and Packet Too Big.
Linux · mixedtcpdump -ni <iface> <filter>ReferenceCapture packets using BPF filters.
Linux · mixedtcpdump -ni {{interface}} {{filter}}TroubleshootCaptures packets on an interface without name resolution.
Linux · mixedVerification & 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 evidence path Verify boundary
original traffic generation → kernel/socket → local routing/firewall → capture hook/interface → external path → remote endpoint → return traffic → local capture → socket/application consumption
Healthy evidence: capture shows the expected request/response progression at the intended observation point and aligns with socket/application timing and adjacent path evidence.
Step 2 Verification and output interpretation Verify boundary
Existing fast checks for this Topic. - Choose the capture point deliberately: namespace/interface/any, ingress/egress if supported, host pairs and protocol/port filter.
- Record exact time, interface counters and offload state; use sufficient snap length and avoid overly narrow filters during initial localization.
- Correlate SYN/SYN-ACK/ACK, retransmissions, resets, ICMP errors, DNS responses or relevant protocol events with socket/application timing.
- Capture the opposite side or next boundary when needed, then repeat the original workload after the minimal change to show recovery.
Verification chain. original traffic generation → kernel/socket → local routing/firewall → capture hook/interface → external path → remote endpoint → return traffic → local capture → socket/application consumption
Step 3 Commands Verify boundary
tcpdump -ni eth0 -w cap.pcap host 10.0.0.5 and port 443
tcpdump -nn -r cap.pcap | head
tshark -r cap.pcap -Y tls.handshake
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: packets disappear between boundaries, retransmit/reset/ICMP patterns contradict expected flow, capture scope is ambiguous, or offload/filter artifacts are misread as network faults.
Packet capture shows only what was observed at the chosen hook/interface/namespace/time/filter; end-to-end conclusions require correlation with adjacent capture points, socket state and the original application result.
Step 5 Common mistakes Narrow the fault
- Capturing without filters and filling the disk.
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.
Capture on the interface the traffic really uses (ip route get), with a filter to keep it small, and write to a file for Wireshark. Offloading makes outgoing packets look too large or with bad checksums in the capture; that is not an error on the wire. -i any loses Ethernet headers.
tcpdump -D— interfaces available for capture.tcpdump -ni <if> host <ip> and port <port>— live view without name lookups.tcpdump -ni <if> -s 0 -w /tmp/cap.pcap host <ip>— full packets to a file.tcpdump -nr /tmp/cap.pcap— read a file back.ethtool -k <if>— offload settings that affect what the capture shows.ip route get <dst>— which interface to capture on.
ReferenceWhat it is1 section · depth on demand
Core model
A capture is evidence at one observation point. Pin interface/namespace, direction, snap length, offload context, filter and clock; reproduce the original traffic; then interpret sequence/flags/ICMP/DNS or protocol exchange together with routing, firewall, socket and remote-side evidence. Missing packets show absence only at the capture point when coverage is known.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
Packet capture shows only what was observed at the chosen hook/interface/namespace/time/filter; end-to-end conclusions require correlation with adjacent capture points, socket state and the original application result.
tcpdump Command remains the existing command leaf; Networking/Firewall/application Topics own interpretation and remediation at their respective boundaries.
In depth
Packet capture with tcpdump
When logs and connection tests don't explain a problem, a packet capture shows what actually happens on the wire. The tcpdump(1) manual page documents the options used most:
-iselects the interface.anycaptures on all of them, but not in promiscuous mode.-nkeeps addresses and ports numeric, and-eshows link-layer headers.-cstops after a number of packets.-wwrites raw packets to a file, and-rreads one.-ssets the snapshot length (default 262144 bytes).-C,-Gand-Wrotate capture files, and-Zdrops privileges after opening the device.- A non-zero "packets dropped by kernel" count means the capture buffer overflowed, which
-Bcan enlarge.
The pcap-filter(7) manual page defines the filter language:
host,net,portandportrange, withsrc/dstqualifiers.- Protocols such as
tcp,udpandicmp. and,orandnot, with parentheses.- TCP flags with
tcp[tcpflags], and VLANs withvlan <id>.
Filters for common questions
| Question | Filter |
|---|---|
| Traffic to or from one host | host 10.30.0.40 |
| One service | tcp port 5432 |
| Only connection attempts | 'tcp[tcpflags] & tcp-syn != 0 and tcp[tcpflags] & tcp-ack == 0' |
| Resets | 'tcp[tcpflags] & tcp-rst != 0' |
| DNS | udp port 53 or tcp port 53 |
| Exclude your own SSH session | not port 22 |
| A VLAN on a trunk | vlan 110 and host 10.110.0.64 |
Capturing safely on production
| Practice | Reason |
|---|---|
| Always use a filter | Less load; fewer drops; less sensitive data |
-w to a file, analyse elsewhere | Wireshark gives better analysis |
Rotation with -C/-W, or a packet count | No full disks |
| Capture on both ends when possible | Shows whether packets leave and whether they arrive |
| Treat capture files as sensitive | They contain payloads, sometimes credentials |
host$ sudo tcpdump -ni eth0 -c 6 'host 10.30.0.40 and tcp port 5432'
16:12:01.100 IP 10.110.0.64.51822 > 10.30.0.40.5432: Flags [S], seq 3127, win 64240, length 0
16:12:02.131 IP 10.110.0.64.51822 > 10.30.0.40.5432: Flags [S], seq 3127, win 64240, length 0
16:12:04.179 IP 10.110.0.64.51822 > 10.30.0.40.5432: Flags [S], seq 3127, win 64240, length 0
db1$ sudo tcpdump -ni eth0 -c 3 'tcp port 5432 and host 10.110.0.64'
16:12:01.101 IP 10.110.0.64.51822 > 10.30.0.40.5432: Flags [S], seq 3127, win 64240, length 0
host$ sudo tcpdump -ni any -w /tmp/pg-%H%M.pcap -G 300 -W 12 -Z tcpdump 'tcp port 5432'
host$ tcpdump -nr /tmp/pg-1615.pcap 'tcp[tcpflags] & tcp-rst != 0' | head
Reading the two captures
The client retransmits its SYN, and gets no answer. On db1, the SYN arrives, but there is no SYN-ACK. The packet reaches the server, which doesn't respond. So the cause is on db1: a host firewall dropping the packet, or nothing listening on that address with RST blocked. That's a conclusion only a capture on both ends can give.
Documented example, not captured output.
How it works at runtime
Packet Capture is part of Network Troubleshooting → Packet Capture. Packet Capture uses Linux capture facilities such as tcpdump/libpcap to observe packets at a selected interface/namespace and time so troubleshooting can distinguish what the host sent, received, retransmitted, rejected or never observed.
Topic-specific state model. Packet Capture uses Linux capture facilities such as tcpdump/libpcap to observe packets at a selected interface/namespace and time so troubleshooting can distinguish what the host sent, received, retransmitted, rejected or never observed.
Interpretation rule. - Packet absent in one capture ≠ packet absent everywhere; wrong interface/namespace/filter or offload can hide it.
- Packet visible on egress ≠ remote received it; path devices can drop later.
- Response visible on wire ≠ application consumed it; local firewall/socket/process can fail after capture point.
- Checksum errors in local capture ≠ wire corruption when checksum offload defers calculation to NIC hardware.
Quick reference
Packet capture with tcpdump:
tcpdump -ni eth0 host 10.20.30.40 and port 443
tcpdump -ni any -w /tmp/cap.pcap -C 100 -W 5 'port 53 or port 853' # ring buffer
tcpdump -nni eth0 'tcp[tcpflags] & (tcp-syn|tcp-rst) != 0'
tcpdump -ni eth0 -e vlan # show VLAN tags/MACs
tcpdump -r /tmp/cap.pcap -nn | head
tshark -r cap.pcap -Y 'tcp.analysis.retransmission'
Capture on both ends to see where packets disappear. -i any loses link-layer headers (use a specific interface for VLAN/MAC analysis). Offloads (GRO/TSO) make captured packets look larger than the MTU — normal.
Limits and how it fails
Primary failure point. Packet capture shows only what was observed at the chosen hook/interface/namespace/time/filter; end-to-end conclusions require correlation with adjacent capture points, socket state and the original application result.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. Packet Capture owns Linux packet-observation methodology. tcpdump Command remains the existing command leaf; Networking/Firewall/application Topics own interpretation and remediation at their respective boundaries.
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 Troubleshooting → Packet Capture. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.kernel.org/networking/index.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.
Quick lookup tables
Packet Capture operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for Packet Capture.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | Packet Capture uses Linux capture facilities such as tcpdump/libpcap to observe packets at a selected interface/namespace and time so troubleshooting can distinguish what the host sent, received, retransmitted, rejected or never observed. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin exact host/namespace + original name or endpoint → capture link/address/route/resolver state → reproduce original failure → localize first failed resolver/network boundary → collect bounded packet/socket or DNS evidence → change one demonstrated cause → read back effective state → repeat original application transaction and an adjacent regression check. | Use the shortest evidence path first; a fast check is a boundary test, not blanket proof. |
| Verification chain | original traffic generation → kernel/socket → local routing/firewall → capture hook/interface → external path → remote endpoint → return traffic → local capture → socket/application consumption | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | Packet capture proves only what was observed at the chosen hook/interface/namespace/time/filter; end-to-end conclusions require correlation with adjacent capture points, socket state and the original application result. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux DNS/network evidence can establish this proof path: original traffic generation → kernel/socket → local routing/firewall → capture hook/interface → external path → remote endpoint → return traffic → local capture → socket/application consumption | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It does not independently prove behavior outside the captured host/network namespace, resolver path or DNS view, interface/source, destination/protocol/port, capture point, time or workload scope. Packet capture proves only what was observed at the chosen hook/interface/namespace/time/filter; end-to-end conclusions require correlation with adjacent capture points, socket state and the original application result. | Do not promote a local success signal into end-to-end or adjacent-dependency proof. |
| Next troubleshooting check | Continue from the first unproven DNS/network boundary: preserve the original source and failure conditions, capture the adjacent resolver/socket/packet state, change only the demonstrated cause, then repeat the original application lookup or transaction and adjacent regression checks. | Continue to the next unresolved boundary while preserving the original test condition. |
Packet Capture · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | Packet Capture |
|---|---|
| Topic path | Network Troubleshooting → Packet Capture |
| Runtime state | Packet Capture uses Linux capture facilities such as tcpdump/libpcap to observe packets at a selected interface/namespace and time so troubleshooting can distinguish what the host sent, received, retransmitted, rejected or never observed. |
| Fast checks | - Choose the capture point deliberately: namespace/interface/any, ingress/egress if supported, host pairs and protocol/port filter. - Record exact time, interface counters and offload state; use sufficient snap length and avoid overly narrow filters during initial localization. - Correlate SYN/SYN-ACK/ACK, retransmissions, resets, ICMP errors, DNS responses or relevant protocol events with socket/application timing. - Capture the opposite side or next boundary when needed, then repeat the original workload after the minimal change to prove recovery. |
| Verification chain | original traffic generation → kernel/socket → local routing/firewall → capture hook/interface → external path → remote endpoint → return traffic → local capture → socket/application consumption Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary. |
| Failure boundary | Packet capture proves only what was observed at the chosen hook/interface/namespace/time/filter; end-to-end conclusions require correlation with adjacent capture points, socket state and the original application result. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |