eBPF on WSL2 [kernel version 6.x] [Ubuntu] [x64] [Arm64] [2024]
Introduction A few days ago, I wanted to develop eBPF application on WSL2 but turned out i can't develop eBPF application on ordinary WSL2 kernel, so i started to research how can i accomplish this task. i found lots of tutorials but they didn't quite handy cause they were outdated or not worked so i decided to write blog post to help others getting started with developing and running eBPF programs. Step 0 Update all packages on your system: sudo apt update && sudo apt upgrade Step 1 Clone Microsoft Linux kernel repository from GitHub: git clone https://github.com/microsoft/WSL2-Linux-Kernel.git --depth=1 -b linux-msft-wsl-6.6.36.3 step 2 open WSL kernel config using gedit so you can easily edit file with GUI: gedit WSL2-Linux-Kernel/Microsoft/ config-wsl step 3 add these flags (override them with new value if flag exist): CONFIG_BPF=y CONFIG_BPF_SYSCALL=y CONFIG_NET_CLS_BPF=m CONFIG_NET_ACT_BPF=m CONFIG_BPF_JIT=y CONFIG_HAVE_EBPF_JIT=y CONFI