# UCARP IP Failover between Jails on different Machines



## UCLAGeek (Jul 25, 2013)

Hi guys, 

I have two machines in a data center. I've created three jails on the main server (HostA). I want HostB to be a failover over for HostA and its jails. Each host has two NIC's using CARP for load balancing. What I am trying to do is have each jail on HostA failover to it's twin on HostB. Now I know CARP will not work in jails but I thought UCARP might except I keep getting an error 
	
	



```
ifconfig: ioctl (SIOCAIFADDR): permission denied
```

Is it possible to do this? Or is IP aliasing just out of the question for jails? If so do you have any recommendations for possible solutions? 

This is my /etc/rc.conf for HostA

```
ucarp_enable="YES"
ucarp_if="em0"
ucarp_vhid="1"
ucarp_pass="pass"
ucarp_preempt="YES"
ucarp_facility="daemon"
ucarp_src="192.168.1.1"
ucarp_addr="192.168.1.1"
ucarp_advbase="2"
ucarp_advskew="0"
ucarp_upscript="/usr/local/bin/ucarp_up.sh"
ucarp_downscript="/usr/local/bin/ucarp_down.sh"
```

And for HostB

```
ucarp_enable="YES"
ucarp_if="em0"
ucarp_vhid="2"
ucarp_pass="pass"
ucarp_preempt="YES"
ucarp_facility="daemon"
ucarp_src="192.168.1.2"
ucarp_addr="192.168.1.1"
ucarp_advbase="2"
ucarp_advskew="1"
ucarp_upscript="/usr/local/bin/ucarp_up.sh"
ucarp_downscript="/usr/local/bin/ucarp_down.sh"
```

My scripts are very basic:

ucarp_up.sh

```
#!/bin/sh
 
# Load variables from rc.conf
. /etc/rc.subr
load_rc_config ucarp
 
/sbin/ifconfig $ucarp_if alias $ucarp_addr/32
```

ucarp_down.sh

```
#!/bin/sh
 
# Load variables from rc.conf
. /etc/rc.subr
load_rc_config ucarp
 
/sbin/ifconfig $ucarp_if -alias $ucarp_addr/32
```

Thanks in advance for any help.


----------

