An Azure network security service that is used to protect Azure Virtual Network resources.
Hi @Dan Oprita
Nice logs, they tell a fairly clear story. 0x363A means Azure already holds the maximum number of Phase 1 (main mode) SAs it allows for your peer IP, so it refuses the new one created by the rekey. The "message ID 755, expected 756" on the strongSwan side shows the two ends have drifted out of sync on the existing IKE SA. Put together, it usually means stale or duplicate IKE SAs are building up for the same peer, rather than a crypto mismatch.
With a CARP HA pair, the most common source is the backup node also holding or creating IKE state. Here's what I'd check and change:
- Make sure IPsec only runs on the CARP master. The tunnel should bind to the CARP VIP, and the backup node shouldn't initiate or keep its own SAs. Also check whether IKE state is synced on failover.
- Align Phase 1 lifetimes with Azure's default of 28,800 seconds for IKE SAs. Keep your on-premises side as the only initiator (Azure is already ResponderOnly), with a reasonable rekey margin so the old SA closes cleanly.
- If you want both sides pinned to the same values, set a custom IPsec/IKE policy on the Azure connection that matches your OPNsense proposals exactly (AES256 / SHA256 / DH14, PFS2048).
- To clear the stale SAs that are already there, reset the connection on the Azure side (Connection > Reset), then restart IPsec on the active firewall only.
- After the next scheduled Phase 1 rekey, check IKEDiagnosticLog again. You should see a single MM SA for the peer, not several.
Does the failure happen even when there hasn't been a CARP failover since the tunnel came up?
If this resolved your issue, please consider accepting it as the answer. If the 0x363A errors continue after the reset and lifetime change, let me know and I'll be happy to keep helping.
Reference: