Lampros - Weird Bricks

CARP on FreeBSD 10

21 March, 2015 | CARP

Some quick notes on setting up CARP on FreeBSD.

Most of this is based on the FreeBSD Handbook page

1. Add the carp kernel module - edit the file /boot/loader.conf and add the line


^ Make sure that this is done on all hosts To load the module without rebooting:

kldload carp

2. Then on the host you want to act as the master edit the /etc/rc.conf and add:

ifconfig_em0="inet netmask"
ifconfig_em0_alias0="inet vhid 100 advskew 100 pass lampros"

In the above the is going to be the "floating IP" address.

3. On the host you want to act as a backup:

ifconfig_em0="inet netmask"
ifconfig_em0_alias0="inet alias vhid 100 advskew 200 pass lampros"

As you can see the alias is identical with the exception of the advskew - to quote the manual on what advskew is:

The advskew parameter stands for ``advertisement skew''.  It is measured in 1/256 of seconds.  It is added to the base advertisement interval	to make one host advertise a bit slower that the other does.

4. Reboot both hosts - now from a third host ping the floating IP - in this example I'm pinging from Windows - after a few seconds I rebooted the master:

C:Windowssystem32>ping -t

Pinging with 32 bytes of data:
Reply from bytes=32 time<1ms TTL=64
Reply from bytes=32 time<1ms TTL=64
Request timed out.
Reply from bytes=32 time<1ms TTL=64
Reply from bytes=32 time<1ms TTL=64
Reply from bytes=32 time<1ms TTL=64

Ping statistics for
    Packets: Sent = 28, Received = 27, Lost = 1 (3% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 1ms, Average = 0ms

As you can see only one request timed out while the Virtual IP got moved to the backup host.

Note: If you are using VirtualBox make sure you've set both virtual machines Promiscuous Mode set to 'Allow All'.

To do this, go to the Settings of your virtual machine and click on 'Network'. The option for Promiscuous Mode is there.