Multiple CARP interfaces on FreeBSD 10 RELEASE

Hi!

I install 10-RELEASE and I can't find in the man pages how I can create multiple CARP interfaces or something like this (FreeBSD < 10):
Code:
re0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=389b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
 	ether 73:73:b3:93:93:13
	inet 11.22.33.1 netmask 0xffffff00 broadcast 11.22.33.255
 	media: Ethernet autoselect (100baseTX <full-duplex>)
 	status: active
carp12: flags=49<UP,LOOPBACK,RUNNING> metric 0 mtu 1500
	 inet 11.22.33.12 netmask 0xffffffe0 
	 carp: MASTER vhid 12 advbase 1 advskew 1
carp14: flags=49<UP,LOOPBACK,RUNNING> metric 0 mtu 1500
 	inet 11.22.33.14 netmask 0xffffffe0 
 	carp: MASTER vhid 14 advbase 1 advskew 1
carp16: flags=49<UP,LOOPBACK,RUNNING> metric 0 mtu 1500
 	inet 11.22.33.16 netmask 0xffffffe0 
	carp: MASTER vhid 16 advbase 1 advskew 1
After 15 minutes of experiments and reading source code CARP and ifconfig I found the solutions:
Code:
    ifconfig em0 alias vhid 3 pass mekmitasdigoat 192.168.1.1/24
    ifconfig em0 alias vhid 5 pass mekmitasdigoat 192.168.3.1/24
    ifconfig em0 alias vhid 4 pass mekmitasdigoat 192.168.4.1/24
..and I was happy!
Code:
em0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
	ether 08:00:27:7b:e3:c7
	inet 192.168.1.5 netmask 0xffffff00 broadcast 192.168.1.255 
	inet 192.168.1.1 netmask 0xffffff00 broadcast 192.168.1.255 vhid 3 
	inet 192.168.3.1 netmask 0xffffff00 broadcast 192.168.3.255 vhid 5 
	inet 192.168.4.1 netmask 0xffffff00 broadcast 192.168.4.255 vhid 4 
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
	media: Ethernet autoselect (1000baseT <full-duplex>)
	status: active
	carp: MASTER vhid 3 advbase 1 advskew 0
	carp: MASTER vhid 5 advbase 1 advskew 0
	carp: MASTER vhid 4 advbase 1 advskew 0

ifconfig params to change state
Code:
ifconfig em0 vhid 3 state backup
ifconfig em0 vhid 3 state master

This post just for information.

Have fun!

p.s.
rc.conf in FreeBSD 10:
Code:
ifconfig_em0_alias0="vhid 4 pass mekmitasdigoat 192.168.4.1/24"
ifconfig_em0_alias1="vhid 3 pass mekmitasdigoat 192.168.3.1/24"
 
@vdemtcev

How did you load the CARP module? When I try to create an interface I get the following error:
Code:
SIOCGVH: Protocol not supported

I assume the CARP module is not loaded. I have the following line in /boot/loader.conf, but I am guessing the name changed in Freebsd FreeBSD 10-RELEASE.
Code:
if_carp_load="YES"
 
Last edited by a moderator:
Actually, a whole heck of a lot changed between 9.x and 10.0 when it comes to CARP.

Basically, forget everything you know about configuring CARP on pre-10 systems. None of it works. :)

On 9.x, you create a separate pseudo-interface called carp0. On 10.x, you just change parameters of the existing interfaces via ifconfig(8).

The Handbook section only applies to pre-10 systems. 10.0+ info hasn't been added to the Handbook yet, but is available here.
 
Thanks @phoenix for the help.

I have read the man page and the newcarp readme. I am still having trouble.

Is it still necessary to load the carp kernel module? If so how?

When I issue the following command :
Code:
ifconfig em1 vhid 111 advskew 100 pass PASSWORD 192.168.1.111/24
This is the error I get
Code:
ifconfig: SIOCGVH: Protocol not supported

Any help is appreciated.

UPDATE

Okay I got it.

The carp module if_carp.ko was renamed to carp.ko

To load carp add the following to /boot/loader.conf
Code:
carp_load="YES"
 
Last edited by a moderator:
Back
Top