Saturday 2 June 2012

How to install UCARP

Common Address Redundancy Protocol(CARP)

UCARP allows multiple servers to share common virtual IP addresses in order to provide automatic failover. UCARP is a portable implementation of the CARP protocol.

Set up UCARP Installation on two hosts

Install ucarp on both nodes(nodeA and nodeB) and set one nodeA as master.

apt-get install ucarp


On nodeA

Add the following entries

vim /etc/rc.local

ucarp -i eth0 -s 192.168.1.27 -v 1 -p secret -a 192.168.1.118 -u /etc/vip-up.sh -d /etc/vip-down.sh -z -B

vim /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.1.222
netmask 255.255.255.0
gateway 192.168.1.10

ucarp-vid 33
ucarp-vip 192.168.1.118
ucarp-password secret
ucarp-advskew 0
ucarp-advbase 1
ucarp-facility local1
ucarp-master yes
ucarp-upscript /usr/share/ucarp/vip-up
ucarp-downscript /usr/share/ucarp/vip-down

iface eth0:ucarp inet static
address 192.168.1.118
netmask 255.255.255.0

On nodeB

Add the following entries

vim /etc/rc.local

ucarp -i eth0 -s 192.168.1.29 -v 1 -p secret -a 192.168.1.118 -u /etc/vip-up.sh -d /etc/vip-down.sh -z -B

vim /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.1.29
netmask 255.255.255.0
network 192.168.1.0
gateway 192.168.1.10
broadcast 192.168.1.255

ucarp-vid 33
ucarp-vip 192.168.1.118
ucarp-password secret
ucarp-advskew 0
ucarp-advbase 1
ucarp-facility local1
ucarp-master no
ucarp-upscript /usr/share/ucarp/vip-up
ucarp-downscript /usr/share/ucarp/vip-down

iface eth0:ucarp inet static
address 192.168.1.118
netmask 255.255.255.0

1 comment:

  1. on node A 192.168.1.27 should be also in the interfaces file (not 222)

    ReplyDelete