Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Latest commit

 

History

History
79 lines (53 loc) · 1.44 KB

README.md

File metadata and controls

79 lines (53 loc) · 1.44 KB

bfp load balancer

Notes

  1. The project is inspired by lizrice lb from scratch and katran

  2. 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.

Structure

ALB Structure

Prerequisites

Install bpf2go

go install github.com/cilium/ebpf/cmd/bpf2go@latest

Install libbfp

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

Install bpftool

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

Generate bpf2go boilerplate

make generate

Develop

Setup environment

make setup-dev-env

Run

make run-in-ns NS=alb

Send Request to 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

Clean environment

make clean-dev-env