# CARP and the default route



## id (Mar 1, 2013)

I have a server set up with both static IPs and a CARP interface. I want the default route to use the vlan20 interface to get out since when the CARP is in a BACKUP state it is unreachable from any network other than the local subnet.


```
ifconfig_bce1="up"
vlans_bce1="vlan20"

create_args_vlan20="vlan 20"

ipv4_addrs_vlan20="192.168.20.15/24"

defaultrouter="192.168.20.1

cloned_interfaces="carp0"
ifconfig_carp0="inet 192.168.20.20 netmask 255.255.255.0 vhid 1 pass somepass advskew 100"
```

I create the cloned interface after the defaultrouter statement following the advice from the OpenBSD thread below, though I don't think rc.conf is actually parsed in order and started that way on FreeBSD.


```
# netstat -rn
Routing tables
 
Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            192.168.20.1       UGS         0      350  carp0
127.0.0.1          link#10            UH          0       25    lo0
192.168.20.0/24    link#14            U           0        1    db0
192.168.20.15      link#14            UHS         0        0    lo0
```

The route command doesn't seem to have a "-interface" option, so it is not clear how to change the default route to use the correct interface.

I've read http://forums.freebsd.org/showthread.php?t=13426&highlight=carp+default+route but it doesn't answer the question of how to get this to work on FreeBSD.

Any help would be appreciated!
Thanks
-id


----------



## id (Mar 7, 2013)

I fixed it by changing the netmask on the CARP interface to /32


```
ifconfig_carp0="inet 192.168.20.20 netmask 255.255.255.0 vhid 1 pass somepass advskew 100"
```

changed to


```
ifconfig_carp0="inet 192.168.20.20 netmask 255.255.255.255 vhid 1 pass somepass advskew 100"
```


----------

