Skip to content
Tech Interview Prep
Technical interview guide

Network Troubleshooting

Systematically isolating where in the stack a connectivity problem actually lives, instead of guessing.

Minutes to read
3
Practice MCQs
25
Interview Q&A
25
Edition
v5
Editorial status
Reviewed

Scope: Current Wireshark, tcpdump, Linux iproute2/ss/tc/ethtool, IETF host/TCP/ICMP/PMTUD/DNS/TLS references reviewed 2026-09-04.

Interview Q&A

Treat each question like a live interview question: answer out loud first (structure, assumptions, tradeoffs), then open the model answer to spot gaps and rehearse a tighter follow-up.

Curated: · Written: · Reviewed:

25 questions

Q&A-2

Map an end-to-end packet path for diagnosis.

Answer

What I'd say first

Assume one failing flow, client 10.20.1.5:44312 → VIP 10.0.0.10:443, and that I have access to the hosts and the routers. I walk the path once forward and once in reverse, and at every boundary I record the same four things: the 5-tuple as it exists there, the encapsulation, the effective MTU, and the state that decides forwarding (route, conntrack, ACL, LB session). I do both directions because the forward path is usually healthy: the break is almost always on the return, where NAT rewrites the tuple, ECMP picks a different box, or a stateful device has no entry.

The walk

Forward, hop by hop:

  1. Client host. ip route get 10.0.0.10 → via 10.20.1.1 dev eth0 src 10.20.1.5. That one line gives me source selection and the first nexthop.
  2. First router. ip route get 10.0.0.10 shows the chosen nexthop; ip route show 10.0.0.0/8 shows whether it is multipath. ECMP hashes the 5-tuple, so a different source port can take a different path: that is the asymmetry seed.
  3. LB / NAT. The VIP is DNAT'd to a backend, say 10.30.0.7:8443, and often SNAT'd to the LB address. conntrack -L -p tcp --dport 443 on the LB shows the exact rewrite and the reply tuple.
  4. Tunnel. If the backend is reached over VXLAN, the packet gains 50 bytes of outer header (20 IP + 8 UDP + 8 VXLAN + 14 inner Ethernet). On a 1500-byte underlay that leaves 1450 for the inner packet.
  5. Server. ss -tlnp confirms something is listening on 10.30.0.7:8443.

Reverse: the server replies from 10.30.0.7:8443 to whatever the LB SNAT'd to. If the LB is stateful and the reply lands on a different LB instance (ECMP again), there is no conntrack entry and the packet is dropped or RST.

Commands I actually run

  • ip route get <dst> at each L3 hop: exact route, source, nexthop.
  • conntrack -L on the NAT/LB: the rewrite and reply tuple.
  • tcpdump -ni eth0 'host 10.20.1.5 and port 443' on both ends, timestamps compared: shows where the packet stops.
  • ping -M do -s 1472 <dst>: 1472 + 28 = 1500; a failure here means MTU, not routing.
  • ss -tnp for socket state, ethtool -S for drops.

Trade-offs

Capturing at every hop is definitive but slow and needs access everywhere; bisecting (capture at the midpoint, then halve) finds the break in log2(hops) captures. Stateless ACLs are cheap but cannot tell you about NAT; conntrack is authoritative but only exists on the box that created the entry, so it is useless for a path that bypasses it.

Failure modes

  • Asymmetric ECMP: forward and reverse take different routers, and a stateful firewall on one path drops the return. Symptom: SYN reaches the server, SYN-ACK never returns. Detect with tcpdump on both ends.
  • MTU black hole: small packets pass, large ones vanish. Symptom: handshake completes, TLS ClientHello stalls. Detect with ping -M do.
  • Multi-leg proxy: client→proxy and proxy→server are separate TCP connections with separate tuples; a capture on one leg tells you nothing about the other. Detect by matching the proxy's own socket via ss.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-1

Scope an intermittent network incident.

Answer

To scope an intermittent network incident, I define the exact failing transaction, a near-identical healthy control, and the minimal evidence that separates them. Assume you have 10 minutes to produce a scope that lets someone else reproduce or falsify the failure.

First, state assumptions: you can capture on both endpoints, clocks are synchronized to within 10 ms via NTP, and you have a known-good control. If clocks aren't synced, fix that first: unsynchronized clocks make correlation impossible.

The scope is a tuple: client, server, protocol, port, UTC time window, expected result, observed result, rate, payload size, address family, path, versions, affected and unaffected cohorts, recent changes, business impact. But the tuple is not the answer; the reasoning is what each field lets you rule out.

Client/server identities: if the failure only happens from one client subnet, it's likely routing or firewall, not a server bug. Tradeoff: capturing full payloads gives application-layer detail but costs disk and may expose PII; capture headers only if you can.

Time and clock accuracy: without synchronized clocks, you can't correlate client and server logs. A 2 ms offset can make a server response look like it arrived before the request.

Rate and duration: 5% of calls over 10 minutes is different from 100% for 10 seconds. The former suggests a race or resource exhaustion; the latter suggests a hard failure.

Payload size and address family: a 1.2 KB request over IPv4 failing while a 1.2 KB request over IPv6 succeeds points to MTU or fragmentation.

Path and versions: if the failure only happens through one switch or firewall, or only with client v2.3.1, you've narrowed it.

Cohorts: if all failures are in us-east-1, it's regional. If they're spread, it's global.

Recent changes: a firewall rule update 2 hours ago is a prime suspect.

Now, the tradeoff: depth versus time-to-mitigate. If the incident is causing revenue loss, you might failover first and capture later. But if you failover without capturing, you lose the evidence. So capture a rolling buffer (e.g., tcpdump ring buffer of 100 MB) while you mitigate.

Failure modes of scoping itself: (1) You capture only one side, so you can't tell if the request left the client or the response left the server. Detect by comparing sequence numbers and timestamps. (2) You don't have a control, so you blame the network when the application is slow. Detect by running the same transaction from a known-good client. (3) You capture at too low a rate and miss the intermittent event. Detect by checking capture drop counters.

Here's a hypothetical worked example. Users report 5% of API calls to payments.example.com time out. You capture on client and server. The table below shows the scope.

AttributeFailureControlImplication
Client IP10.0.1.510.0.1.6Same subnet, so not client subnet
Server IP192.0.2.10192.0.2.10Same server
Protocol/portTCP/443TCP/443Same
Time (UTC)2025-01-15T14:32:01.123Z2025-01-15T14:32:02.456ZWithin same minute
ExpectedHTTP 200 in <200msHTTP 200 in <200msSame
ObservedTimeout after 10sHTTP 200 in 45msFailure is timeout
Rate5% of calls0%Intermittent
Payload1.2 KB request1.2 KB requestSame
Address familyIPv4IPv4Same
PathClient -> switch A -> firewall -> serverSameSame path
VersionsClient v2.3.1, server v4.1.0SameSame
CohortsAll clients in us-east-1All clients in us-east-1Not cohort-specific
Recent changesFirewall rule update 2h agoN/ASuspect

The failure trace shows no SYN-ACK. If you also capture on the server and see no SYN arriving, the drop is before the server. If you see SYN arriving but no SYN-ACK, the server is not responding: check listen backlog, SYN cookies, or firewall.

Failure (client capture):
t=0.000  client -> server: SYN seq=0
t=1.000  client -> server: SYN seq=0 (retransmit)
t=3.000  client -> server: SYN seq=0 (retransmit)
t=7.000  client -> server: SYN seq=0 (retransmit)
t=10.000 client: connection timeout

Control (client capture):
t=0.000  client -> server: SYN seq=0
t=0.012  server -> client: SYN-ACK seq=0 ack=1
t=0.013  client -> server: ACK seq=1 ack=1
t=0.045  client -> server: HTTP GET
t=0.090  server -> client: HTTP 200

State a falsifiable hypothesis with a bounded observation: 'If the server's SYN backlog is full, then increasing backlog from 1024 to 4096 will reduce timeouts to <0.1% within 5 minutes.' That's bounded and testable.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-6

Separate connect, TLS, and application failures.

Answer

What I'd say first

Before touching anything I'd pin down three things: which hop fails, whether I can reproduce it from the same client, and whether it's one path or every path to that host. Then I answer directly. It's a connect failure if the TCP handshake never completes, a TLS failure if TCP completes but the handshake doesn't, and an application failure if both complete and the request still fails. Those three have different owners and different fixes, so the first job is to localize, not to explain.

Assumptions: I control the client, I can reach the server's logs, and I'm chasing one failing path.

How to separate them

The cheap move is client-side timing. curl reports each phase separately:

curl -sS -o /dev/null -w 'dns=%{time_namelookup} connect=%{time_connect} tls=%{time_appconnect} ttfb=%{time_starttransfer} total=%{time_total} code=%{http_code}\n' https://api.example.com/health

On a 30 ms RTT path a healthy run looks like this (hypothetical figures):

dns=0.004 connect=0.034 tls=0.068 ttfb=0.101 total=0.104 code=200

Read the deltas. connect − dns = 30 ms, one RTT, so SYN/SYN-ACK/ACK completed. tls − connect = 34 ms, one more RTT, which is TLS 1.3; TLS 1.2 would cost two RTTs, about 60 ms here. ttfb − tls = 33 ms is the server thinking. If instead you see connect=5.000 tls=0.000, the SYN was dropped: a firewall or security group, not a TLS problem. If connect is sub-millisecond and total equals connect, you got a RST: nothing is listening on the port.

When timing isn't enough, drop a layer. ss -tanp shows socket state, so SYN-SENT versus ESTABLISHED tells you whether the handshake ever finished. openssl s_client -connect api.example.com:443 -servername api.example.com -alpn h2 prints the chain and the alert, which makes unknown_ca, name mismatch and no_application_protocol distinguishable. tcpdump is definitive but needs privileges and is heavy at scale.

Trade-offs

Client timing is free and needs no server access, but it tells you which layer, never why. Packet capture answers why but is privileged and expensive to run everywhere. Server logs with correlation IDs cover the application layer only, if the request never arrived they're silent, and that silence is itself a signal. So the deciding rule is: start with client timing to localize the layer, escalate to capture only when the layer is still ambiguous.

Failure modes

The one that bites is per-hop confusion. A client can complete TCP and TLS to a load balancer, receive an HTTP 502, and the real failure is a connect failure between the LB and the backend. The client's view says application; the truth is connect, one hop deeper. So separate per hop, not per request. The other concrete ones: TLS unknown_ca usually means a missing intermediate in the chain; ALPN mismatch means the server won't speak h2 and the client requires it; a hung backend shows as TLS complete, request sent, no first byte, then a timeout. Application, not transport.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-21

How do you detect and isolate a duplicate IP address conflict that causes intermittent connectivity for some hosts?

Answer

Assume one L2 broadcast domain, IPv4 ARP (IPv6 NDP has the same shape with ICMPv6 Neighbor Advertisements). A duplicate IP presents as two different MAC addresses answering ARP for the same IP. Connectivity is intermittent rather than dead because the sender's ARP cache holds one entry per IP: the last reply wins, so the cache flips between the two MACs. When it flips mid-flow, packets go to the wrong host, which has no matching socket and answers with a RST. That is the intermittent reset pattern.

Detection. Capture ARP replies for the suspect IP and look for two source MACs:

tcpdump -i eth0 -nn -e 'arp and arp[6:2] = 2 and arp[14:4] = 0xc000020a'

arp[6:2] = 2 selects replies; arp[14:4] is the sender protocol address field, 0xc000020a = 192.0.2.10. Abbreviated output:

14:22:01.114 00:11:22:33:44:55 > 00:aa:bb:cc:dd:ee, ethertype ARP, Reply 192.0.2.10 is-at 00:11:22:33:44:55, length 28 14:22:01.887 aa:bb:cc:dd:ee:ff > 00:aa:bb:cc:dd:ee, ethertype ARP, Reply 192.0.2.10 is-at aa:bb:cc:dd:ee:ff, length 28

Two replies, same queried IP, different MACs. On the affected host, ip neigh show 192.0.2.10 alternates between the two lladdr values with state REACHABLE/STALE. arping -D -I eth0 192.0.2.10 (DAD mode, source 0.0.0.0) exits non-zero if any host answers: a one-shot check before assigning a static address.

Isolation. Resolve each MAC to a physical location: bridge fdb show | grep 00:11:22:33:44:55 on a Linux bridge, or the switch MAC address table. Compare against the DHCP server's lease list for that IP. The usual causes are a static assignment colliding with a DHCP pool, a VM or container cloned from a snapshot that kept the MAC and IP, or a stale lease handed out while the original host was still up.

Before calling it a conflict, exclude legitimate multi-MAC cases:

ObservationLegitimate cause
two MACs for one IPVRRP 00:00:5e:00:01:{VRID}, HSRP 00:00:0c:07:ac:{group}
router answers for a remote hostproxy ARP
one MAC on two switch portsNIC bonding/teaming

For IPv6, the same check is tcpdump -i eth0 -nn -e 'icmp6 and ip6[40] == 136' (Neighbor Advertisement); two different target link-layer address options for one target address is the conflict. IPv6 hosts run Duplicate Address Detection before using an address, so a conflict often shows as dadfailed in ip -6 addr and a host with no usable address, rather than intermittent connectivity.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-3

Diagnose failed ARP or NDP resolution.

Answer

Core answer (first 90 seconds). Pin down what is actually being resolved before touching anything else. Run ip route get 10.0.0.20 (or ip -6 route get): if the output contains via <gw>, the neighbor you must resolve is the gateway, not the destination. A large share of "ARP is broken" tickets are a host resolving the wrong next hop. Then confirm the interface is up and in the right VLAN (ip -br link, ip -br addr), and read the neighbor table with ip neigh show dev eth0. INCOMPLETE means requests are leaving and nothing is answering; FAILED means the retransmit budget is exhausted; STALE is normal and not a fault. Capture on the host to see whether the request leaves and whether a reply returns.

Mechanism. ARP (RFC 826) broadcasts a request to ff:ff:ff:ff:ff:ff and expects a unicast reply. NDP (RFC 4861) sends a Neighbor Solicitation to the solicited-node multicast address ff02::1:ffXX:XXXX and expects a unicast Neighbor Advertisement; it is ICMPv6 type 135/136, so it is subject to IPv6 firewalls and ND inspection in a way ARP is not. Linux drives both through one neighbor state machine: INCOMPLETE → REACHABLE (confirmed within ReachableTime, base 30 s) → STALE (usable, revalidated on next use) → DELAY (5 s) → PROBE (3 unicast probes, 1 s apart) → FAILED. Defaults: mcast_solicit=3, retrans_time_ms=1000, ucast_solicit=3. A failed resolution is therefore a specific state with a specific retransmit count behind it, not "ARP is off".

statemeaningis it a fault?
INCOMPLETErequest sent, no reply yetyes, if it persists
REACHABLEconfirmed within ReachableTimeno
STALEusable, not recently confirmedno
DELAY / PROBErevalidating a stale entryno, transient
FAILEDprobes exhausted, no responseyes

Capture trace. Host 10.0.0.10 cannot reach 10.0.0.20; ip neigh show reports INCOMPLETE. tcpdump -ni eth0 arp shows:

14:02:11.101 ARP, Request who-has 10.0.0.20 tell 10.0.0.10, length 28
14:02:12.099 ARP, Request who-has 10.0.0.20 tell 10.0.0.10, length 28
14:02:13.097 ARP, Request who-has 10.0.0.20 tell 10.0.0.10, length 28

Three requests, 1 s apart, no reply: that is mcast_solicit=3 running out, after which the entry goes FAILED. The same shape for IPv6: tcpdump -ni eth0 'icmp6 and (ip6[40] == 135 or ip6[40] == 136)' shows NS out, no NA.

Failure modes and how to detect each.

  • Subnet mismatch: host treats an off-link peer as on-link. Symptom: requests for an address no one on the segment owns. Detect: ip route get shows no via, but the peer's netmask differs; compare ip -br addr on both ends.
  • VLAN/trunk mismatch: request leaves on the wrong VLAN. Detect: capture on both ends; request visible on host, absent on peer; show mac address-table on the switch.
  • Duplicate address: two hosts answer, neighbor entry flaps between MACs. Detect: arping -D -I eth0 10.0.0.20, or a capture showing two different source MACs replying to the same who-has.
  • Port security / DAI: switch drops the frame. DAI drops ARP whose MAC/IP pair is absent from the DHCP snooping binding table; symptom is request seen on host, never on peer, plus a switch log such as DAI-4-DHCP_SNOOPING_DENY. Detect: show ip arp inspection statistics, switch logs.
  • NDP filtering / RA Guard: ICMPv6 NS/NA dropped. Symptom: IPv4 resolves, IPv6 does not. Detect: capture shows NS out, no NA; check ip6tables -L -n and switch ND inspection.
  • Host-side suppression: arp_ignore/arp_filter or a firewall blocking inbound ICMPv6. Detect: sysctl values, firewall counters.
  • One-way link: reply arrives but is dropped: duplex mismatch or unidirectional fiber. Detect: ethtool -S eth0 error counters, ethtool eth0 for duplex.

Trade-offs. A static entry (ip neigh replace 10.0.0.20 lladdr 00:11:22:33:44:55 nud permanent) makes traffic flow immediately but hides the fault, breaks silently on MAC change or VM migration, and must be removed. Use it only as a bridge with a ticket. The real fix is at whichever layer broke: L2 (VLAN, port security, DAI), L3 (subnet/routing), or host (firewall, sysctl). Compare another neighbor on the same segment: if it resolves, the fault is peer-specific; if it does not, it is segment-wide. That single comparison halves the search space.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-4

Troubleshoot a route that appears present but traffic fails.

Answer

What I'd say first

Assume one flow is failing, not the whole prefix, and that "the route is present" means it shows in the RIB. The first move is to stop reading the route table and reproduce the lookup with the flow's exact tuple: source, destination, ingress interface, VRF/table, and mark. A route that exists for the default tuple can be absent, overridden, or unresolved for this one.

On Linux:

$ ip route get 10.1.2.3 from 10.0.0.5 iif eth0 mark 0x1
10.1.2.3 from 10.0.0.5 dev eth1 src 10.0.0.5 mark 0x1 uid 0

(illustrative output). Read three things: which dev won, which src was chosen, and whether it resolved at all. If policy routing is in play, ip rule show decides before the main table: the default rules are priority 0 (local), 32766 (main), 32767 (default), so any rule with a lower priority number than 32766 can silently steal the flow.

If the lookup resolves but traffic still dies, the fault is below the RIB. That split: control-plane presence vs. data-plane forwarding: is what the rest of the investigation hangs on.

Why a present route doesn't forward

A route enters the RIB when the protocol selects it, but it only enters the FIB when its next hop resolves. Recursive resolution fails if the next hop's own route is missing or points at a down interface; Cisco marks this in show ip bgp rib-failure. Even with a FIB entry, the adjacency can be incomplete: unresolved ARP/ND means packets are punted to the CPU and dropped, or dropped in hardware.

Symptom → check → what it proves

SymptomCheckProves
Lookup returns "Network is unreachable"ip route get <dst> from <src> iif <dev>No matching route for this tuple, or a rule stole it
Route in RIB, absent from FIBshow ip cef <prefix> detail, show ip bgp rib-failureNext hop unresolved / recursive failure
FIB present, adjacency incompleteshow adjacency <prefix> detail, ip neigh showL2 resolution failing
Small pings pass, large failping -M do -s 1472 <dst> (1500-byte MTU)PMTUD blackhole / ICMP blocked
Forward path fine, return brokentraceroute or mtr in both directionsAsymmetric routing, uRPF drop

Failure modes and how I'd catch them

  • uRPF strict drop: return path differs from forward path. show ip traffic shows unicast RPF drops, or nstat -az | grep -i rpf on Linux.
  • MTU blackhole: handshake completes, bulk transfer stalls. ping -M do -s 1472 fails while -s 1400 passes.
  • ECMP polarization: one hash tuple fails, others pass. show ip cef exact-route <src> <dst> on Cisco, or repeated ip route get with varied source ports.
  • Policy/NAT: iptables -t mangle -L -n -v or nft list ruleset counters show the drop; a NAT translation table missing the return entry shows the reverse.

Trade-off

Checking the exact tuple first is cheap and decisive; walking the full RIB is slow and usually unnecessary. But ping and traceroute use a different tuple than the application (different source IP, DSCP, and ports) so a passing probe does not clear the path. When a probe passes and the app fails, trust the app's tuple, not the probe.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-5

Use DNS bypass tests without drawing false conclusions.

Answer

A DNS bypass test is only meaningful if you change the address and nothing else. If you drop TLS SNI or the HTTP Host header, you are testing a different virtual host, not DNS. Assume you have a failing hostname, dig and curl, and the service is behind TLS. The question is whether the failure is in name resolution/selection or in the path after the address is chosen.

The clean bypass is curl --resolve or curl --connect-to. Both keep the URL hostname, so curl sends SNI and Host unchanged.

Shell
getent ahosts api.example.com
dig +short api.example.com A
dig +short api.example.com AAAA
dig +trace api.example.com A
dig @ns1.example.com api.example.com A +norecurse
curl --resolve api.example.com:443:203.0.113.10 https://api.example.com/health -v
curl --connect-to api.example.com:443:203.0.113.10:443 https://api.example.com/health -v

dig +trace follows delegation from the root. dig @ns1 asks the authoritative server and bypasses recursive cache. The TTL in the answer tells you how long a resolver may keep it; negative answers are cached for the SOA minimum. If you need to reproduce exact client behavior across tools, /etc/hosts works but is global, needs root, and some resolvers or apps may ignore it.

MethodChanges address?Preserves SNI/Host?Best forMain risk
curl --resolveyesyesHTTP/TLS pathtests one IP, not all
curl --connect-toyesyessame, when port differssame
/etc/hostsyesyesreproduce across toolsglobal, root, may be ignored
dig @authoritativeno appn/aresolver/cache questionno TLS/HTTP
dig +traceno appn/adelegationnot app path

Why bypass changes the answer: DNS picks an IP, but the edge you hit is also chosen by anycast, CDN geo-routing, and load balancer health. A single A record may be one POP that does not serve your hostname or is unhealthy. TLS SNI selects the certificate and virtual host; Host selects the HTTP route. Connection pools select an existing socket, so a long-lived client may keep using the old IP after DNS changes. IPv4 vs IPv6 and Happy Eyeballs can pick a different family.

Hypothetical trace: dig +short returns 203.0.113.10 and 203.0.113.11. curl --resolve ...:203.0.113.10 succeeds; curl --resolve ...:203.0.113.11 fails with a TLS alert. That does not prove DNS is broken. It proves one edge or backend is bad. Test both, then check whether normal curl picks the bad one.

Failure modes and detection:

  • Stale keep-alive: a client reuses an old connection and ignores the new DNS answer. Detection: curl -v shows Re-using existing connection; run a fresh process or close the pool.
  • CDN geo-routing: the bypass IP is a different POP. Detection: compare edge headers such as cf-ray, x-served-by, x-amz-cf-pop, x-cache, and the certificate SAN.
  • Missing SNI: openssl s_client -connect 203.0.113.10:443 without -servername api.example.com drops SNI. Detection: add -servername and compare the certificate.
  • Multiple A/AAAA records: testing one IP is not representative. Detection: test every answer, both families.
  • Negative caching: a recent DNS change may still return the old answer until TTL expires. Detection: query the authoritative server directly.

What changes the decision: if curl --resolve with preserved hostname succeeds and normal curl fails, DNS or selection is implicated. If both fail with the same TLS or HTTP error, DNS is not the cause. If only one of several A records fails, you have a bad edge or backend, not a resolver bug.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-24

Diagnose dual-stack failures affecting only some clients.

Answer

First 90 seconds

"Some clients" is the whole problem. Dual-stack failures that hit a subset are almost never a stack bug: they're a divergence between two clients that both believe they're doing the same thing. So before touching anything, I pin down the axis of the subset: same OS version? Same subnet? Same time window? One laptop on one Wi-Fi network points at local RA/NDP or a resolver path. Every client behind one NAT points at the middlebox. One app version across all networks points at the client's address-selection code.

Then I bisect by family, same hostname, forced family:

dig +short A example.com
dig +short AAAA example.com
curl -4 -sv https://example.com/ -o /dev/null
curl -6 -sv https://example.com/ -o /dev/null

If -4 works and -6 doesn't, the failure is in the v6 path, not the app. If both work but the default fails, the bug is in selection: the client picks the broken family first and never falls back.

Mechanism: why only some clients

Three places diverge.

DNS. A resolver returning AAAA but no A (or the reverse) changes what the client even attempts. Query the client's own resolver, not yours: dig @<client-resolver> AAAA example.com. A stale or split-horizon AAAA is the classic "only some clients" cause.

Address selection. RFC 6724 governs which source and destination the client prefers. A client holding a global v6 address plus a ULA, or a deprecated address, can pick a source the server's firewall drops. Check ip -6 addr show for deprecated/dadfailed flags, and ip -6 route get <dst> to see the chosen source.

Happy Eyeballs. RFC 8305 is what makes dual-stack mostly work: the client starts one family, and if no connection completes within the Connection Attempt Delay (default 250 ms) it starts the other. Resolution Delay is 50 ms. Clients that don't implement it, or implement v1, stall for the full TCP timeout on a black-holed AAAA. That is your "some clients": the ones without HEv2 hang, the ones with it don't.

Failure modes, with the tool that shows them

  • Unreachable AAAA / black hole: tcpdump -ni any 'tcp port 443' on the client. SYN to the v6 address with no SYN-ACK means a drop, not a reject.
  • Broken NDP/RA: ip -6 neigh show. INCOMPLETE or FAILED means the client can't resolve the gateway's MAC. Missing default route: ip -6 route show default.
  • PMTUD blackhole: IPv6 minimum link MTU is 1280 (RFC 8200). If ICMPv6 type 2 (Packet Too Big) is filtered, large TLS handshakes hang after the ClientHello. Probe with ping6 -s 1400 and watch for the ICMPv6.
  • Asymmetric v6: outbound works, return path filtered. Check both directions.
  • Endpoint parity: does the load balancer have a v6 backend? Compare curl -6 to the LB address directly against the hostname.

Trade-off: disabling IPv6

Removing AAAA or disabling v6 makes the symptom vanish and hides the cause. It's acceptable as a short-lived mitigation with a ticket and a deadline when the v6 path is confirmed broken and the fix is outside your control. It is not acceptable as the fix: you lose v6-only clients, you mask a PMTUD or firewall problem that will recur, and you make the next diagnosis harder. Decide on evidence, if -6 fails from every network and -4 works, mitigate; if only one network fails, fix that network.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-23

How do you identify and isolate a Layer 2 switching loop or broadcast storm that is degrading an entire network segment?

Answer

Clarify scope before touching anything: which segment, when degradation started, and what changed in the last hour. A new switch, a patch cable, a hypervisor host, a NIC team. State the assumption: managed switches with STP enabled, and a capture point on the affected segment. Then answer directly. An L2 loop shows segment-wide degradation that is not proportional to any one host's traffic: broadcast and unknown-unicast rates jump an order of magnitude, the MAC table flaps, and STP topology-change counters climb. A broadcast storm without a loop looks similar but traces to one source MAC.

Mechanism: Ethernet has no TTL. A frame entering a loop circulates until something drops it, and every broadcast is replicated on every port in the loop. STP/RSTP/MSTP exists to break that loop by blocking a port. It fails when STP is disabled on access ports, when BPDU filter/guard is misconfigured, when an unmanaged switch or hypervisor bridge is inserted, or when NIC teaming duplicates frames.

Evidence, in order:

  1. Switch counters: show interface for broadcast/multicast rate and output drops. Baseline on a quiet /24 is roughly 50 broadcast pps; a storm hits tens of thousands. 40,000 pps of 64-byte frames is 40,000 × 512 bits ≈ 20.5 Mbps of broadcast, plus unknown-unicast flooding. The access port is not saturated, but switch CPU and every host's NIC interrupt load are.
  2. MAC table: show mac address-table address aa:bb:cc:00:11:22 run twice, seconds apart. The same MAC appearing on two ports is the loop fingerprint; a single-source storm keeps a stable table.
  3. STP state: show spanning-tree detail; a climbing topology-change count with a recent last-change time confirms the loop is being detected and re-converged.
  4. Capture: duplicate delivery is visible directly:

tcpdump -i eth0 -nn -e -c 20 'ether broadcast or ether multicast'

12:04:11.882 aa:bb:cc:00:11:22 > ff:ff:ff:ff:ff:ff, ethertype ARP, length 60 12:04:11.882 aa:bb:cc:00:11:22 > ff:ff:ff:ff:ff:ff, ethertype ARP, length 60

The same frame twice in the same microsecond, same IP ID, is a loop; a storm shows many distinct frames from one source.

observationloopstorm, no loop
broadcast/multicast rate10–100× baseline, all portshigh, one source MAC
MAC tablesame MAC flaps between portsstable
STP TCNclimbingflat
captureduplicate frames, same IP IDdistinct frames
switch CPUpeggedelevated

Isolate: walk the MAC-flap pair back port by port until you reach the port where the MAC first appears. That port is the loop entry: usually a wall jack with a user-installed switch, a misconfigured NIC team, or a VM host bridging two uplinks. Disable it, confirm broadcast rate and TCN count return to baseline, then fix the cause: enable BPDU guard and root guard on access ports, verify STP is not filtered, and set storm control above the legitimate ARP/DHCP peak.

Failure modes: storm control set too low drops legitimate ARP and DHCP, so hosts lose the gateway while the storm is gone; BPDU filter on an access port silently disables the protection you think you have; and assuming the loop is in the switch fabric when it is a hypervisor bridging two uplinks. Detect each by re-checking broadcast rate, DHCP success and TCN count after the change.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-9

Troubleshoot certificate failures affecting one client cohort.

Answer

Core answer (first 90 seconds)

The question is not "is the certificate valid": it is "what differs between the cohort that fails and the cohort that works." Bound the cohort first: client version, OS, trust store, network path, and whether the failing connection is new or resumed. Then reproduce with one failing client and one working client against the same listener, and diff the handshakes.

State your assumptions: you have a failing client you can run a handshake from, and a working client on the same endpoint. If you don't, get one: a cohort-specific break is almost always a client-side or path-side difference, not a server-wide certificate problem.

Mechanism: why one cohort and not everyone

Four mechanisms cover most cases.

  1. Chain building. The server sends the leaf only and omits the intermediate. Browsers (Chrome, Firefox) fetch the intermediate via AIA (Authority Information Access) and succeed. Go's crypto/tls, Java's default trust manager, Python's ssl, and many embedded clients do not do AIA fetching: they fail with "unable to get local issuer certificate" or alert 48 (unknown_ca). The cohort is non-browser clients. Detection: openssl s_client -connect host:443 -showcerts shows one certificate; a browser shows the full chain in devtools.

  2. Trust store and policy. Android 7.0 (API 24) changed the default: apps targeting API 24+ do not trust user-added CAs. A corporate MDM cohort that installs a private root works on older apps and fails on newer ones. Java 8u261+ disables TLS 1.0/1.1 by default via jdk.tls.disabledAlgorithms. Detection: alert 48 on the client, and the client's trust store listing.

  3. SNI, ALPN, and name selection. A client that does not send SNI (old library, IP-literal connection) gets the default virtual host's certificate, which may not match. ALPN mismatch: client offers only h2, server offers http/1.1 → alert 120 (no_application_protocol). The cohort is one SDK version.

  4. Time and resumption. Clock skew on a device fleet → notBefore/notAfter failure, alert 45 (certificate_expired). Or TLS 1.3 session resumption: a cohort resuming a ticket from before a rotation skips certificate validation and keeps working while new connections fail. The inverse cohort split.

Trade-offs and deciding criteria

Don't start by rotating the certificate. Rotation is the expensive move: it invalidates caches, forces redeploys, and if the cause is a missing intermediate or a client trust store, it fixes nothing. The cheap discriminating test is a single openssl s_client from a failing client and a working client, diffing the certificate chain, SNI, ALPN, and alert. Rotate only if the diff shows the server presenting a different or wrong certificate to that cohort.

Failure modes and detection

CauseSymptomDetection
Missing intermediatealert 48, "unable to get local issuer"openssl s_client -showcerts shows 1 cert
Client trust storealert 48 on one OS versioncompare trust stores
No SNIwrong cert / name mismatchopenssl s_client -noservername
ALPN mismatchalert 120-alpn h2 vs -alpn http/1.1
Clock skewalert 45client date, cert notBefore/notAfter
Resumptionold sessions work, new fail-no_ticket vs default

Artefact: reproduce and diff

# failing client
openssl s_client -connect api.example.com:443 -servername api.example.com -showcerts -alpn h2 </dev/null 2>&1 | grep -E 'Verify|alert|Protocol|ALPN'
# working client, same command

If the failing client shows Verify return code: 21 (unable to verify the first certificate) and the working one shows 0 (ok), the server is sending an incomplete chain to that path: check the listener's SSLCertificateChainFile (Apache) or ssl_certificate bundle (nginx), and whether a second load-balancer endpoint has a stale bundle. If both clients show 0 (ok) but one still fails, the break is past the handshake: a middlebox or proxy terminating TLS with its own certificate, or a client policy rejecting the signature algorithm.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-10

Run a Path MTU investigation.

Answer

The 90-second answer

PMTUD is a feedback loop. A sender sets DF (IPv4) or relies on IPv6's no-fragmentation rule, sends a full-size packet, and expects any router whose next hop is smaller to return ICMP: type 3 code 4 carrying the next-hop MTU in IPv4, ICMPv6 type 2 Packet Too Big in IPv6. The sender caches that MTU and shrinks. Break the loop and you get a blackhole: the packet is silently dropped, the sender retransmits the identical size, and the connection stalls.

The tell is size-dependent failure. TCP handshake, DNS, and ping at 1400 bytes all work; a 1500-byte segment disappears. SSH logs in fine, then ls on a large directory hangs. TLS negotiates, then the first full-size application segment never arrives. That pattern is PMTUD, not routing.

Worked example

Two hosts, 10.0.0.5 and 10.0.1.9, joined by a GRE tunnel. Physical links are 1500. GRE costs 24 bytes (4 GRE + 20 outer IP), so the tunnel's usable MTU is 1476.

$ ip link show gre1
    mtu 1476 qdisc noqueue state UNKNOWN
$ ping -M do -s 1472 10.0.1.9        # 1472 + 8 ICMP + 20 IP = 1500
1480 bytes from 10.0.1.9: icmp_seq=1 ttl=62 time=1.2 ms
$ ping -M do -s 1473 10.0.1.9
From 10.0.0.1 icmp_seq=1 Frag needed and DF set (mtu = 1476)

That second line is the loop working. Now the broken version: same probe, ICMP dropped by an ACL on 10.0.0.1:

$ ping -M do -s 1473 10.0.1.9
PING 10.0.1.9 (10.0.1.9) 1473(1501) bytes of data.
^C
--- 10.0.1.9 ping statistics ---
5 packets transmitted, 0 received, 100% packet loss

No error, no reply. tracepath does the probing for you and prints the discovered MTU per hop:

$ tracepath -n 10.0.1.9
 1?: [LOCALHOST]                      pmtu 1500
 1:  10.0.0.1                          0.412ms
 2:  10.0.1.9                          1.104ms reached
     Resume: pmtu 1476 hops 2 back 2

(Representative output; your hop counts and timings will differ.)

Overhead table

EncapsulationOverhead (IPv4 outer)Inner MTU on 1500
IPIP201480
GRE241476
VXLAN501450
WireGuard601440
IPsec ESP tunnelvaries with cipher/modecheck your config

TCP MSS follows: 1500 - 20 IP - 20 TCP = 1460 on a clean path, 1436 inside GRE, 1410 inside VXLAN.

Capture and offload

Capture on the wire, not on the tunnel interface, or you measure the wrong packet. Turn offloads off first: ethtool -k eth0 shows tso, gso, gro; with GRO on, tcpdump will show you 64 KB "packets" that never existed on the wire. Run ethtool -K eth0 gro off gso off tso off before capturing.

Trade-offs

Three fixes, in order of preference:

  1. Restore ICMP. Allow type 3 code 4 (and ICMPv6 type 2) through the firewall. This repairs PMTUD for every protocol, not just TCP.
  2. Lower the MTU. Set the tunnel or interface MTU to the real path value. Works, but you must do it on both ends and it costs throughput on every packet.
  3. MSS clamping. iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu. TCP-only containment: UDP, ICMP, and QUIC still blackhole. A stopgap, not a fix.

Failure modes to name

  • ICMP blocked by a stateful firewall that doesn't associate the error with the flow. Detect: ping -M do at increasing sizes, or tracepath.
  • Offload masking the real size. Detect: ethtool -k, capture with offloads off.
  • MTU set on one end only. Detect: ip link show on both tunnel endpoints.
  • Linux PMTUD blackhole probing is off by default: net.ipv4.tcp_mtu_probing is 0. Setting it to 1 lets TCP fall back to a smaller MSS after repeated retransmits: a safety net, not a substitute for fixing ICMP.

Retest with UDP and after any route change; a new path can have a different MTU.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-7

Locate packet loss using TCP sequence evidence.

Answer

What I'd say first

Assume I have a capture at one or both endpoints and a report that a transfer is slow or a connection stalls. TCP sequence numbers are byte offsets, so every segment covers a half-open range [seq, seq+len). Loss is a hole in that range: the receiver's cumulative ACK stops at the left edge of the hole, and anything it did receive above the hole shows up in SACK blocks. So the loss interval is bounded below by the highest cumulative ACK and above by the lowest SACKed byte: that's the whole method.

Worked trace

Sender, MSS 1460, sends five segments:

segseq range
S1[1000, 2460)
S2[2460, 3920)
S3[3920, 5380)
S4[5380, 6840)
S5[6840, 8300)

S2 is dropped in the network. The receiver gets S1, then S3, S4, S5. It ACKs 2460 every time, the cumulative ACK cannot advance past the hole, and SACKs [3920,5380), [5380,6840), [6840,8300). The sender sees three duplicate ACKs carrying SACK and fast-retransmits [2460,3920). The hole is exactly one MSS, so this is a single-segment loss, not a burst.

If instead the sender sees no dup ACKs and retransmits after a timeout, that is an RTO retransmit: the loss was at the tail, or the window was too small to generate three dup ACKs. RFC 5681 sets the fast-retransmit trigger at three duplicate ACKs; Linux's tcp_reordering defaults to 3.

RTO arithmetic

RFC 6298: RTO = SRTT + max(G, 4·RTTVAR), floored at 1 second. Linux deviates: TCP_RTO_MIN is 200 ms. With SRTT 40 ms and RTTVAR 5 ms the raw value is 40 + 20 = 60 ms, so Linux uses 200 ms where the RFC would use 1 s. That gap is why an RTO retransmit looks like a ~200 ms stall on Linux and a ~1 s stall on a stack that follows the RFC.

Trade-offs

A single capture at the sender tells you what left; it cannot tell you what arrived. Dual capture with synchronized clocks (PTP, or NTP within a few ms) lets you say the loss happened between the two points. SACK gives you the exact hole; without SACK you only have the cumulative ACK, which bounds the hole below but not above: you cannot tell one lost segment from ten.

Failure modes and detection

  • Capture drops: SPAN oversubscription silently drops frames. Detect with dumpcap's drop counter or tcpdump's "packets dropped by kernel" line; if it is non-zero, the hole may be a capture artifact.
  • Offloads: TSO/LRO/GRO coalesce segments so captured sequence numbers do not match the wire. Disable with ethtool -K <if> tso off gro off lro off before trusting the trace.
  • Reordering: looks like loss but is not. DSACK (RFC 2883) reports duplicate data and marks a spurious retransmit; F-RTO (RFC 5682) and Eifel (RFC 3522) do the same from the sender side.
  • Karn's algorithm: do not take RTT samples from retransmitted segments, or you corrupt SRTT.

Bounding the claim

Only claim the loss interval between the last point that saw the original and the first point that did not. If both captures are on the same host, you have located the loss to that host's stack, not the network.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-8

Diagnose a slow TCP stream with window and queue data.

Answer

Core answer

Assume one TCP stream, you can run ss and tcpdump on both hosts, and you know the path RTT. The first question is which window is the limiter: the receiver's advertised window (flow control) or the sender's congestion window (congestion control). Both look like a flat throughput plateau, and the fixes are opposite.

Read the receiver's advertised window and the sender's cwnd at the same instant. If ss -ti on the sender shows cwnd well above the bytes in flight while tcpdump shows the receiver's Win field small or zero, it is flow control: the receiver or its application is the bottleneck. If Win is large but cwnd is small and retrans is climbing, it is congestion control or loss.

Mechanism

Single-stream throughput is capped by window/RTT. A 64 KiB window (the unscaled TCP maximum, 65535 bytes) over a 40 ms RTT gives 65535 / 0.04 ≈ 1.6 MB/s ≈ 13 Mbps, however fast the link is. Filling a 1 Gbps × 40 ms path needs a 5 MB window (BDP = 125 MB/s × 0.04 s). Linux scales the window with the wscale option (RFC 7323) and autotunes the receive buffer up to net.ipv4.tcp_rmem max (typical default 6291456 bytes = 6 MB), so a healthy path reaches that.

The receive queue (Recv-Q in ss) sits between the NIC and the application's read(). If the app reads slower than the sender sends, Recv-Q fills, the advertised window shrinks, and at zero the sender stalls and fires zero-window probes.

Artefacts

Signal (where)ReadingCause
Recv-Q high, Win→0 (receiver)app not readingreceiver flow control
Win large, cwnd small, retrans>0 (sender)losscongestion control
Win capped at 65535, no wscale in SYNscaling offmisconfig
Send-Q high, cwnd large (sender)egress/NICsender-side

Zero-window trace (tcpdump prints the raw 16-bit window; multiply by 2^wscale):

0.000  R->S  [ACK] Win=0
0.000  S->R  [ACK]              # window full, nothing to send
5.0    S->R  [PSH,ACK] 1 byte   # zero-window probe (persist timer)
5.0    R->S  [ACK] Win=0
10.0   S->R  [PSH,ACK] 1 byte   # probe, backoff
12.3   R->S  [ACK] Win=512      # app drained; x wscale 7 = 64 KiB

The 1-byte probes are the persist timer backing off; the receiver's window stays 0 until the app calls read().

Failure modes

  • Receiver app slow: Recv-Q pinned near the buffer size, zero-window probes. Detect with ss -m Recv-Q and probe count in tcpdump. Fix the app, not the buffer.
  • Window scaling off: throughput stuck near 13 Mbps on a 40 ms path. Detect: no wscale option in the SYN. Fix: net.ipv4.tcp_window_scaling.
  • Buffer too small: rcv_space below BDP. Detect: compare ss -i rcv_space to BDP. Fix: raise tcp_rmem max, but each connection then costs that much kernel memory.
  • Loss: retrans climbing, cwnd halved. Detect: ss -ti retrans and duplicate ACKs.

Trade-offs

Raising tcp_rmem/wmem helps only when the window is the limiter. At 10k connections × 6 MB that is 60 GB of kernel memory, and oversized buffers add bufferbloat latency. If the bottleneck is the app read loop or loss, bigger buffers just move the queue and add RTT. Fix the consumer or the loss before touching sysctls.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-11

Interpret captures in the presence of offloads.

Answer

What a strong candidate says first

A host capture records what the kernel's stack saw at a tap point, not what crossed the wire. On the sending host, the AF_PACKET tap fires before the NIC performs checksum and segmentation offload, so the file looks worse than the wire: oversized "segments", checksums still partial. On the receiving host, GRO runs inside NAPI polling, before the tap, so the file looks cleaner than the wire: segments merged, reordering smoothed away.

So name the capture point before drawing conclusions: host or tap/SPAN, interface, TX or RX, and what ethtool -k <iface> reported at capture time. Wire questions (MTU, checksums, packets per second, link loss) need a tap or the peer's capture. Kernel questions (socket buffers, drops, scheduling delay) belong to the host capture. When the two disagree, believe the tap for the wire and the host for the stack.

Assumptions: Linux, tcpdump/libpcap 4.99+, a NIC with TSO, GRO and checksum offload enabled, which is the default on any 10 GbE or faster adapter.

OffloadWhat the host capture showsCheck with
TX checksumoutbound TCP checksum field zero or a partial sum; inbound packets normalethtool -k eth0 (tx-checksumming: on); a tap copy shows correct checksums
TSO / GSOone outbound "segment" up to 65535 bytes on a 1500-byte linkethtool -k eth0 (tcp-segmentation-offload); tap shows 1460-byte segments
GRO / LROinbound segments merged into one skb; reordering invisibleethtool -k eth0 (generic-receive-offload, large-receive-offload); peer capture
RX checksumbad-checksum packets vanish instead of appearingethtool -S eth0 (rx_missed_errors, rx_no_buffer_count); nstat -az

Worked example

Sender host, tcpdump -i eth0 -n -s 0 -w host.pcap 'tcp port 443':

10.0.0.5.51234 > 10.0.0.9.443: Flags [P.], seq 1:32769, ack 1, win 501, length 32768

The same flow at a tap on the same 1500-byte link:

10.0.0.5.51234 > 10.0.0.9.443: Flags [P.], seq 1:1461,      length 1460
10.0.0.5.51234 > 10.0.0.9.443: Flags [P.], seq 1461:2921,   length 1460
10.0.0.5.51234 > 10.0.0.9.443: Flags [P.], seq 32121:32769, length 648

One record on the host; 23 frames on the wire (22 * 1460 + 648 = 32768). Counting super-packets as packets wrecks rate math: at 10 Gbps of full-size TCP the real rate is about 833,000 pps (10e9 / (1500 * 8)). If every host-capture record were a full 64 KB skb, the same capture would imply about 19,000 pps, a 44x undercount.

Failure modes

  • Phantom checksum corruption. Every outbound segment flagged bad, every inbound one clean. Confirm tx-checksumming is on and that a tap copy has valid checksums, then disable checksum validation in the analyzer for host captures instead of opening a corruption ticket.
  • 64 KB super-packet read as an MTU fault. Someone lowers MTU or starts on PMTUD because of segmentation offload. Confirm tcp-segmentation-offload is on and the tap shows 1460-byte segments.
  • GRO hiding reordering. The host capture looks perfectly in order while the peer reports loss. Compare nstat -az on both ends for TcpExtTCPOFOQueue and TcpRetransSegs, and re-check at a tap.
  • Truncation. Older tcpdump builds defaulted to a 65535-byte snaplen, which cuts the tail of a 64 KB GSO skb; 4.99+ defaults to 262144. Pass -s 0 regardless.
  • Silent drops. Watch for tcpdump's closing "N packets dropped by kernel". The default 2 MiB AF_PACKET ring holds roughly 1,400 full-size frames, under 2 ms of traffic at 10 Gbps, so raise it with -B 32768 before trusting a busy host.
  • Timestamps. The host timestamp is taken at the tap: after GRO on RX, before the NIC on TX. Don't assign a 40 ms stall to the network from those numbers; -j adapter_unsynced gives hardware timestamps where the driver supports it.

Container and loopback captures behave the same way: a veth or lo capture full of 64 KB skbs is GSO, not a broken MTU.

For a lab repro, ethtool -K eth0 tso off gso off gro off tx off rx off on both ends produces a wire-shaped host capture, at the cost of moving segmentation and checksum work into the kernel's softirq path. That is a test-window change, never a production default.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-16

Plan a safe multi-point packet capture during an incident.

Answer

Core answer

Three things before I start a capture: the hypothesis, the time window, and the privacy constraint. The hypothesis picks the capture points and the filter. The window sizes the ring buffer. The privacy constraint sets the snaplen, if payloads can carry credentials or PII, I capture headers only (-s 96) and get written approval before widening it.

Assumptions I'd state out loud: I have privileged access on the hosts, a SPAN port or tap exists at the boundary, and I can get every team to point at the same NTP or PTP source before we start.

Then I capture at every point on the path at once (client host, server host, and the boundary SPAN or tap) with all clocks on that one time source, NIC offloads disabled on the hosts, a BPF filter matching the exact tuple, and a ring buffer sized to outlast the incident. I confirm the target flow is in the file and check drop counters before I stop.

Trade-offs

choicepick it whencost
Full capture (-s 0)payload is the evidence, volume is low4.5 TB/hour on a saturated 10 Gb link
Headers only (-s 96)privacy, high volumeblind to payload bugs
SPAN portno downtime, cheapdrops under oversubscription, aggregates flows
Network tapfull fidelity, no dropsinline, needs a maintenance window
On-host tcpdumpsees localhost, pre-offload viewburns host CPU, misses wire-level loss
Central applianceone clock, one place to lookcan't see host-internal traffic

Capture is the wrong move when logs, metrics or traces already answer the question: a bad deploy or a config change shows up there in seconds. It's also wrong when the traffic is TLS and you have no keys: you get headers, and a proxy log gives you the same thing cheaper.

Failure modes

  • Offloads. TSO/GRO/LRO make tcpdump on the host show 64 KB "packets" and bogus checksums that never hit the wire. Detect: frames larger than the MTU, or checksum errors that vanish at the tap. Fix: ethtool -K eth0 gro off lro off tso off gso off before capture.
  • Clock skew. If the two hosts drift by 200 ms, you can't order events across them. Detect: capture the same packet at both points and compare timestamps. Cost: you can't tell which side dropped first.
  • Ring overwrite. -C 100 -W 20 holds 2 GB. At 12.5 MB/s that's ~160 seconds. If the incident runs longer, the start is gone. Detect: first packet time in the file is later than incident start.
  • SPAN drops. A 1 Gb SPAN port fed by a 10 Gb link drops silently. Detect: switch SPAN drop counter, or tcpdump's "packets dropped by kernel" on exit.

Commands

Shell
# on each host, offloads off first
ethtool -K eth0 gro off lro off tso off gso off

# 2 GB ring, 100 MB files, headers only, one tuple
tcpdump -i eth0 -s 96 -w /var/cap/inc-$(hostname).pcap \
  -C 100 -W 20 -Z root -j adapter \
  'host 10.0.1.5 and host 10.0.2.9 and tcp port 443'

-j adapter uses the NIC's hardware timestamp; -j host uses the kernel clock. Pick one and use it everywhere.

Sizing arithmetic

10 Gb link, 500-byte average frame → 2.5 Mpps.

  • Full capture: 1.25 GB/s → 4.5 TB/hour.
  • -s 96: 240 MB/s → 864 GB/hour.
  • Filtered to one tuple at 1% of traffic: 12.5 MB/s → 45 GB/hour.

That's why the filter and snaplen come before the capture, not after.

Close

Hash the raw files (sha256sum), keep them read-only, and record the exact command and tcpdump version in the incident ticket. Redact derived exports before they leave the team. Stop only after you've confirmed the target flow is present and the drop counters are zero.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-20

Validate packet-loss evidence under high traffic.

Answer

Core answer

Assume the complaint is "packets are being lost" and someone hands you a capture that appears to show gaps. Before you believe it, prove the capture itself didn't drop. A capture that drops packets in the kernel looks identical to network loss in the packet list: the sequence numbers just skip. So the first question is not "where is the loss" but "is this capture trustworthy."

Check three things in order: (1) the capture tool's own drop counter, (2) the interface and driver counters on the capture host, (3) an independent observation of the same flow. Endpoint retransmission counters, or a second capture on the far side of the suspected segment. If the capture dropped packets, you have no evidence yet; fix the capture and re-run. If the capture is clean and the endpoints agree data was lost, you have real loss and can localize it.

Why capture drops masquerade as loss

tcpdump prints "N packets dropped by kernel" when it exits; Wireshark shows "Dropped" in the status bar and in Capture Statistics. That counter is the kernel ring buffer overflowing because userspace (tcpdump or Wireshark writing to disk) couldn't drain it fast enough. Those packets never reach the file, so the file shows a sequence gap exactly like a lost packet.

Arithmetic: a 10 GbE link at line rate is 1.25 GB/s. tcpdump's default ring buffer on Linux is 2 MiB, so at line rate the buffer holds about 1.6 ms of traffic (2,097,152 B ÷ 1.25e9 B/s). Any userspace stall longer than that drops packets. Raise the buffer with -B (KiB units) and write to a fast local disk, not NFS.

Counters and what they mean

CounterWhereMeans
"packets dropped by kernel"tcpdump exit / Wireshark statuscapture ring overflow, not network loss
rx_missed_errors, rx_no_buffer_countethtool -S eth0NIC ring full, driver couldn't hand off
RX dropped / overrunip -s link show eth0interface-level drops
TcpRetransSegsnstat -az / netstat -sendpoint saw real loss
tcp.analysis.retransmissionWireshark filterretransmit visible in capture

Trace: capture drop vs real loss

Capture on A shows seq 1000 (1000 B), then the next packet seq 2000: a 1000-byte gap.

  • If B's ACK for that stream advances to 2000, B received the missing segment, so the gap is a capture drop, not loss.
  • If B's ACK stays at 1000 and B sends duplicate ACKs or a retransmit, the segment was really lost.

The discriminator is the receiver's ACK, not the capture's packet list.

Trade-offs

  • SPAN vs TAP: a SPAN destination port drops silently once the monitored traffic exceeds the port's capacity; a passive TAP does not. If you must use SPAN, monitor one direction or a filtered subset.
  • Snaplen: -s 96 keeps headers only, cutting bytes per packet and disk pressure, but truncates payload you may need for application IDs.
  • Filter: a kernel BPF filter reduces copies, but a filter that's too narrow can hide the loss you're chasing.
  • Full capture vs counters: counters are cheap and always on; full capture is expensive and time-bounded.

Failure modes

  • Trusting a capture with a nonzero drop counter: the whole analysis is void.
  • Comparing captures without synchronized clocks (NTP/PTP); a few ms of skew looks like reordering.
  • Reading a single overloaded capture as proof; one missing packet in one capture is not evidence.
  • SPAN oversubscription: the switch drops before the capture host ever sees the packet.

Report the interval where the two independent observations first diverge, with the uncertainty stated.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-13

Troubleshoot low transfer throughput systematically.

Answer

Core answer (first 90 seconds)

Pin down the target before touching anything: what throughput is expected, over what path (RTT, loss), one flow or many, which direction, and what the application actually needs. Then compute the single-flow ceiling from the bandwidth-delay product.

BDP = bandwidth × RTT. A 10 Gbit/s path at 20 ms RTT holds 25 MB in flight. A single TCP flow cannot exceed window/RTT, so with the Linux default max receive buffer of 6 MiB (tcp_rmem max 6291456) the cap is 6 MiB / 0.02 s ≈ 2.5 Gbit/s: a quarter of the link, on a perfectly clean path. If one flow is slow and ten flows are fine, you have a window/RTT problem, not a path problem. If every flow is slow together, look at the path or the host. That split decides the rest of the investigation.

Measure, in this order

  1. Path: mtr -rwzbc100 <dst> for per-hop loss; ping -M do -s 1472 <dst> to test 1500-byte MTU end to end (1472 + 8 ICMP + 20 IP = 1500). A PMTUD blackhole shows as small packets fine, full-size packets dropped.
  2. Transport: ss -ti on the receiver. Read cwnd, rtt, retrans and the receive window. nstat -az TcpRetransSegs TcpExtTCPLostRetransmit for the counters.
  3. Host: sar -n DEV 1 for per-interface bytes/s; ethtool -S <if> for rx_dropped, rx_missed, rx_no_buffer; ethtool -k <if> to confirm GRO/TSO are on; mpstat -P ALL 1 to see whether one core is pinned in softirq.
  4. Application: strace -c -p <pid> or the app's own counters for read/write sizes. A 4 KB read loop caps you well below line rate regardless of the network.

Change one variable at a time: iperf3 -c <dst>, then -P 8, then -w 4M. If -P 8 fixes it, the ceiling was per-flow.

Failure modes and how they show up

SymptomLikely causeDetection
One flow slow, many fastWindow/RTT cap, no window scalingss -ti shows rwnd at max, cwnd flat
All flows slow, RTT climbs under loadBufferbloat in a shaper or CPEping RTT rises from 5 ms to 200 ms while iperf runs
Large packets fail, small passPMTUD blackhole / MTU mismatchping -M do -s 1472 fails, -s 1400 passes
Good on loopback, bad on wireNIC drops or single-queueethtool -S rx_missed climbing
Flat ceiling regardless of window sizeSingle-core softirq or TLSmpstat shows one core at 100% in softirq

Trade-offs

Parallel streams are the fast workaround but they hide the cause and can be unfair to other traffic; fix the window instead when you own both ends. Raising tcp_rmem/tcp_wmem helps only if the path has no loss: at 1% loss CUBIC's window collapses and a bigger buffer just adds queueing delay, so BBR or a tuned qdisc is the better lever. The bisection method misleads when the bottleneck is shared: two flows that each look healthy can still be splitting one policed 1 Gbit/s shaper, so check tc -s qdisc show and the provider's committed rate before blaming the host.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-14

Diagnose and mitigate bufferbloat.

Answer

Core answer (first 90 seconds)

Assume the symptom is this: latency climbs from tens of milliseconds to hundreds whenever a bulk flow saturates a link, while goodput barely moves. That is bufferbloat: a standing queue in an oversized FIFO buffer. The fix is to put a queue you control at the bottleneck and make it keep sojourn time low: fq_codel or CAKE, plus shaping to just under the real bottleneck rate. Confirm first that the bottleneck is where you think it is.

Mechanism

A modem or router with a 3 MB egress buffer on a 100 Mbit/s link can hold 3 MB = 24 Mbit of data, which is 240 ms of standing queue once a bulk flow fills it. TCP fills that buffer because it keeps raising cwnd until it sees loss; the buffer absorbs the overshoot instead of signalling congestion, so every packet, including the interactive ones sharing the link, waits behind up to 240 ms of bulk data. Throughput is unchanged because the link was already saturated; only delay grew.

CoDel (RFC 8289) watches sojourn time, not queue length. If the minimum sojourn over the last interval (100 ms) stays above target (5 ms), it drops or ECN-marks the head packet. fq_codel adds fair queueing: it hashes flows into buckets (1024 by default) and gives each a fair share, so one bulk flow cannot starve a VoIP flow. CAKE extends this with shaping, per-host fairness and Diffserv handling in a single qdisc.

Diagnosis

Measure RTT idle and under a saturating flow, at the bottleneck. flent rrul or irtt gives you both directions at once; tc -s qdisc show dev eth0 shows backlog and drops.

stateRTTgoodput
idle12 ms—
saturating upload260 ms94 Mbit/s
saturating upload + fq_codel18 ms93 Mbit/s

Latency up 20x, throughput flat: that is the signature. If throughput also collapses, you have a different problem: loss, MTU, wireless retries.

Mitigation

Put the AQM on the egress of the actual bottleneck, usually the WAN interface, not the LAN. Shape to about 95% of the measured bottleneck so your qdisc owns the queue instead of the ISP's buffer:

tc qdisc replace dev eth0 root cake bandwidth 95mbit

or, without shaping:

tc qdisc replace dev eth0 root fq_codel

Trade-offs

approachwhen it workscost
fq_codelyou own the bottleneck egressno shaping; upstream buffer still fills if you do not
CAKEyou own it and want shaping + fairnessCPU at high rates; needs a correct bandwidth figure
shaping alonebottleneck is upstream and unmanagedcaps throughput; adds its own queue
prioritization (DSCP/WMM)both ends honour ituseless if the bottleneck ignores DSCP

Do not reach for prioritization first: it reorders a queue that is already too long. Shaping without AQM just moves the buffer onto your box.

Failure modes

  • Shaping set above the real bottleneck: the ISP buffer still fills and latency returns. Detect by re-running the loaded RTT test.
  • Shaping set too low: you leave capacity on the table. Detect by comparing shaped goodput to line rate.
  • ECN marking with a receiver that ignores it: no benefit, and some middleboxes drop ECN-marked packets. Detect by checking ECN negotiation.
  • Wireless: the bottleneck is airtime, not the qdisc; AQM on AP egress helps but retransmissions and rate adaptation dominate. Detect by comparing wired vs wireless loaded RTT.
  • NAT defeats CAKE's per-host fairness: every host looks like one flow.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-18

How do you isolate whether high latency is caused by network queueing delay versus propagation delay or endpoint processing latency?

Answer

Core answer. Split the number into three parts and measure each with a different instrument; no single tool separates them.

  • T_prop: speed-of-light floor, invariant under load.
  • T_queue: buffer occupancy, scales with offered load.
  • T_proc: endpoint work: app, DB, GC, lock contention.

The cheapest discriminator is the TCP handshake. The SYN-ACK comes from the server kernel with no user-space involvement, so handshake RTT ≈ 2(T_prop + T_queue) and contains no T_proc. Compare it with time-to-first-byte on the same connection.

Worked example (labelled): handshake completes in 20 ms. TTFB, measured from the last byte of the request leaving the client to the first response byte, is 620 ms. One-way path ≈ 10 ms, so T_proc ≈ 620 − 10 = 610 ms. The network contributes ~20 ms; ~610 ms is the server. Measure TTFB after the TLS session is established, or you are counting a TLS round trip as processing.

Then split the 20 ms into propagation vs queueing with ss -ti (Linux 4.0+; output trimmed):

$ ss -tin 'sport = :443 or dport = :443'
ESTAB 0 0 10.0.1.5:443 10.0.2.9:51422
  rtt:280.4/12.1 minrtt:18.2 cwnd:10 retrans:0/0

minrtt is the lowest RTT the socket has seen, the path with empty buffers, windowed by net.ipv4.tcp_min_rtt_wlen (default 300 s). Current rtt is an EWMA (α = 1/8). Here T_queue ≈ 280 − 18 = 262 ms. The 18 ms floor is 2×T_prop: about 1,800 km of fiber at ~5 µs/km one-way. If rtt ≈ minrtt while throughput is high, the path is not the problem.

Discriminators: smooth ramp with load → queueing; flat floor → propagation; a step at ~200 ms (Linux tcp_rto_min) or 1 s (RFC 6298 initial RTO) → retransmit, not buffer; network flat but TTFB high → T_proc.

Alternatives and their costs.

  • Active probing: ping, traceroute/mtr, twping/OWAMP for one-way delay, iperf3 to load the path deliberately. Cost: ICMP is rate-limited or filtered on many paths, so silence is not evidence; per-hop RTT conflates that hop's queueing with everything downstream; probes add traffic and can create the queueing you are measuring. Use when you don't control the endpoints or need to test a path you don't own.
  • APM / distributed tracing: OpenTelemetry spans; the gap between client span duration and server span duration is network + queueing. Cost: instrumentation overhead, and clock skew. A 5 ms skew between hosts swamps a 2 ms network signal, so bound the offset with RTT-based estimation or a shared PTP domain. Use when the request crosses many services and you must attribute delay to a hop.
  • Passive socket stats: free, no extra traffic, but only sees established TCP sockets on hosts you control.

When passive stats mislead.

  • No established connection: SYN retransmits, accept-queue overflow, TLS failures leave nothing in ss. Handshake time then measures the server's SYN backlog, not the network.
  • A middlebox terminates TCP (ALB, CDN, TLS proxy): rtt is to the proxy, not the origin.
  • Short-lived connections: minrtt may never have sampled an unqueued path.
  • QUIC/UDP: ss -t shows nothing; use ss -u and the QUIC qlog RTT.
  • Kernel bypass (DPDK, RDMA) or offloaded stacks: the socket layer isn't in the path.
  • Direction: rtt cannot tell you whether the queue is on the client's uplink or the server's egress. tc -s qdisc show dev eth0 on each end shows local backlog and drops directly.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-12

Diagnose a p99 latency regression.

Answer

Assume p99 is measured server-side at the load balancer over 5-minute windows, and the regression is a step change at a known time. The first question is whether p50 moved with it. If p50 is flat and p99 went from 40 ms to 180 ms, you have a tail problem: queueing, a pause, or a slow dependency hitting a subset of requests. If both moved, you have a broad slowdown and should look at the deploy diff first.

p99 regressions are queueing problems until proven otherwise. Averages hide them because a saturated resource only delays the requests unlucky enough to arrive when the queue is non-empty. Little's law gives you the arithmetic: concurrency L = arrival rate λ × time in system W. If λ × W equals your pool size, utilization is 1.0 and queue wait grows without bound.

Worked example (hypothetical figures). Deploy at 13:58, p99 jumps 40→180 ms at 14:02, p50 stays at 38 ms. Server spans show 150 ms inside db.query for the slowest 1%. HikariCP maximumPoolSize is 10 (its default); Tomcat maxThreads is 200. Traffic is 500 rps and each request holds a connection for 20 ms. L = 500 × 0.02 = 10: exactly the pool size. Every request past the tenth waits. p99 becomes 20 ms hold + ~160 ms queue wait. Raising the pool to 25 drops p99 back to 45 ms. That is the whole diagnosis: not a slow query, a saturated pool.

signalflat p50, high p99both moved
pool waitHikariCP getConnection p99—
GCJFR jdk.GCPhasePause—
dependencydownstream span p99downstream span p50
deployno correlationcorrelates with release

Alternatives to cohort comparison: single-request tracing is precise but you must sample at 100% for the window to catch a slow one; differential flame graphs (Brendan Gregg's method) compare two CPU profiles and show what got slower, not just what is slow. Cohort diffing is fastest but confounded by traffic mix: a canary taking 5% of traffic may not see the same request shapes.

Concrete failure modes and how to detect them:

  • Connection pool saturation. Detect via pool wait-time histogram, not pool size. Cost: p99 4x, throughput capped at pool size / hold time.
  • GC pause. G1's default MaxGCPauseMillis is 200 ms. Detect via GC log pause histogram or JFR. Cost: every in-flight request stalls for the pause.
  • Retry storm. A client timeout triggers retries that multiply load. Detect by comparing retry counter to request counter; a 2-3x amplification turns a blip into an outage.
  • Head-of-line blocking on HTTP/1.1 keep-alive. Detect by overlapping connection-level spans; one slow response blocks the next on that socket.
  • CPU steal or cgroup throttling. Detect via /proc/stat steal time and cpu.stat throttled periods. Cost: uniform slowdown, not a tail.

Instrument with histogram_quantile(0.99, rate(http_request_duration_seconds_bucket[5m])) and keep exemplars so you can pull one slow trace. For client-side breakdown, curl -w '%{time_connect} %{time_starttransfer} %{time_total}' separates connect from first byte from transfer. ss -s shows socket state counts; tcpdump shows retransmits. Reproduce with matched payload, cache state, and connection reuse: a cold cache or fresh TLS handshake changes the shape of the tail.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-15

Investigate intermittent failures through a stateful middlebox.

Answer

I’d assume the middlebox is a stateful firewall/NAT (Linux iptables/nftables, Cisco ASA, AWS NAT gateway) between client and server, and the failures are intermittent, not constant. The core answer: intermittent failures through a stateful middlebox almost always come from one of four things. State entry expiry (idle timeout), state table exhaustion (capacity), asymmetric routing (only one direction seen), or HA failover losing state. I’d start by capturing on both sides and checking the middlebox’s connection table.

Why it happens. A stateful device creates a flow entry on the first packet. Later packets must match that entry. If the entry expires (e.g., TCP established timeout), subsequent packets are dropped or create a new flow with a different NAT translation. If the table is full, new flows are dropped. If routing is asymmetric, return traffic bypasses the middlebox, so it never sees the reply and drops the forward direction as invalid. HA failover can lose state if not synchronized.

Investigation steps.

  1. Capture on client and server: tcpdump -i any -nn -s0 -w client.pcap host <server> and port <port> and the same on the server. Compare timestamps and flags. Look for retransmissions, RSTs, or missing packets.
  2. On the middlebox, check the connection table. Linux: conntrack -L -p tcp --dport 443 or cat /proc/net/nf_conntrack. Look for entries in SYN_SENT, ESTABLISHED, or missing. Check timeouts: sysctl net.netfilter.nf_conntrack_tcp_timeout_established (default 432000 s). ASA: show conn detail. AWS NAT: CloudWatch ActiveConnectionCount and ConnectionAttemptCount.
  3. Check table capacity: sysctl net.netfilter.nf_conntrack_max (often 65536 or scaled). dmesg | grep nf_conntrack for “table full”. ASA: show resource usage.
  4. Check NAT pool: conntrack -L -n to see translations. If pool exhausted, new connections fail. AWS NAT gateway has 55,000 simultaneous connections per destination.
  5. Check HA: show failover on ASA, or conntrackd -s for Linux. Look for state sync errors.
  6. Check routing: ip route get <server> from the middlebox, and traceroute from both sides. Asymmetric routing often shows different paths.

Worked example. A client sees intermittent 30-second stalls on a long-lived SSH session. Capture shows client sends data, server ACKs, but after 5 minutes of idle, the client’s next packet gets no response. On the middlebox, conntrack -L shows no entry for that flow. The TCP established timeout is 300 s (5 minutes) on this device. Fix: increase timeout to 3600 s, or enable TCP keepalives on the client (ServerAliveInterval 60 in SSH). Trade-off: longer timeouts increase table pressure; with 1M concurrent flows, 3600 s timeout requires more memory (each conntrack entry ~300 bytes, so 1M entries ~300 MB).

Trade-offs. Increasing timeouts reduces idle drops but risks table exhaustion. Disabling stateful inspection fixes asymmetric routing but loses security and NAT. Active/active HA gives faster failover but requires state sync; active/standby is simpler but may drop connections during failover. Using a load balancer with connection draining can help.

Failure modes and detection.

  • State table full: dmesg shows “nf_conntrack: table full, dropping packet”. Detect with conntrack -C vs nf_conntrack_max.
  • Asymmetric routing: middlebox sees SYN but not SYN-ACK; conntrack -L shows SYN_SENT entries that never establish.
  • HA failover: connections drop after failover; show failover shows state sync disabled.
  • NAT port exhaustion: conntrack -L -n shows many entries to the same destination; AWS NAT gateway has 55,000 connections per destination.

Decision framing. If failures correlate with idle periods, adjust timeouts. If they correlate with load, increase table size or scale out. If they correlate with failover events, fix HA sync. If they correlate with specific routes, fix routing symmetry.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-17

How do you distinguish between asymmetric routing and a unidirectional link failure when troubleshooting intermittent TCP connection drops?

Answer

The 60-second answer

Capture the same flow at both endpoints simultaneously. A unidirectional link cannot carry packets in both directions; asymmetric routing can. So if the SYN leaves A and arrives at B, and the SYN-ACK leaves B and arrives at A, the segment is not unidirectional: the fault is stateful or route-based. If a packet leaves one end and never appears at the other, walk the path and check link state at both ends of every hop.

Why they behave differently

Asymmetric routing is Layer 3: forward and reverse paths differ. TCP is defined by its two endpoints, not the path between them (RFC 9293), so a pure asymmetric path carries a connection fine. It breaks only when a stateful device sits on one path and sees half the conversation. A firewall on the return path sees a SYN-ACK with no matching SYN and drops it. A firewall on the forward path sees the SYN and the ACK but never the SYN-ACK, and kills the flow when its half-open timer expires (30 s default on Cisco ASA). NAT on one path fails the same way: the return tuple doesn't match the translation table. On a Linux host, strict reverse-path filtering (net.ipv4.conf.all.rp_filter=1, RFC 3704) drops the packet because its source doesn't route back out the ingress interface: upstream default is 0, RHEL-family installs commonly ship 1.

A unidirectional link is Layer 1/2: the segment carries frames one way. Cut the TX strand from A to B and B loses light, so B's interface goes down while A's stays up: asymmetric link state is the smoking gun. If the break is in a patch panel or cross-connect, both ends keep link up and the failure is silent. At L2, ARP/ND (RFC 4861) never completes: A's requests go out, replies never return, and ip neigh shows the peer INCOMPLETE or FAILED. Routing protocols notice too: the side that can receive but not transmit sees its OSPF neighbor stuck in INIT, because its own router ID never appears in the peer's hello.

The trace that separates them

# tcpdump -nn -i any port 443, running on both hosts at once
A (10.0.1.5)                          B (10.0.9.20)
12:00:01.100  S  seq 1000             12:00:01.104  S  seq 1000
12:00:02.104  S  seq 1000  (+1.0 s)   12:00:01.104  S. seq 5000 ack 1001
12:00:04.108  S  seq 1000  (+2.0 s)
12:00:08.116  S  seq 1000  (+4.0 s)

B received the SYN and answered. A never saw the SYN-ACK, so it retransmits on Linux's 1/2/4/8 s backoff and gives up with ETIMEDOUT after ~127 s (tcp_syn_retries=6). From A alone this looks exactly like a dead return path. B's capture proves the packet was sent, so the question becomes: did the return path drop it physically or by policy? Check link state and counters on every hop of the return path.

Confirming evidence

CheckAsymmetric routing (stateful drop)Unidirectional link
Packets at both endsSame packets seen at both ends; drop is at a middlebox or host stackPacket leaves one end, never appears at the other
Link state (ip -br link, ethtool <dev>)Both ends up, traffic in both directionsOne end up, one end down, or both up with RX frozen
ethtool -S <dev>TX and RX both incrementTX climbs, RX flat; rx_*_errors or loss-of-signal
ip neigh showPeer REACHABLEPeer INCOMPLETE/FAILED on the side that can't receive
Routing adjacencyOSPF/BGP full on both endsOSPF neighbor stuck in INIT on the receiving-only side, absent on the other
Reverse path (ip route get <src> on the receiver)Returns a different interface than the ingress → strict rp_filter drops itLookup fine; L2 resolution never completes
TCP symptomHandshake completes then stalls, or SYN-ACK never returns; RST with a TTL that doesn't match the server'sSYN retransmits at 1/2/4/8 s, ETIMEDOUT after ~127 s

Traps

Asymmetric routing is normal in multihomed and BGP environments: don't call it a fault without a capture showing a one-sided stateful drop. A unidirectional link can be silent when the break is mid-path; UDLD (RFC 5171) or BFD is what catches it, and without them you're reading counters. If the link fails mid-flow, established connections stall too: it isn't only a handshake failure. And a RST whose TTL doesn't match the server's is a middlebox RST, not the server's. Synchronize clocks (NTP) before correlating two captures.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-19

How do you troubleshoot BGP route flapping and isolate whether the trigger is physical layer instability, hold-time expiration, or policy misconfiguration?

Answer

To diagnose BGP route flapping, establish whether the instability is occurring at the BGP session level (session cycling between Established and Idle/Active) or purely at the prefix level (BGP session stays Established while specific prefixes undergo continuous UPDATE announce/withdraw cycles).

1. Differentiate Session Flap vs. Prefix-Only Flap

Run ss -it '( sport = :179 or dport = :179 )' and inspect the local routing daemon or host kernel routing table via ip route show. If the TCP socket uptime resets or transitions out of ESTAB, the problem is session-level (Layer 1/2 instability, MTU/fragmentation, or Keepalive/Hold-Timer expiry). If TCP socket uptime and rtt stay stable while prefixes continuously appear and vanish from ip route, the issue is policy churn, recursive next-hop flapping, or an upstream originator withdrawing prefixes.

2. Isolate Physical/Link Layer Instability

If the session is resetting, rule out physical links before transport timers:

  • Check link carrier counters and transceiver telemetry via ethtool: inspect link_duplex, speed, and interface stats for rx_crc_errors, carrier_changes, tx_abort_late_coll, or optical lane RX power thresholds (rx_power).
  • Verify Neighbor Table stability with ip neigh show nud reachable. If the peering address cycles between REACHABLE, DELAY, STALE, or FAILED, ARP/ND resolution is failing due to physical drops or Layer 2 storm-control drops.
  • Observe if the BGP reset directly correlates with carrier drops in system logs (dmesg -T showing link up/link down). If interface carrier drops precede socket termination, the trigger is physical Layer 1/2 instability.

3. Isolate Hold-Time Expiration

If physical carrier remains permanently up without drops, but the BGP state resets, evaluate transport timeouts:

  • Inspect the BGP Notification code received or sent. BGP Error Code 4, Subcode 0 denotes Hold Timer Expired (RFC 4271).
  • Check TCP layer metrics via ss -i: look at rto backoff, retrans, and unacked. If retransmits climb to the threshold and TCP triggers ETIMEDOUT (RFC 9293) or BGP hold-timer (commonly 90s default, keepalive 30s) fires before three keepalives arrive, capture traffic on port 179:
Shell
tcpdump -nn -i eth1 -s 0 -vv "tcp port 179"
  • If UPDATE or KEEPALIVE packets are leaving host A but no ACKs return, or large UPDATE packets fail while 19-byte KEEPALIVE frames pass, Path MTU Discovery is broken: large route updates exceeding the link MTU trigger unacknowledged drops because ICMP "Packet Too Big" (RFC 792 / RFC 4443) is filtered. This causes hold-time expiration exclusively when prefixes are being exchanged.

4. Isolate Policy and Recursive Route Flapping

If the TCP session is completely uninterrupted (socket uptime is hours/days):

  • Capture BGP UPDATE messages with tcpdump -nn -i eth1 -s 0 -vv "tcp port 179 and (tcp[tcpflags] & tcp-push != 0)" to observe the withdrawn routes and path attributes.
  • Check recursive next-hop reachability: if an incoming prefix relies on an IGP route (e.g., via OSPF or static route) that itself depends on the prefix being learned (or vice versa), resolving the next hop causes an immediate route withdrawal or reachability oscillation.
  • Check route-map or export policy churn: review if maximum-prefix limits are hit, triggering automated teardown with Notification Code 6 Subcode 1 (Cease: Maximum Number of Prefixes Reached), or if conditional advertisement (e.g., advertise-map ... exist-map) is tracking a flapping upstream link.
ObservationLayer / CauseEvidenceRemediation / Verification
Carrier transitions, CRC errors, frame dropsPhysical / Link (L1/L2)ethtool -S, carrier_changes > 0, ARP transitions FAILEDReseat optics/cables, clean fiber, verify port speed/duplex negotiation
BGP Notification 4/0, TCP retransmits highTransport / MTU / Keepalivess -i shows RTO backoff; tcpdump shows small KEEPALIVEs pass, jumbo UPDATEs dropFix interface MTU mismatch, clamp TCP MSS, or allow ICMP PTB messages
Session stays ESTAB, constant UPDATE withdrawsPolicy / Routing Recursionip route fluctuates, tcpdump shows constant NLRI churn, session up > 24hFix recursive next-hop resolution, evaluate export filters, stop route loops

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-22

Design network troubleshooting telemetry.

Answer

Assumptions first: ~40 sites, ~2,000 hosts, hybrid cloud, one 10 GbE WAN link per site, and the ticket you actually get is "checkout is slow" with nothing else. One engineer, a few hundred GB/day of storage. You cannot capture everything, so the design is three tiers, each answering a different question, plus the correlation key that stitches them together.

Tier 1: always-on counters, 15 s scrape. Interface carrier/error/drop/queue, ARP/ND state and age, BGP/OSPF neighbor state and last flap, FIB/ECMP next-hop changes, conntrack table occupancy and drops, NAT pool utilization, DNS rcode mix and cache hit ratio, TCP retransmit/RTT/reset from the host MIB, TLS handshake failures and cert days-to-expiry. Cheap: ~40 sites × 200 interfaces × 40 series ≈ 320k series, roughly 1.5 GB/day in Prometheus/Thanos. This tier tells you where to look, never why.

Tier 2: sampled flow, 1:1000 sFlow/IPFIX. Per-flow src/dst, ports, DSCP, next-hop, bytes, and TCP flags. ~50 GB/day raw, aggregated to top-K by (site, path, prefix) before storage. Sampling at 1:1000 will miss a single dropped packet; it is for path and volume attribution, not loss accounting.

Tier 3: on-demand, triggered. eBPF ring buffer on each host, 200 MB, 5-minute rolling window, capturing per-socket connect latency, retransmit events, and the last N packets of a flow. Dumped only when an alert fires or an engineer runs a command. This is where you get the answer.

Worked trace. 14:02:11, checkout p99 jumps 400 ms → 2.4 s. The app span shows 2.4 s total; the proxy log shows 1.9 s in upstream connect, so the delay is before the app. Host eBPF shows SYN sent at t=0, no reply, retransmit at t=1.0 s (initial RTO), SYN-ACK at t=1.8 s. Tier 1 shows an ECMP next-hop change on that path at 14:01:50 from a config push. The new next-hop's ARP entry was incomplete, so the router dropped the first SYN; ARP resolved inside the retransmit window. Interface error counters are flat: this was never a link problem, and only the neighbor-state and FIB-change series point at it.

TierCarriesCostRetention
1 counterslink, neighbor, route, conntrack, DNS, TCP MIB~1.5 GB/day90 d
2 flowpath, volume, DSCP, flags~50 GB/day14 d
3 captureper-socket timing, packets200 MB/host, on demand5 min rolling

Trade-offs. Sampling versus always-on: 1:1000 flow is affordable but blind to single-packet loss, so pair it with always-on retransmit counters rather than raising the rate. Agent versus flow export: an eBPF agent gives per-socket RTT and retransmit counts that IPFIX cannot, at the cost of deploying and versioning a kernel-side program on 2,000 hosts; flow export needs no host change and survives a host that is too sick to run an agent. Always-on pcap at 10 Gbps is ~10 TB/day: that is why tier 3 is triggered, not continuous.

How this fails. Clock skew: an NTP step of 200 ms reorders spans and invents causality; run chrony with sub-millisecond sync across sites and keep monotonic clocks for intra-host ordering. Cardinality: labelling by connection or ephemeral port blows up the TSDB. Cap with top-K and drop the rest. Fate sharing: if telemetry rides the same path as traffic, the outage you are debugging also silences the data; collect out-of-band and run a dead-man switch that alerts when a site stops reporting for two scrape intervals. Sampling bias: a 1:1000 sampler under-reports short flows, so never compute loss ratios from it. Detect all four with scrape-staleness alerts, series-count growth alarms, and a periodic synthetic probe whose known-good path is checked against the pipeline.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-25

Review a complex networking investigation end to end.

Answer

Core answer

First I'd narrow the blast radius before opening a single capture. The report is "checkout p99 went from 90 ms to 30 s timeouts on about 2% of calls to the payments API, starting 14:00 UTC." Two facts decide the whole investigation: only large requests fail, and it started right after the VPN tunnel was re-keyed. That points at path MTU, not the application.

Assumptions I'd state out loud: TCP over IPv4, a GRE-over-IPsec tunnel between the VPC and the partner, and no control over the partner's firewall. If those are wrong the diagnosis changes.

Mechanism

The tunnel adds overhead the endpoints don't know about. GRE is 4 bytes plus a 20-byte outer IP header; IPsec ESP adds roughly 50-73 bytes depending on cipher and mode. The tunnel interface is configured at 1400 bytes MTU: a common choice that leaves room for that overhead. The client still advertises MSS 1460 in its SYN because its own interface is 1500. When it sends a 1460-byte segment with DF set, the tunnel router must fragment or drop. It drops, and sends ICMP type 3 code 4 back. If that ICMP is filtered (common, since many firewalls drop all ICMP) the sender never learns and retransmits the same oversized segment until the app times out. Small requests fit under 1400 and sail through, which is exactly the 2% pattern.

Evidence

I'd confirm from both ends, not one. On the client:

14:02:11.482 IP 10.0.4.17.51234 > 10.9.1.20.443: Flags [P.], seq 1:1461, ack 1, length 1460
14:02:11.683 IP 10.0.4.17.51234 > 10.9.1.20.443: Flags [P.], seq 1:1461, ack 1, length 1460
14:02:12.085 IP 10.0.4.17.51234 > 10.9.1.20.443: Flags [P.], seq 1:1461, ack 1, length 1460

Same sequence number three times, ack never advances, gaps of 200/400/800 ms: that's RTO backoff, not loss. No ICMP in the capture. Then I'd probe the path directly: ping -M do -s 1372 10.9.1.20 succeeds, -s 1373 fails, so PMTU is 1400. ss -ti on the client shows retransmits climbing on that socket.

Fixes and trade-offs

Three options. Clamp MSS on the tunnel interface, iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu, is local, reversible, and fixes TCP immediately, but does nothing for UDP or QUIC. Allowing ICMP type 3 code 4 through the firewall is the correct fix and helps every protocol, but needs a change on the partner's side and some security policies forbid ICMP outright. Lowering the tunnel interface MTU to 1400 is blunt but covers everything; it costs a little throughput on every flow. I'd clamp now to stop the bleeding and push for the ICMP rule as the durable fix.

Failure modes to watch

If the capture shows 64 KB "packets," TSO/GSO is lying to you: disable with ethtool -K eth0 tso off gso off or capture on the wire. If only some flows fail, ECMP may be hashing across paths with different MTUs. If timestamps disagree between hosts, check NTP before trusting ordering.

What I'd state as observed vs inferred

Observed: retransmissions of 1460-byte segments, PMTU 1400, no ICMP returned. Inferred: the partner's firewall drops ICMP type 3 code 4. I'd prove that by watching the tunnel router's egress counter, not by assuming it.

Curated: · Written: · Reviewed:

Difficulty: Hard