pfSense HA: connections dropping on node switch
-
Initial situation
-
HA pair on pfSense 2.9.0:
- Primary
roadrunner: InteligcNICs - Secondary
coyote: InteligbNICs - Sync interface
em0on both nodes (192.168.7.0/24)
- Primary
-
Interfaces:
Interface Primary Secondary CARP VIP Gateway VDSL igc0 igb0 192.168.9.5 192.168.9.254 CABLE igc1 igb1 192.168.8.5 192.168.8.254 LAN igc2 igb2 192.168.1.1 - -
Gateway group
FailoverVDSLCable. VPN destinations are
policy-routed via VDSL by a LAN rule using an alias. -
Symptom: outgoing VPN tunnels (Telekom VPN client, IPsec NAT-T on
UDP 4500; OpenVPN client) drop whenever CARP switches between the
nodes, in either direction.
10 seconds.
What we tried
1. Outbound NAT to the CARP VIPs
- Outbound NAT was in Hybrid mode with automatic rules only. These
translate to the node's own interface address (e.g. 192.168.8.2),
which does not move with CARP. - Added manual mappings for
LAN subnets(192.168.1.0/24 and
192.168.129.0/24) on CABLE -> 192.168.8.5 and VDSL -> 192.168.9.5. - Verified with
pfctl -sn. Old states were killed (pfctl -k) so
that connections rebuilt with the new translation. - Result: translation correct, tunnel still drops on failover.
2. State synchronization (pfsync)
- The client's states differed completely between the nodes: 46 on
the primary, 16 on the secondary, none identical. ifconfig pfsync0:syncdev em0, peers correct,syncok: 1.netstat -s -p pfsync: packets are exchanged without
bad-interface or HMAC errors, but most states are rejected on
import ("failed state lookup/inserts": ~36,500 of ~41,000 on the
secondary, ~15,100 of ~18,200 on the primary).- Cause: State Policy was "Interface Bound States". States are bound
to the driver name (igc1), which does not exist on the secondary
(igb1), so the states are skipped. Netgate documents this for HA
nodes with different hardware.
3. Floating States (tested and reverted)
- With "Floating States" the WAN state showed interface
all, but it
still did not arrive on the secondary. - Analysis of FreeBSD
if_pfsync.c(pfsync_state_import):- Floating states are allowed to have an unknown original
interface. - States carrying
route-to/reply-toalso transfer the routing
interface (rt_ifname). If it is unknown on the receiver, the
state is skipped regardless of the state policy.
- Floating states are allowed to have an unknown original
- pfSense creates automatic rules ("let out anything from firewall
host itself") withroute-to (igc1 192.168.8.254)for traffic
sourced from the CARP VIPs. After the NAT change this covers all
WAN states. - Conclusion: Floating States don't help in this multi-WAN setup.
Reverted to Interface Bound.
4. Gateway monitoring killing states
- Log entry after saving System > Advanced:
[Gateway Monitoring] killed policy routing states for tier 5 in FailoverVDSLCable - "Don't kill policy routing states for lower-priority gateways" was
unchecked, so any gateway recovery in the group killed the
policy-routed VPN states, independent of CARP.
Final state
- Outbound NAT mappings to the CARP VIPs kept. Comment:
"consistent source IP across HA nodes". This is a prerequisite if
state sync is fixed later. - State Policy: Interface Bound States, on both nodes.
- System > Advanced > Miscellaneous: "Don't kill policy routing
states for lower-priority gateways" enabled, on both nodes. - Note: System > Advanced settings are not synced via XMLRPC, so they
must be changed on both nodes.
Questions
- Is it really correct, that state sync cannot work while the nodes have
different interface names, so existing connections drop on every node
switch? - Would it help, to create single-member LAGGs (protocol FAILOVER) in
the same order on both nodes, so the interface names match on both
nodes? - Are there easier solutions, supposed identical hardware is not
possible at the moment?
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginPrivacy Policy · Cookie Policy