Skip to content
Network debugging for platform engineers · Chapter 20 of 21 Appendix B: Troubleshooting catalog and cheat sheet

Appendix B: Troubleshooting catalog and cheat sheet

Two ways into the same 17 days: the troubleshooting catalog starts from the symptom, the way an incident is reported in everyday work. The cheat sheet sorts the commands by layer. The days are in parentheses. You replace placeholders in angle brackets; ip -n <ns> is the short form of ip netns exec <ns> ip.

Troubleshooting catalog by symptom

The method is always the same (Day 16): test the same target from two places and compare the answers. The first measurement in the table is the one that rules out a layer the fastest.

Symptom First measurement Typical causes Day
Connection timed out ip route get <target>, then tcpdump at the target firewall with DROP, return path missing (no default route, asymmetric), machine off 2, 4, 10, 16
Connection refused ss -ltnp 'sport = :<port>' on the target service not running, listens on 127.0.0.1, wrong port; in the cluster: Service without endpoints 4, 5, 12
No route to host ip neigh show <ip>, ip route get <ip> neighbor doesn’t answer ARP (~3 s) or ICMP reject from a firewall (immediately) 3, 4
works sometimes, sometimes not ip neigh show <ip> on the gateway, arping -d -c2 -I <dev> <ip> duplicate IP address, stale ARP entry 3
unreachable via the second interface ip route get <client> from <address> reply leaves via the other interface, rp_filter or firewall drops it 2
Could not resolve host immediately getent ahosts <name>, cat /etc/resolv.conf name doesn’t exist (NXDOMAIN), wrong search domain, dnsPolicy in the pod 6, 13
Resolving timed out dig +time=2 +tries=1 <name> and dig +tcp … DNS server gone, UDP 53 blocked, egress policy without DNS, upstream unreachable 6, 13, 14, 16
name works with dig, not in the application getent ahosts <name> /etc/hosts, search list, dig without +search 6, 13
SERVFAIL after seconds resolver log, ip route get <upstream> upstream/stub domain unreachable (missing route), DNSSEC 6, 13
slow, but it works curl -w with time_namelookup, time_connect, time_starttransfer DNS timeout of the first nameserver, path (connect), application (first byte) 7
SSL certificate problem: unable to get local issuer certificate openssl s_client -showcerts -servername <name> intermediate certificate missing, unknown CA 8
no alternative certificate subject name matches openssl s_client … \| openssl x509 -noout -ext subjectAltName wrong certificate in the vhost, no SNI (-H Host instead of --resolve) 8, 16
rule changed, old clients behave as before conntrack -L existing connections use the old entry 9
small responses fast, large ones hang or take seconds ping -M do -s <size> between both ends MTU black hole: smaller segment, ICMP filtered; overlay without a matching MTU 15
ping: sendmsg: Message too large ip route get <target> (mtu in the route) that’s correct: the sender knows the limit 15
container unreachable from outside nsenter -t <pid> -n ss -ltn, Docker’s DNAT rule service in the container listens on 127.0.0.1, port not published 11
lab network no longer gets through the VM since Docker runs iptables -L FORWARD -n -v, iptables -L DOCKER-USER -n -v FORWARD policy DROP from Docker, rule in DOCKER-USER missing; raw rule for container addresses 11, 12, 16
Service in the cluster doesn’t respond kubectl get endpointslices -l kubernetes.io/service-name=<svc> selector doesn’t match, readiness probe fails, wrong targetPort 12, 16
ClusterIP doesn’t answer ping – that’s correct: Services exist only for their ports, and with Cilium (socket LB) not even as an address on the wire 12
timeout since NetworkPolicies were rolled out hubble observe --verdict DROPPED --to-pod <ns>/<pod> Service port instead of pod port, DNS forgotten for egress, namespace selector on a missing label 14, 16
pods hang in Unknown after a reboot kubectl -n kube-system get pods -l k8s-app=cilium, Cilium agent log Cilium can’t reach the API server (fixed IP in k8sServiceHost) Appendix A

Cheat sheet by layer

Link (Day 1)

ip -br link                               # state of all links: UP, LOWER_UP, NO-CARRIER
ip -br addr                               # addresses, brief
ip -s link show <dev>                     # counters: RX/TX errors, dropped
bridge link                               # which port is attached to which bridge
ethtool <dev>                             # speed, duplex, link detected
Pitfall Day
UP without LOWER_UP = no link at the other end 1
Port missing from the bridge, although everything is “UP” 1
A route marked linkdown is still used 1

Route (Day 2)

ip route                                  # table main
ip route get <target> [from <source>]     # which path does a packet take, with which source?
ip rule                                   # which table for which packets
ip route show table <n>
sysctl net.ipv4.ip_forward                # 0 in every new namespace
nstat -az TcpExtIPReversePathFilter       # is rp_filter dropping packets?
Pitfall Day
No default route looks like a DNS problem 2
The longest matching route wins, not the first one 2
Asymmetric return path: policy routing instead of rp_filter=0 2
A route proves the path, not reachability 2, 15

Neighbors and Layer 2 (Day 3)

ip neigh show [<ip>]                      # REACHABLE, STALE, FAILED
ip neigh flush dev <dev>
arping -c2 -I <dev> <ip>                  # ask directly on Layer 2
arping -d -c2 -I <dev> <ip>               # duplicate address? (-d: exit code 1 for two different MACs)
bridge fdb show br <bridge>               # which MAC on which port

Reachability and ports (Days 4, 5)

nc -zv -w2 <ip> <port>                    # refused / timeout / succeeded
mtr -n -r -c10 <target>                   # loss is only real if it persists up to the target
mtr -n -r -c5 -T -P <port> <target>       # with TCP SYN instead of ICMP
ss -ltnp                                  # who listens where (process with -p)
ss -ltnp 'sport = :<port>'
ss -tano 'sport = :<port>'                # connections with timers (-o)
ss -tano state syn-sent                   # hanging connection attempts
ss -tnp state close-wait                  # growing = bug in your own application
Pitfall Day
Ping is not a test for a TCP service 4
127.0.0.1 vs. 0.0.0.0: from outside you only see what listens on an outside address 5
A full backlog (Recv-Q > Send-Q for LISTEN) looks like a DROP firewall 5

DNS (Days 6, 13)

dig <name>                                # status:, ANSWER, SERVER
dig +short <name>
dig @<server> <name>
dig +tcp <name>                           # same question over TCP
dig +search <name>                        # with the search list, like an application
dig +time=2 +tries=1 <name>               # give up quickly
getent ahosts <name>                      # asks like the application (nsswitch)
cat /etc/resolv.conf                      # nameserver, search, options ndots
Pitfall Day
dig uses the search list only with +search 6, 13
ndots:5: an external name costs ten queries; a trailing dot = fully qualified 13
dnsPolicy: Default = the node’s DNS, not CoreDNS 13
CoreDNS reloads the Corefile only after up to ~2 min; comments don’t trigger a reload 13
A stub domain needs a route from the node to the upstream 13

HTTP (Day 7)

curl -v <url>                             # > sent, < received, * curl itself
curl -s -o /dev/null -w '%{http_code} %{time_namelookup} %{time_connect} %{time_appconnect} %{time_starttransfer} %{time_total}\n' <url>
curl --resolve <name>:<port>:<ip> <url>   # name → IP without DNS, SNI is correct
curl -sSL --max-redirs 5 <url>            # follow redirects, at most five
curl -f <url>                             # for HTTP ≥ 400, exit code 22

TLS (Day 8)

openssl s_client -connect <ip>:<port> -servername <name> [-CAfile <ca>] </dev/null
openssl s_client … -showcerts </dev/null  # the whole chain the server sends
openssl x509 -in <crt> -noout -subject -issuer -dates -ext subjectAltName
openssl verify -CAfile <root> -untrusted <intermediate> <crt>
Pitfall Day
Only the SAN counts for the name 8
Without SNI, the server sends its default certificate 8
“Chain valid” and “for this name” are two separate checks 8, 16

Firewall, NAT, connections (Days 9, 11)

nft list ruleset                          # all rules, including those from iptables-nft
nft list table <family> <table>
iptables -L <chain> -n -v --line-numbers  # counters per rule
conntrack -L [-p tcp --dport <port>]      # connection tracking table
conntrack -E                              # events live
conntrack -D -p udp --dport <port>        # delete entries, force a new connection

Capturing (Day 10)

tcpdump -ni <dev> host <ip> and port <port>
tcpdump -ni any -c 10 '<filter>'
tcpdump -ni <dev> -w <file>.pcap '<filter>'
tshark -r <file>.pcap -Y 'tcp.analysis.retransmission'

Containers (Day 11)

docker inspect -f '{{.State.Pid}}' <container>
nsenter -t <pid> -n ss -ltn               # in the container's network namespace
nft list chain ip nat DOCKER              # DNAT for port publishing
iptables -L DOCKER-USER -n -v             # your own rules before Docker's FORWARD DROP

Kubernetes and Cilium (Days 12–15)

kubectl get endpointslices -l kubernetes.io/service-name=<svc>
kubectl -n kube-system exec ds/cilium -c cilium-agent -- cilium-dbg service list
kubectl debug <pod> --image=nicolaka/netshoot:v0.17 --target=<container> -c diag -- <command>
kubectl -n kube-system logs -l k8s-app=kube-dns     # with the log plugin in the Corefile
hubble observe --from-pod <ns>/<pod> --since 1m
hubble observe --verdict DROPPED --to-pod <ns>/<pod>
kubectl -n kube-system exec ds/cilium -c cilium-agent -- cilium-dbg identity get <id>
ping -M do -s <size> <target>             # bracket the path MTU: size + 28 = IP packet
cilium config view | grep -E "^(routing-mode|tunnel-protocol|mtu)"
Pitfall Day
Policy ports are pod ports, not Service ports 14
namespaceSelector + podSelector in one entry = AND, in two entries = OR 14
VXLAN costs 50 bytes: underlay 1500 → pod MTU 1450 15
The Cilium Helm value MTU only takes effect after rollout restart daemonset/cilium 15
Hubble doesn’t see losses in the underlay 15

Numbers worth knowing

Number Meaning Day
1500 / 1450 / 1400 Ethernet MTU / pod MTU with VXLAN / example of a smaller underlay 15
28 IP (20) and ICMP header (8): ping -s 1422 = 1450-byte packet 15
50 VXLAN envelope: 14 Ethernet + 20 IP + 8 UDP + 8 VXLAN 15
8472 / 6081 UDP port of VXLAN with Cilium / Geneve 15
53 DNS – UDP and TCP 6, 14
1232 EDNS buffer size: larger DNS responses come via TCP 13, 14
5 ndots in the pod: names with fewer dots go through the search list first 13
10.96.0.10 ClusterIP of kube-dns in the kind cluster 13
~3 s until “No route to host” when no neighbor answers ARP 4

Passed the exam? With a free account it counts towards your belt. Sign up for free

Contents

More