Skip to content

Instantly share code, notes, and snippets.

@msenturk
Created April 13, 2021 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msenturk/ce450be0545cb06efe688bce95e586d7 to your computer and use it in GitHub Desktop.
Save msenturk/ce450be0545cb06efe688bce95e586d7 to your computer and use it in GitHub Desktop.
ucarp + udp loadbalancer XDP sbulb
VIP 192.168.10.100
192.168.10.101 192.168.10.102
Ucarp + sbulb Ucarp + sbulb
Syslog Syslog
Ucarp
-----
A machine with a real IP of 192.168.10.101 is the preferred master for a virtual IP of
192.168.10.100, broadcasts are sent every 2 seconds.
ucarp -b 2 -s 192.168.10.101 -v 11 -p badpass -a 192.168.10.100 \
-u /etc/vip-up.sh -d /etc/vip-down.sh -z
The hot standby with an IP of 192.168.10.102 uses the following command, (note the advskew
f 50 putting it at a disadvantage and making the first machine preferred).
ucarp -b 2 -k 50 -s 192.168.10.102 -v 11 -p badpass -a 192.168.10.100 \
-u /etc/vip-up.sh -d /etc/vip-down.sh -z
sbulb
------
bcc installed. (currently tested with v0.8 : package python3-bpfcc on debian)
linux-headers installed to allow bcc to compile bpf code.
sudo python3 -m sbulb eth0 -vs 192.168.10.100 -rs 192.168.10.101 192.168.10.102 -p 514
systemd
-------
[Unit]
Description=UDP Load Balancer
Wants=network-online.target
[Service]
Type=notify
NotifyAccess=all
Environment=PYTHONUNBUFFERED=1
ExecStart=/usr/bin/python3 -m slulb args...
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment