# Multiple CARP interfaces on FreeBSD 10 RELEASE



## vdemtcev (Jan 20, 2014)

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):

```
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
```
*A*fter 15 minutes _of_ experiments and read_ing_ source code _CARP_ and ifconfig *I* found the solutions:

```
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!

```
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

```
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:

```
ifconfig_em0_alias0="vhid 4 pass mekmitasdigoat 192.168.4.1/24"
ifconfig_em0_alias1="vhid 3 pass mekmitasdigoat 192.168.3.1/24"
```


----------



## arenoir (Feb 11, 2014)

@vdemtcev

How did you load the CARP module? When I try to create an interface I get the following error:

```
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.

```
if_carp_load="YES"
```


----------



## SirDice (Feb 11, 2014)

The example in the handbook shows how to use multiple carp(4) interfaces. Nothing changed between 9 and 10 regarding the set up of carp(4).

http://www.freebsd.org/doc/en_US.ISO885 ... /carp.html


----------



## phoenix (Feb 11, 2014)

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.


----------



## arenoir (Feb 11, 2014)

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 :

```
ifconfig em1 vhid 111 advskew 100 pass PASSWORD 192.168.1.111/24
```
This is the error I get

```
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

```
carp_load="YES"
```


----------



## SirDice (Feb 12, 2014)

phoenix said:
			
		

> Actually, a whole heck of a lot changed between 9.x and 10.0 when it comes to CARP.


Bugger, I missed that  x(


----------

