Linux OS Internals (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
How does Network Packet Processing work in the Linux Kernel (sk_buff, Netfilter, eBPF)?
senior Levellinux-osAdvanced Internals
In Simple Words:
- NIC receives packet, DMA-transfers bytes to host RAM, triggers a hardware interrupt.
- Kernel processes packet via NAPI polling loop, wraps raw bytes in an
sk_buff(Socket Buffer). - Packet traverses the Netfilter architecture (iptables / nftables chains:
PREROUTING,INPUT,FORWARD,OUTPUT,POSTROUTING). - eBPF (Extended Berkeley Packet Filter): Allows running sandboxed bytecode directly inside the kernel network driver layer (XDP - eXpress Data Path), dropping malicious DDoS packets or routing packets in nanoseconds before
sk_buffallocation!