I have got ucarp working on my two ubuntu servers. Apache, Postfix, Dovecot are working in HA mode so if one host goes down the other automatically takes over.

My first problem is that I don't know how can I manually promote the slave to master?

The second is what does ucarp-advskew do? The problem is that I don't know where I could read something more about ucarp. I've only read the guide on how to configure it, but I don't know how to control it, what are the advanced settings.

EDIT: some typos

4 Answers 4


I use keepalived and don't know much about ucarp but I've always just disabled the master interfaces. That forces the slave to take over. If I want to make the slave the master, I reconfigure it and restart the service. I then reconfigure the old master to be slave, restart the service and enable the interfaces.

The following quoted text might help explain what the advskew parameter does.

"advskew: This optional parameter specifies how much to skew the advbase when sending CARP advertisements. By manipulating advskew, the master CARP host can be chosen. The higher the number, the less preferred the host will be when choosing a master. The default is 0. Acceptable values are from 0 to 254." - http://www.openbsd.org/faq/pf/carp.html

"... to work out the time until a CARP node thinks it's the master, calculate 3 * (advbase + (advskew / 255))" - http://kerneltrap.org/node/5607

So if you have three hosts, one master and two slaves and the slaves are configured like this:

slave1 - 3 * 1 + (10 / 255) = 3.117 seconds

slave2 - 3 * 1 + (20 / 255) = 3.235 seconds

Then slave1 will always become master before slave2 since it advertises more often. If for some reason slave1 is down, slave2 will become master.

  • Thank you for the info. Apparently ifup / ifdown works also for ucarp without problems. I've set advskew on the master to 10 and 20 on the slave, so the master is always the first choice. It seems there isn't a lot of documentation for ucarp around.
    – Jure1873
    Aug 8, 2011 at 15:55

My first problem is that I don't know how can I manually promote the slave to master?

You can tell one of the machines to demote itself from MASTER to SLAVE by doing:

    killall -USR2 ucarp

on the MASTER.

  • Thanks, but unfortunately I switched to keepalived in the meantime, but hopefully this will come handy to somebody else reading this.
    – Jure1873
    Feb 1, 2012 at 17:01

I haven't used ucarp on Linux, but in BSD land, it's as simple as bringing down the carp interface on the Primary, and the Backup will promote the carp interface to master.

  • you could follow the path to /scripts/network/ucarp on the master/active server and set it to off
  • this should let the slave take the primary role.


 /opt/... /scripts/network/ucarp off   
  • 1
    Why is that better than the accepted answer?
    – RalfFriedl
    Jul 17, 2019 at 18:01
  • it's consistent. '/opt/... /scripts/network/ucarp on' , will turn it back on.
    – as50075
    Aug 4, 2019 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.