Usually, a Virtual IP is used to distribute the workload automatically among cluster nodes. Cisco uses HSRP to combine their routers in the Standby group with a single VIP assigned, which stands for the default gateway in a network. FreeBSD and Linux (Ubuntu, CentOS6, and Centos7) operating systems use CARP and UCARP respectively for this purpose.
- IP addresses for Master and Slave machines
- Username and password for a superuser (root)
- Virtual IP address
- Preshared key to encrypt CARP/UCARP command flow
The configuration of Master/Slave is possible only between similar operating system – FreeBSD/FreeBSD, Ubuntu/Ubuntu, CentOS6/CentOS6 or CentOS7/CentOS7. Determination of the type of operating system is performed automatically.
The test environment consists of Ubuntu, CentOS6, CentOS7, FreeBSD servers in which the CARP/UCARP will be configured. Each type of OS has 2 machines.
Only machines of one type of OS can be configured at a time.
Note: The python script uses fabric library which requires BASH to be installed on all FreeBSD machines. Please use the following commands:
# pkg install -y bash
# echo "fdesc /dev/fd fdescfs rw 0 0" >> /etc/fstab ; mount -a
# chsh -s bash root ; cp /usr/local/bin/bash /bin/
Execute script to configure servers.
You can test the system by shutting down the master node while pinging the VIP. Only one ping should be lost.
If you try to use different types of operation systems for master and slave nodes, you will get the following notification and script will not perform the installation.
Try with Ubuntu and CentOS6 server:
Try with CentOS6 and CentOS7 server:
Use the following commands to download and execute code files:
# git clone https://github.com/jamalshahverdiev/carp-ucarp-unix-linux.git
# cd carp-ucarp-unix-linux