Building an eBPF/XDP NAT-Based Layer 4 Load Balancer Coding Lab Now Available
Building connection tracking, hashing, and packet rewriting from scratch using eBPF
First of all, happy new year everyone ⭐️
While many of you have probably set new things to try in 2026, I decided to double down on hands-on coding labs.
The response so far has been amazing. I’ve also realized that interactive tutorials—with a terminal right next to the code—offer huge advantages over traditional text- and image-based guides you’re supposed to run locally.
Let’s be honest: we rarely do that. Out of the box, things often don’t work, dependencies are missing, and you end up installing and tweaking more than actually learning.
This week, we continue with XDP. Specifically, I’ll show you how to build an eBPF/XDP NAT-based Layer 4 load balancer in roughly 200 lines of code (plus some boilerplate).
In the next tutorial, we’ll build on this foundation and add DSR (Direct Server Return) Layer 2 load balancing and IPIP encapsulation.
🔗 Here’s the link to the coding lab.
Hope you like it 🤞



