OPNsense Forum

English Forums => High availability => Topic started by: Noci on December 01, 2026, 09:26:09 AM

Title: [solved] CARP vs. VHID
Post by: Noci on December 01, 2026, 09:26:09 AM
TL;DR;   Read better.

In the documentation ( https://docs.opnsense.org/manual/firewall_vip.html#carp ) is stated.
It is stated that Multiple VIPs on a single interface should share the same VHID.

QuoteWarning

While technically it is possible to assign multiple CARP VIPs on the same interface, but with separate VHIDs, this has no benefit and is not recommended. The CARP traffic and system procedures for failover will increase linearly in noise per virtual IP. Since the primary purpose of CARP is to react to link state changes, a single VHID acting for a single interface is the most efficient way to use the protocol.

The problem is in the interface ANY used VHID is flagged.

Several Questions spring to mind:
@4: Observation is it does not work, that may be because of how a config file is created.  IIRC Keepalived should be able to do that.
Title: Re: CARP vs. VHID
Post by: BoNetTech on December 01, 2026, 10:35:09 AM
Hi Noci,

I'm not an OPNsense developer and I haven't tested this, but the docs seem to cover most of your questions.

The warning you quoted is about several CARP VIPs with *separate* VHIDs on the same interface. The documented way to put more addresses on one interface is different (docs.opnsense.org/manual/firewall_vip.html, section "Combining CARP virtual IP types with IP aliases"): create one CARP VIP with a VHID, then add the extra addresses as IP Alias entries and put the same VHID number in their VHID field. Only that one VHID sends advertisements, so you don't need 3 multicast streams on WAN. The how-to (docs.opnsense.org/manual/how-tos/carp.html, "Adding multiple CARP IPs") says the same.

Two notes from the how-to: IP aliases are not synchronised by the config sync, so you need to add them on the backup as well, and adding an alias with a VHID to an already active CARP setup can cause split-brain, so it describes doing it with CARP disabled on one node.

About "the VHID is flagged": I don't see anything in the docs about that. Could you post the exact message and where it appears (the GUI field, the log)?

About using the inter-router HA VLAN for the CARP traffic: I couldn't find anything in the docs saying this is possible. CARP is configured per interface and each interface has to receive CARP packets. The "Peer" field only changes the destination address (multicast or unicast), not the interface.

Sergio
Title: Re: CARP vs. VHID
Post by: Noci on December 01, 2026, 10:47:12 AM
On interface WAN:

Select a VHID used by another VIP:   254

QuoteVHID 254 is already in use on the interface wan
Pick a unique number on this interface.

So clearly there is a difference between documenten behaviour and effective behaviour.
See attached image.
Title: Re: CARP vs. VHID
Post by: BoNetTech on December 01, 2026, 11:08:53 AM
Hi Noci,

thanks for the screenshot. That message looks like what you get when the new entry has Mode = CARP: a CARP VIP needs a unique VHID on its interface, which matches the docs' warning about separate VHIDs.

The docs' way for extra addresses is Mode = "IP Alias" instead (firewall_vip.html, "Combining CARP virtual IP types with IP aliases"): keep the one CARP VIP with VHID 254, add the other addresses as IP Alias entries and enter VHID 254 in the VHID field of the alias.

I can't see the Mode field in your screenshot, so I'm not sure that's what happened, and I haven't tested it. If the IP Alias form doesn't offer a VHID field, could you post a screenshot of that form (with the Mode visible)?

Sergio
Title: Re: CARP vs. VHID
Post by: Noci on December 01, 2026, 12:23:49 PM
Thanks...,

I mistook the IP Alias as another CARP... to be added to the interface.
That seems to work.

Thanks.