# Active-active with CARP



## bbaudinet (Jul 22, 2020)

Hello,

I'm looking to use active-active loadbalancing with FreeBSD.
Until FreeBSD 10 this could be done with `CARP` using the `net.inet.carp.arpbalance = 1`. After some researches, it appears that FreeBSD CARP doesn't support the `arpbalance` option anymore. This has been removed 8 years ago in FreeBSD 10 https://www.freebsd.org/releases/10.0R/relnotes.html https://svnweb.freebsd.org/base?view=revision&revision=228571.

Do you know if there is a way to achieve active-active loadbalancing with FreeBSD since it has been removed from CARP?

BR,
Bertrand


----------



## `Orum (Jul 26, 2020)

If you want the equivalent of GLBP, I don't believe that is possible with CARP.  That said, you can get a little creative and work around the issue to a certain extent.

For example, at work I manage 2 FreeBSD routers running pf & CARP.  By setting one router to be a master on only some VLANs, and the other to be master on the rest of the VLANs, I can effectively achieve some load balancing between them.  This does complicate things on the pf side of things though, as you are now in asymmetric routing territory (but you'd be there anyway with GLBP).  You also need to look carefully at how much traffic each VLAN is using (and when) to make the best of this, so make sure you're logging with some NMS.  Finally, if most of your traffic is from a single VLAN, this obviously won't help much unless you can move some hosts to other VLANs.


----------



## Jose (Jul 26, 2020)

I haven't found a solution either, please update this thread if you do. My workaround for a troika of CARP gateways was to write an Ansible script that would iterate through all the hosts and assign them a default gateway using modulo 3. Problem was the hosts would get out of balance over time and the script had to be re-run periodically.


----------



## bbaudinet (Jul 27, 2020)

Thansk for your answers.
Unfortunately your both solution doesn't match my usecase. I'm not using any VLANs and I am not able to perform configuration on host (I could only change settings in CARP gateways).
If there is any clean solutions, I think I will use active-passive only

Thanks for your time, I will keep you updated if I found a solution.


----------

