-
The project is inspired by lizrice lb from scratch and katran
-
ALB uses xdp-generic mode. Using xdp-native mode requires extra work such as attaching a dummy xdp_pass program to all involved interfaces. Refer to this for more explanation.
go install github.com/cilium/ebpf/cmd/bpf2go@latest
git clone https://github.com/libbpf/libbpf.git /tmp/libbpf
cd /tmp/libbpf/src
make -j`nproc`
BUILD_STATIC_ONLY=1 NO_PKG_CONFIG=1 make install
rm /usr/sbin/bpftool
apt update && apt install -y git
cd / && git clone --recurse-submodules https://github.com/libbpf/bpftool.git
cd bpftool/src
make install
ln -s /usr/local/sbin/bpftool /usr/sbin/bpftool
make generate
make setup-dev-env
make run-in-ns NS=alb
Make sure http servers are listening on port 80 in ns1 and ns2, then run:
sudo ip netns exec client curl 172.16.31.2
make clean-dev-env