I currently have two pfsense boxes with a standard carp setup as per the docs, it works great.
Two part question here:
- how does anything even work? My experience when accidentally having two ips on the same network has not been pleasant. So how does having a carp ip and a physical ip manage to coexist so harmoniously?
which feeds into the real question
- should the pfsense boxes only have carp addresses for
wan
&lan
and all communication/routing/whatever happen over the realsync
ip address and nic?
ie: I'm proposing that the wan
and lan
do not have ips, only the sync
nic has an ip, there will be a carp wan ip and carp lan ip
How does it even work
carp is a protocol, pretty much like VRRP, sharing IPs among several hosts.
If you were to run tcpdump on the interface on which your carp was configured, you would be able to see messages such as:
Carp members would send messages to a multicast address, advertising their presence to each other. Only one member would be elected as a master on a given carp group.
In case of active-active scenarios, you could still have two or more hosts serving the same carp address, assuming pf states are shared (pfsync) among carp members.
Carp addresses would resolve to predictive hardware addresses, based on your carp VHID:
For VHID 1, my carp address would have its mac set to
00:00:5e:00:01:01
, for VHID 200:00:5e:00:01:02
, ... and so on. Hence: regardless which is your carp master, clients in that network would not need to refresh their ARP cache, they would always contact the same hardware address.The reason why having two hosts sharing the same IPs in general is "not pleasant", is because for one: they don't have the same mac. Based on who replied to your last arp request, you can switch from one to the other unexpectedly. Also, both your pfSense share a similar configuration, ensure the same functions in your network. While when mistakenly re-attributing an IP, you usually have two completely different machines.
Should CARP members also have physical IPs
It depends. Most of the time: no. I tend to set one on management or public interfaces, making sure that I can still reach a backup host (eg: monitoring, troubleshooting some connectivity issue, ...), or just setting up pfSync.
With FreeBSD, you may also be using hastd+ctld+ifstated sharing HA LUN devices. Then, I would also setup a physical IP on the main interface, as regardless of who's master, I'ld need hastd to sync my devices.