Carp stuck in INIT

Matt Churchyard matt.churchyard at userve.net
Wed Oct 15 15:36:06 UTC 2014


Hello,

I've just been providing help on the forums to a user trying to get carp to work with a /30 network, where only 1 address is available.
Two FreeBSD routers with one of the addresses in the /30 taken by the upstream ISP.

Looking through the carp manpage, which seems to show an example of carp addresses being used as the primary address on an interface (whereas I believe it had to be an alias before), I came up with the following example (with preempt enabled in /etc/sysctl.conf):

ifconfig_em0="vhid 10 pass mypass 192.168.0.100/24"
defaultrouter="192.168.0.10"

However, on boot, I got the following messages, and carp would stick forever in INIT mode.
(May not be word for word, written from memory)

em0: promiscuous mode enabled
carp: demoted by 240 to 240 (interface down)

I had to down/up the interface to get it to correctly jump into master or backup mode

This seems to have been fixed by changing rc.conf as follows (note the up keyword)
With this on master and backup, everything seems to work perfectly

ifconfig_em0="vhid 10 pass mypass 192.168.0.100/24 up"

In comparison to the above messages, which were from the master booting up, I now see the following:

em0: promiscuous mode enabled
carp: VHID 10 at em0: INIT -> BACKUP
carp: VHID 10 at em0: BACKUP -> MASTER (preempting a slower master)

Is this something that's known to be required, is there a problem, or is it just because I'm testing with virtualbox?
The examples on the carp man page don't use the up keyword.

(By the way I realise my tests don't use a /30 network like the one I was originally trying the help with, I was more interested in testing the use of carp as the only address on a machine. If it works with a single /24 carp address, I'd expect it to work with a single /30 carp address)

Regards,
Matt Churchyard


More information about the freebsd-net mailing list