- Not working with network-manager
- Only tested on Debian 12 Bookworm.
- Only in IPv4
In my example, I will use 2 machines with each two interfaces. So on each machine you will have :
- ens19 the interface in data LAN that speaks to servers and clients
- ens18 the interface in management LAN for managing ULB.
git clone https://github.com/Laurent-Bardi/ULB.git
cd ULB
Here the installation script is
install_ulb.pl v1.00 usage :
install_ulb.pl -h
=> help
install_ulb.pl -p path -i interface_name -a real_ip_for_carp -b virtual_ip_for_carp -n vhid [-m]
=> install ULB
=> -p path : where to install
=> -i interface_name name of the interface that will received carp process
=> -a real ip
=> -b virtual ip
=> -m if present will be the ucarp master
=> -n vhid identifier [1..255]
=> master example install_ulb.pl -p /usr/local/ULB -i ens19 -a 10.56.64.18 -b 10.56.65.8 -n 8-m
=> slave example install_ulb.pl -p /usr/local/ULB -i ens19 -a 10.56.64.19 -b 10.56.65.8 -n 8
some explanations : regarding the schema
- -p the path where all the ULB files (scripts, data, config) should stay (generally /opt/ULB or /usr/local/ULB)
- -a parameter stands for IPrb1 for the first machine and IPrb2 for the second. It will be the real load-balancer IP on the data subnet
- -b parameter stands for IPrb1-rb2 it is the virtual IP that will float between the interface on the machines (on ens19 in my case)
- -n is the vhid parameter, between 1 and 255 it must be UNIQUE on the network (otherwise ucarp would mix theirs configurations)
- -m is master (the one who will own, at first, the virtual IPrb1-rb2). MUST BE ON ONLY ON ONE OF THE TWO MACHINES
perl install_ulb.pl -p /usr/local/ULB -i ens19 -a 10.56.64.18 -b 10.56.65.8 -n 8 -m
perl install_ulb.pl -p /usr/local/ULB -i ens19 -a 10.56.64.19 -b 10.56.65.8 -n 8
Here you see that the first machine will became the master. You are welcome to test by rebooting /making shutdown-restart of the machine that virtual IPrb1-rb2 move from one machine to the other.
Security : on the 2 machines, edit the file /etc/network/interfaces.d/ucarp_$interface (the one you use with -i parameter when doing install) and change "ucarp-password totolitoto" with a password of max 20 characters.
Now we are going to define what redirectors we want. Each must be run on the two machines (otherwise they will not make the same redirections). Suppose we have three DNS servers (can be the number you want)- 10.64.200.61
- 10.64.200.71
- 10.64.200.81
Then the code will be
# get in the ULB path
cd /usr/local/ULB
# get in the prog
cd sbin
# create a TCP farm
perl create_farm.pl -n dns_udp -d 10.56.65.8:53 -p U -c 10.64.200.61:53,10.64.200.71:53,10.64.200.81:53
#then an UDP farm
perl create_farm.pl -n dns_udp -d 10.56.65.8:53 -p T -c 10.64.200.61:53,10.64.200.71:53,10.64.200.81:53
do the same on the second machine (same command lines)
And then launch on the master
perl launch_all_farm.pl
- 10.64.200.61
- 10.64.200.71
- 10.64.200.81
Then the code will be
# get in the ULB path
cd /usr/local/ULB
# get in the prog
cd sbin
# create a TCP farm
perl create_farm.pl -n dns_udp -d 10.56.65.8:3268 -p U -c 10.64.200.61:3268,10.64.200.71:3268,10.64.200.81:3268
do the same on the second machine (same command lines)
And then launch on the master
perl launch_all_farm.pl
- 10.64.200.61
- 10.64.200.71
- 10.64.200.81
Then the code will be
# get in the ULB path
cd /usr/local/ULB
# get in the prog
cd sbin
# create a TCP farm
perl create_farm.pl -n dns_udp -d 10.56.65.8:389 -p U -c 10.64.200.61:389,10.64.200.71:389,10.64.200.81:389
do the same on the second machine (same command lines)
And then launch on the master
perl launch_all_farm.pl
- in $ULB_installed_PATH/sbin you have the scripts/programs
- in $ULB_installed_PATH/bin you have the wrappers that bind/unbind farms on the virtual IP
- in $ULB_installed_PATH/etc you have the first free control port for redirectors
- in $ULB_installed_PATH/var you have a file for each farm you've defined