Lesson 8 of 9 · 26m
Packet and Socket Evidence: tcpdump, ss, ethtool, and Counters
Collect packet-level and kernel-level evidence without drowning in noise — capture filters, drop counters, socket states, and interface statistics that actually answer questions.
Good evidence answers a narrow question. 'Capture everything for five minutes' usually produces a large file and no conclusion. The craft is choosing the observation point and filter so that presence or absence of a packet means something.
Capture where the decision happens
tcpdump -ni eth0 host 192.0.2.25 and tcp port 443
tcpdump -ni any 'tcp port 443 and (tcp[tcpflags] & tcp-syn != 0)'-n avoids DNS noise and delays. -i any is useful when you do not know which interface is involved, but it also mixes vantage points and can obscure direction. Prefer the exact interface once topology is known.
Presence on ingress but absence on egress means the packet entered the host and did not leave. Presence on neither means your problem is upstream or your capture point is wrong. Absence of evidence is useful only when you know the observation point was correct.
Match socket truth to process truth
ss -lntup
ss -tanp state established '( dport = :443 or sport = :443 )'
ss -sA process bound to 127.0.0.1:8080 cannot receive external traffic no matter how permissive the firewall is. A process bound to :::443 may be dual-stack depending on bindv6only; do not guess from the colon count alone. ss output plus process identity beats lsof folklore because it shows the kernel socket state directly.
Interface statistics are deltas, not decorations
ip -statistics link show dev eth0
ethtool -S eth0 | egrep -i 'drop|error|miss|fifo' | head -40Take a snapshot, reproduce the failure, take another. A counter that exists is not a problem; a counter that increments exactly during failure is evidence. RX errors suggest Layer 1 or driver issues. TX drops can point to queue exhaustion. NIC-specific ethtool counters require driver knowledge, so compare behavior rather than treating names as universal.
Drops often need tracing, not vibes
dropwatch -l kas 2>/dev/null | head
nft monitor tracenft monitor trace requires rules using meta nftrace or trace-enabled chains in many setups; it is powerful but verbose. On production systems, short bounded captures beat open-ended tracing. Correlate by five-tuple and timestamp.
MTU and fragmentation in practice
If small probes pass and large transfers stall, test path MTU:
ping -M do -s 1472 192.0.2.1
ping -M do -s 1400 192.0.2.1
tracepath 192.0.2.25TCP MSS clamping can mask the symptom for TCP while leaving UDP and encapsulation broken. Treat clamping as a compatibility measure, not a substitute for knowing the real path limit.
Field notes
- tcpdump shows packets before some firewall processing depending on hook and direction; do not use capture presence alone as proof of acceptance.
- On busy hosts, capture filters belong in the command line, not as an afterthought in Wireshark.
- Rotate captures with
-Cand-Wonly when you know what time window matters; endless ring buffers erase the event. - Check both sides when possible. A retransmission may mean loss outbound, loss inbound, or filtering in either direction.
ethtool eth0link speed and duplex matter most on bare metal; virtual NICs often report synthetic values.
Was this lesson helpful?