IKEv2 is widely used for robust VPN connections, but when authentication fails you can waste hours chasing vague errors. This article gives a focused, technical troubleshooting checklist with concrete diagnostics, log‑level commands and practical fixes that apply to common server and client stacks (strongSwan, libreswan, Windows, macOS/iOS, Android). Targeted at site owners, system administrators and developers, the material helps you quickly isolate whether the problem is policy/proposal mismatch, credential issues, certificate problems, NAT interactions or server/client configuration mismatches.

Understanding the two authentication layers

IKEv2 authentication involves two distinct layers that you must check independently:

  • IKE phase 1 (IKE_SA_INIT + IKE_AUTH): negotiates crypto proposals and authenticates the peers (PSK or certificates, or EAP for user auth).
  • IPsec child SAs: define traffic selectors (proxy IDs) and the actual ESP encryption/authentication used for data transport.

Many “authentication” failures are actually failures in proposal negotiation, identity payloads, or child SA setup rather than literal credential verification.

Quick triage checklist (order matters)

  • Check basic network reachability: ports UDP 500 and UDP 4500 (for NAT-T) and ESP protocol (50) if not using NAT-T.
  • Confirm system clocks are synchronized via NTP. Certificates rely on proper time.
  • Inspect server and client logs simultaneously while attempting a connection.
  • Use packet capture to observe IKE exchanges (UDP 500/4500) to see actual payloads and error notifications.

Useful commands

  • On Linux (strongSwan/libreswan): sudo tail -f /var/log/syslog or sudo journalctl -u strongswan -f; sudo ipsec statusall.
  • Packet capture: sudo tcpdump -n -s0 -w ikev2.pcap udp port 500 or udp port 4500 or proto 50.
  • Windows: Event Viewer → Applications and Services Logs → Microsoft → Windows → IKEEXT and use netsh advfirewall monitor show firewall / netsh ikev2 show diagnostics where supported.
  • macOS/iOS: Console app or log stream --predicate 'process == "racoon" or process == "charon"' --info (charon is strongSwan).

Common root causes and targeted fixes

1) Pre-Shared Key (PSK) or identity mismatch

Symptoms: IKE_AUTH fails quickly with “invalid credentials” or “no valid peer found”. Server logs report AUTHENTICATION_FAILED or no shared key.

  • Verify the PSK on server and client exactly match; watch for trailing spaces and encoding issues (UTF‑8 vs. ASCII).
  • Check ID payloads: IKEv2 uses IDi/IDr to match credentials. If server expects a FQDN but the client sends an IP (or vice versa) the PSK lookup fails. For example, on strongSwan you may need rightid=%any or set specific leftid/rightid.
  • Enable verbose logs to see the ID values: strongSwan logs the ID payloads in charon output.

2) Certificate issues (common for enterprise deployments)

Symptoms: Server or client logs show no certificate found, cert_unknown, certificate revoked or certificate is not yet valid / expired.

  • Confirm the entire chain is presented in proper order: leaf first, then intermediate(s), then root (if required). Many clients require the intermediate to be included.
  • Check Subject Alternative Name (SAN) and Common Name (CN): the identity used during IKE (IDr/IDi) must match a SAN or CN of the certificate. Mobile clients typically use the SAN.
  • Validate key usage and extended key usage (EKU): ensure the certificate allows IKEv2 (keyEncipherment/keyAgreement and appropriate EKU, often “Server Authentication”).
  • Check CRL/OCSP path and that the client/server can reach CRL/OCSP endpoints. If OCSP stapling or CRL checks fail, authentication may be refused.
  • Example strongSwan config snippet for certs:
    conn vpn
      left=%any
      leftcert=server-cert.pem
      leftsendcert=always
      right=%any
      rightauth=eap-radius
    

3) Proposal/protocol mismatch (encryption/auth/hash/DH)

Symptoms: Negotiation fails with no acceptable proposals or logs showing no-proposal-chosen.

  • Compare IKE and ESP proposal sets on both sides. Typical proposal components include encryption (AES-GCM, AES-CBC), integrity (SHA256), PRF, and DH group (14/19/20/21 etc.).
  • Be explicit rather than relying on defaults—especially when one side is appliance-based: set proposals to a known common subset.
  • Example strongSwan:
    ike=aes128-sha256-modp2048
    esp=aes128-sha256-modp2048
  • Consider temporarily relaxing proposals to establish a connection then tighten once confirmed.

4) NAT / NAT‑Traversal problems

Symptoms: initial IKE_SA_INIT succeeds but IKE_AUTH or child SA creation fails; client behind NAT sees SRC IP change. Packet captures show UDP 500/4500 being rewritten.

  • Ensure NAT-T is enabled and working (UDP 4500). Many clients switch to NAT-T after detecting NAT. If a firewall blocks 4500 but allows 500, behavior can be inconsistent.
  • Check whether ESP is allowed. If not using NAT-T and ESP is blocked, the SA cannot carry traffic.
  • On servers behind a NAT, configure NAT traversal helpers or proper port forwarding for UDP 4500 and 500.
  • Be aware of double-NAT scenarios where address translation changes IPs during exchanges; use rightsourceip or appropriate NAT rules to accommodate.

5) Mismatched traffic selectors (child SA / proxy ID)

Symptoms: IKE_AUTH succeeds but traffic does not flow; the server logs show no CHILD_SA created or child SA has zero routes.

  • Verify the client and server agree on traffic selectors (local/remote subnets). Some clients send aggressive selectors and expect the server to accept them; servers may be configured to push specific subnets.
  • For road-warrior setups, server should typically accept any remote IP (e.g., right=%any) and assign an address via rightsourceip or use virtual IP pools.
  • Examples: strongSwan uses leftsubnet=0.0.0.0/0 or no leftsubnet to accept client-initiated selectors; ensure the child SA config matches.

6) RADIUS/AAA integration problems (EAP auth)

Symptoms: EAP failure with timeouts or user authentication errors when using EAP‑MSCHAPv2 or EAP‑TLS.

  • Confirm that RADIUS shared secret is correct and consistent on both the IKE server and RADIUS server.
  • Enable RADIUS debug logging (e.g., FreeRADIUS debug mode) to view authentication flow and attribute mapping.
  • Check that EAP methods supported by the client are allowed by the server (e.g., EAP-TLS needs proper client certs).
  • Inspect return attributes like Framed-IP-Address or filter-attrs that the IKE server expects to apply.

7) Certificate chain & OCSP/CRL specifics

When using enterprise PKI, certificate revocation checks are a common silent failure point.

  • Test certificate validation with openssl: openssl verify -CAfile ca-bundle.pem server-cert.pem.
  • Confirm that the server presents intermediates. Tools like openssl s_client can show the chain presented by the server.
  • If using OCSP, check endpoints are reachable and not returning hard failures. Consider allowing OCSP/CRL fetch in firewall rules or disable revocation checking temporarily for diagnosis.

Deep-dive troubleshooting workflow

Follow this ordered procedure for efficient root-cause isolation:

  • Reproduce the failure while capturing logs on both ends.
  • Collect packet capture for IKE exchanges and correlate with server logs—identify the IKEv2 Notify message type (e.g., NO_PROPOSAL_CHOSEN, AUTHENTICATION_FAILED, INVALID_KEM_PARAMETER).
  • If NO_PROPOSAL_CHOSEN, immediately match proposals. If AUTHENTICATION_FAILED, inspect PSK/certs/ID payloads.
  • Use openssl for cert checks and tcpdump to confirm whether ESP/UDP traffic is leaving/arriving. If UDP 4500 packets are present but no replies, look at firewall/NAT and IPtables rules.
  • Once fixed, increase logging back to normal to avoid verbose logs in production.

Server/example config tips

strongSwan minimal server example (certificate auth):

conn roadwarrior
  left=%any
  leftcert=server.pem
  leftsendcert=always
  leftsubnet=0.0.0.0/0
  right=%any
  rightsourceip=10.10.10.0/24
  ike=aes256-sha256-modp2048
  esp=aes256-sha256
  keyexchange=ikev2
  auto=add

Windows client notes:

  • Check that the client Certificate Store contains the needed CA. For cert auth, the client must select the correct certificate in the Windows VPN settings.
  • Use Event Viewer IKEEXT logs and enable provider diagnostics for more detail.

When to escalate

  • If logs show unexpected Notify messages with vendor-specific error codes, consult device vendor documentation.
  • If packet captures show sequence number gaps or frequent retransmissions, consider MTU/fragmentation or intermediate devices interfering with UDP/ESP.
  • For intermittent authentication failures, investigate DPD, rekey lifetimes or RADIUS server load/latency that may cause timeouts.

Authentication failures are often resolvable by a systematic check of IDs, credentials, proposals and network traversal. Keeping detailed logs and packet captures while iterating configuration changes will typically reveal the mismatch quickly.

For additional hands-on guides, configuration examples and VPN-focused troubleshooting tools, visit Dedicated-IP-VPN at https://dedicated-ip-vpn.com/.