Overlay Encryption (IPsec)
When to turn on OVN native IPsec for the Spinifex Geneve overlay, what it costs in throughput and CPU, and the four steps to disable it on a running cluster.
Overview
IPsec is off by default for a new install. Pass spx admin init --ipsec=true (or install-node.sh --ipsec on) and Spinifex encrypts the Geneve overlay with OVN native IPsec — ESP transport mode, rfc4106(gcm(aes)) 128, authenticated with each node's certificate under the cluster CA. Every packet between two instances on different hosts is then encrypted on the wire. An existing cluster keeps the setting it was installed with.
Turn it on wherever the fabric between nodes is not yours alone: a shared switch, more than one site, or a provider network. There, east-west guest traffic crosses a physical fabric that the VPC abstraction otherwise asks you to trust implicitly, which is the AWS trust model. Off is the default because most installs are one rack on a fabric the operator owns, where IPsec is the single largest performance cost in the stack.
Instructions
When disabling is appropriate
Only where the underlay between nodes is physically trusted end to end:
| Topology | Reasonable to disable? |
|---|---|
| Single rack, dedicated top-of-rack switch, no other tenants | Yes |
| One datacenter, private VLAN, switch ports under your control | Yes |
| Nodes sharing a switch with equipment you do not administer | No |
| Any leg of the overlay crossing a shared or provider network | No |
| Nodes in different datacenters, or over a WAN or VPN of any kind | No |
The trade is explicit and it is not partial: with IPsec off, all east-west guest traffic is in plaintext on the wire, including traffic between instances belonging to different tenants. Anything with access to a span port, a mirrored uplink or the switch itself reads it. Tenant isolation still holds in the datapath — security groups and per-VPC routing are unchanged — but confidentiality against a fabric-level observer is gone.
Note that this setting governs the overlay only. It has no effect on TLS terminated inside a guest, on the API endpoint, or on north-south traffic through the Internet Gateway.
What it costs
Measured on the reference cluster: 4 nodes, AMD EPYC 7513 (128 threads), Mellanox ConnectX-5 (MT27800, firmware 16.35.8002) on a 100 GbE fabric, t3.xlarge guests (4 vCPU), Ubuntu 26.04, kernel 6.12. Three client guests running iperf at 4 streams for 60s into one server guest, over their private addresses.
| IPsec on | IPsec off (default) | ||
|---|---|---|---|
| aggregate into one guest | 3.17 Gbit/s | 21.82 Gbit/s | 6.9x |
| per client, mean | 1.06 Gbit/s | 7.27 Gbit/s | |
| guest MTU | 1408 | 1442 | applied automatically |
| NIC queue pairs | 1 | 4 | historical: now one per vCPU in both cases |
| busiest receive core | 97.4% busy, 71.8% softirq | under 15%, spread over 16 cores |
Disk throughput is unaffected in either direction — Predastore and Viperblock traffic does not ride the VPC overlay.
The cost is not raw crypto throughput, it is CPU scaling. ESP wraps each Geneve packet in an outer IP header with protocol 50, which has no L4 ports, so a NIC's receive-side scaling can only hash on source and destination IP. All traffic between a given pair of nodes therefore lands in one RSS bucket and is processed by one core, regardless of how many flows or streams it carries. Without ESP the outer header is UDP 6081 and OVN varies the source port per inner flow, which spreads the work across every core.
ConnectX-5 cannot offload this. ASAP² handles OVS flow offload, but IPsec inline crypto requires ConnectX-6 Dx or BlueField. Adding cores or streams does not help either; throughput with IPsec on is flat in stream count because everything funnels through the same core.
The MTU row above is not a separate knob. It follows ipsec_enabled on its own, because the ESP header consumes 34 bytes of the path budget. Turning IPsec off is the whole change.
The queue-pair row was measured when multiqueue also followed ipsec_enabled. It no longer does: every guest NIC now has one queue pair per vCPU, up to 8, whether IPsec is on or off, as ENA sizes its queues by instance. Load balancer and worker VMs stay at one.
Disabling it
Four steps, and all four are required. The daemon owns step 2 but not step 3.
1. Set the config on every node. In /etc/spinifex/spinifex.toml:
[network]
ipsec_enabled = false
A cluster where the nodes disagree is a cluster where some tunnels are encrypted and some are not, so change it everywhere before restarting anything.
2. Restart the daemon on every node.
systemctl restart spinifex-daemon
This stops openvswitch-ipsec and tears down the SAs. Confirm on every node — both must be 0:
ip xfrm state | grep -c '^src'
ip xfrm policy | grep -c '^src'
3. Clear the OVS flag by hand on every node. The daemon sets NB_Global.ipsec to false when IPsec is off, but it never clears other_config:ipsec_encapsulation, which it previously set on each node. That key is left reading true — inert, because nothing is left to act on it, but it makes the node disagree with the config and misleads the next person to inspect it.
# On every node:
ovs-vsctl remove Open_vSwitch . other_config ipsec_encapsulation
Leave ca_cert, certificate and private_key in other_config alone. They are inert without an IPsec daemon, and keeping them means re-enabling is a config change rather than a re-enrolment.
This step is manual today. It should move into the reconciler so that disabling converges the same way enabling does.
4. Verify.
# Use the NB raft endpoints. The local unix socket fails with
# "database connection failed" on a clustered deployment.
NBDB='tcp:10.2.0.2:6641,tcp:10.2.0.3:6641,tcp:10.2.0.4:6641'
ovn-nbctl --db="$NBDB" get NB_Global . ipsec # false
ovs-vsctl get Open_vSwitch . other_config # no ipsec_encapsulation key
systemctl is-active openvswitch-ipsec # inactive
ip xfrm policy | grep -c '^src' # 0
Restart guests after changing this in either direction
The guest MTU moves with the setting, but a running guest holds its DHCP lease for up to an hour and its device-level host_mtu until it is stopped and started. Going from off to on narrows the path from 1442 to 1408 while the guest still believes 1442, which blackholes large segments until it restarts.
Expect launches to fail for a minute or two after re-enabling. RunInstances returns ServerInternal with vpc.add-nat timing out, because the OVN flows-ready barrier cannot confirm while ovn-controller reprograms every tunnel for the new SAs. It clears once ip xfrm state settles. The error is reported as a capacity problem, which it is not.
Containers and nested overlays inside a guest
A Docker bridge, Kubernetes pod network or other overlay inside a guest defaults to an MTU of 1500, which is larger than the guest's 1408 or 1442. Downloads from the internet still work for TCP on the veth and routed uplinks, because vpcd clamps the TCP MSS on the host hop. That was measured on a single node (env12) with a Docker container; it was not measured on a physical uplink or on a multi-node cluster.
On a physical uplink there is no host hop to clamp, and UDP is never clamped, so set the inner MTU to the guest MTU. For Docker, in /etc/docker/daemon.json:
{
"mtu": 1442,
"default-network-opts": {
"bridge": { "com.docker.network.driver.mtu": "1442" }
}
}
This is for the default, ipsec_enabled = false. Use 1408 on a cluster with IPsec on. Then restart the Docker daemon so the default bridge is recreated. The gateway MTU follows ipsec_enabled and converges on the next reconcile pass, so change the inner MTU together with the guest MTU.
Troubleshooting
- Launches fail with
ServerInternalandvpc.add-nattiming out after you turn IPsec on: wait untilip xfrm statesettles. See Restart guests after changing this. - Large transfers stop after a change: restart the guests so that they get the new MTU.
- Instances cannot reach each other: check the Geneve tunnels.