GUIDES
Linux Network Stack — Packet Journey
A packet entering or leaving a Linux host passes through a well-defined sequence of kernel subsystems. Understanding this journey helps when debugging connectivity, writing eBPF programs, or tuning firewall rules.
View the full interactive guide: Linux Network Stack — Packet Journey
Topics covered:
- Paths — Inbound, Outbound, and Packet Forwarding paths with step-by-step diagrams
- NIC & NAPI — DMA, ring buffers, interrupt coalescing, and tunables
- XDP — eXpress Data Path: modes (native/generic/offloaded/AF_XDP), actions, C example
- sk_buff — kernel socket buffer structure, key fields, zero-copy operations
- Traffic Control (TC) — qdiscs, classes, filters, eBPF attachment via clsact
- Netfilter — five hook points, table evaluation order, iptables/nftables commands
- conntrack — connection states, TCP state machine, table exhaustion
- IP Layer — FIB routing lookup, fragmentation, MTU
- Transport (TCP/UDP) — reassembly, socket demux, congestion control, key sysctls
- Sockets — send/receive buffers, socket types including AF_XDP
- eBPF Hooks — XDP, TC, socket ops, sk_skb, cgroup/skb programs with examples
- Reference — Netfilter chain lookup table, Ethernet/IP/TCP packet structure
- Tuning — sysctl parameters for throughput, latency, and connection capacity