Hits :
2904
ucarp :: Super Mini How To
About
UCARP[link1] allows a couple of hosts to share common virtual IP addresses in order
to provide automatic failover. It is a portable userland implementation of the
secure and patent-free Common Address Redundancy Protocol (CARP, OpenBSDĒs
alternative to the patents-bloated VRRP).
Strong points of the CARP protocol are: very low overhead, cryptographically signed messages, interoperability between different operating systems and no need for any dedicated extra network link between redundant hosts.
top
Scenario
+---------+ eth1 eth1 +----------+
| server1 |---------------- | server2 |
+---------+ +----------+
| (eth0) | (eth0)
| (eth0:1) |
| |
+--------------------------------------+
| | | switch | | |
+--------------------------------------+
|
|
|
+--------------------------------------+
| net |
+--------------------------------------+
top
Scripts
cat /root/vip-up.sh
#! /bin/sh
/sbin/ip addr add 192.168.3.3/24 dev eth0
/root/vip-down.sh
#! /bin/sh
/sbin/ip addr del 192.168.3.3/24 dev eth0
top
Commands
server1
ucarp -i eth1 -s 192.168.3.1 -v 1 --pass=mypassword -a 192.168.3.3 -P -u /root/vip-up.sh -d vip-down.sh
server2
ucarp -i eth1 -s 192.168.3.2 -v 1 --pass=mypassword -a 192.168.3.3 -u /root/vip-up.sh -d vip-down.sh
top