About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.
received AUTHENTICATION_FAILED notify error in a strongSwan log means the other gateway answered the IKE_AUTH exchange with a notification that authentication failed. That message does not say why. The reason is logged on the gateway that rejected you, the responder, so read that gateway's log. With a pre-shared key it names the two identities it compared and says either that no key matched them or that a key matched and the check value did not.
What the error means
IKEv2 authenticates in the second exchange, IKE_AUTH, after the IKE_SA_INIT exchange has agreed algorithms. RFC 7296 defines AUTHENTICATION_FAILED (type 24) as "Sent in the response to an IKE_AUTH message when, for some reason, the authentication failed. There is no associated data." Section 2.21.2 lists the reasons: "invalid shared secret, invalid ID, untrusted certificate issuer, revoked or expired certificate, etc." and says that "If the error occurred on the responder, the notification is returned in the protected response, and is usually the only payload in that response."
Because the notification carries no detail, the initiator only logs that it received the error. In strongSwan's ike_auth.c, any notify error received in IKE_AUTH is logged as received %N notify error, which prints as received AUTHENTICATION_FAILED notify error.
The responder knows more. In psk_authenticator.c it logs one of two messages when pre-shared key authentication of the peer fails: no shared key found for '%Y' - '%Y' when no configured secret fits the identity pair, and tried %d shared key%s for '%Y' - '%Y', but MAC mismatched when at least one fitted but the authentication data differed. In both, the first identity is the responder's own and the second is the peer's, as the code passes my_id then other_id. The same no shared key found text is also logged by a gateway that is building its own authentication data, when it cannot find a key to sign with. On the initiator, a reading of ike_auth.c at tag 6.1.0 shows the attempt fails locally and no AUTHENTICATION_FAILED notification is sent. On the responder, the same message is followed by an AUTHENTICATION_FAILED notification, so the gateway that logs it is the one with the missing key.
Two settings decide whether a secret fits. The auth keyword in the local and remote sections selects the method, and the manual says psk "uses pre-shared key authentication". The id keyword is the "IKE identity to use for authentication round"; the manual's text goes on to describe certificate identities and does not state what identity is used for a pre-shared key when none is set, so the identities to compare are the ones the responder's log prints. For the remote side id defaults to %any. In the secrets section, each ike block has a secret and one or more id entries, and a comment in the manual's example says a secret may be used as long as one of its identities matches the local or remote identity. An ike block with no id is "used for any identity if there is no better match".
Likely causes
| Cause | What you see | How to confirm |
|---|---|---|
| The two secrets differ (typo, extra space, wrong quoting) | Responder logs tried 1 shared key for 'A' - 'B', but MAC mismatched |
The responder log shows the MAC message; compare both secrets in a private session |
| No secret is bound to the identity pair in use | Responder logs no shared key found for 'A' - 'B' |
The id entries of the secrets block do not include either identity printed in the message |
A secret begins with 0x or 0s |
Same MAC mismatch even though the text looks identical | The manual says a secret may be "a hex encoded string if it has a 0x prefix or a Base64 encoded string if it has a 0s prefix" |
| The peer sends a different identity than the one expected | The identities in the log are not the ones you configured | The identities printed differ from id in the local and remote sections |
| Edited secret was never loaded | One end still uses the old secret | The swanctl.conf change is newer than the last reload |
| One end uses certificates or EAP | Different authentication methods on the two ends | The authentication lines of swanctl --list-conns differ between the ends, or the RFC's certificate reasons apply |
Prove the cause before changing anything
1. Read both gateways' logs for the same attempt. The swanctl manual says swanctl --log "traces logging output from the charon daemon via the vici interface", but only "levels 0 and 1". In the source, both responder messages above are written at debug level 1, one of the two levels swanctl --log receives. Run it on the responder:
swanctl --log
Then let the peer retry. If you do not want to wait, use the next step. If your system uses charon-systemd, the logging page says it "logs to the systemd journal by default, not to syslog", so read the journal rather than a syslog file.
2. Trigger one attempt from the initiator. This starts a negotiation, so it follows the full sequence.
First save the list of current tunnels on the initiator:
swanctl --list-sas > /root/sas-before.2026-12-01.txt
Risk: the next command starts an IKE negotiation for one connection. If authentication is correct this time, the tunnel comes up and traffic starts to flow through it; if not, the attempt fails and is logged on both gateways.
Initiate the connection by its name from swanctl.conf; the example uses fw02-site. The manual's synopsis is swanctl --initiate [--child <name>] [--ike <name>] [--timeout <s>]:
swanctl --initiate --ike fw02-site
To undo it: first print the saved list:
cat /root/sas-before.2026-12-01.txt
Disruptive step: the next command ends the named IKE_SA, which drops live traffic if the connection was already up. Run it only if the saved file does not list fw02-site.
The swanctl --terminate page documents --ike <name>. Terminate the connection you started:
swanctl --terminate --ike fw02-site
3. Compare the loaded configuration on both ends. The manual says --list-conns "lists loaded connection configurations".
swanctl --list-conns
Compare the authentication lines and the identities of the local and remote entries on the two ends. They must be mirror images.
4. Compare the secrets, in a private session. Read the secrets section of /etc/swanctl/swanctl.conf on both gateways (the manual says the configuration directory is usually /etc/swanctl). Check that each side's id entries include the identities printed in the responder's log, that the secrets are character-for-character the same, and whether either starts with 0x or 0s.
Fix
The repair changes the secret or the identity on one end only, then reloads the configuration and tests. A secret lives in the credentials, but the auth lines and the id entries of the local and remote sections are connection configuration, so the reload must cover both.
First save the current file on the gateway you are about to edit:
cp -p /etc/swanctl/swanctl.conf /etc/swanctl/swanctl.conf.2026-12-01
Disruptive step: the next edit and the reload that follows change what this gateway uses to authenticate. A wrong value stops this tunnel, and any other tunnel that shares the secret, from authenticating again. Do it in a window where a short outage on this link is acceptable.
Edit the secrets block or the id entries so both ends agree. The manual's example shows the form:
secrets {
ike-fw01-fw02 {
id-a = fw01.example.com
id-b = fw02.example.com
secret = "replace-with-the-agreed-secret"
}
}
Use the same secret text on both gateways and the same identities. Avoid a secret that starts with 0x or 0s unless you mean it as hex or base64. Then reload. The swanctl page describes --load-creds as "(re-)load credentials", --load-conns as "(re-)load connection configuration" and --load-all as "(re-)load credentials, pools authorities and connections". A changed secret needs --load-creds; a changed auth line or id entry needs --load-conns; --load-all covers both, so the steps here use it:
swanctl --load-all
Repeat step 2 of the checks, including its save step and its Risk paragraph, because it starts a negotiation again. If the connection comes up, swanctl --list-sas shows it.
To undo it: restore the saved file under its original name and reload everything again. The --load-creds page says only that it "loads or reloads credentials" and does not say whether a changed secret replaces the previous one, so after the restore repeat the check in the responder's log.
cp -p /etc/swanctl/swanctl.conf.2026-12-01 /etc/swanctl/swanctl.conf
swanctl --load-all
swanctl --list-sas
If the two ends use different methods, the same save, Disruptive step, edit and undo sequence above applies to the auth lines of the connection on the end you change, and it needs swanctl --load-conns or swanctl --load-all to take effect, because --load-creds does not load connection changes. Certificate problems are a separate repair covered in VPN recovery: the tunnel configuration is not the private key.
Example (illustrative): fw01 (203.0.113.10) initiates to fw02 (198.51.100.20). fw01 logs received AUTHENTICATION_FAILED notify error. On fw02, swanctl --log shows tried 1 shared key for 'fw02.example.com' - 'fw01.example.com', but MAC mismatched. A key was found for that identity pair, so the identities match and the secret differs. Comparing the two secrets blocks in a private session shows one secret has a trailing character the other lacks. The engineer saves swanctl.conf on fw01, corrects the secret, runs swanctl --load-all, initiates again, and swanctl --list-sas lists the connection.
Confirm the fix
swanctl --list-sason either gateway lists the IKE_SA as established.- The responder's log no longer prints the MAC or
no shared keymessage for this pair. - Traffic across the tunnel works. If the tunnel is up but nothing passes, that is a different fault; see IPsec VPN Tunnel Up but No Traffic: Read-Only Diagnosis.
What to watch afterwards
- When a secret is changed on one gateway, change and load it on the other in the same window.
- Keep the identities and secrets of every tunnel in one record, so a rebuilt gateway gets the same values.
- After a gateway is rebuilt or its address changes, check the identities it sends.
Read next
Related articles you may want next.
- TroubleshootingIPsec tunnel never comes up: NO_PROPOSAL_CHOSEN in IKE_SA_INIT, so no IKE SA at allIPsec tunnel never forms and the log says NO_PROPOSAL_CHOSEN in IKE_SA_INIT. Compare received and configured proposals in strongSwan and FortiGate.Read article
- Backup & RecoveryVPN recovery: the tunnel configuration is not the private keyWhich strongSwan swanctl directories hold keys, certificates and CRLs, and why a restored swanctl.conf without them does not bring the tunnel back.Read article
- TroubleshootingIPsec VPN Tunnel Up but No Traffic: Read-Only DiagnosisAn IKEv2 tunnel can be up while no data flows. Check child SAs, selectors, NAT, routing and packet size on both strongSwan gateways before any change.Read article
Risks and limits
- These commands have not been run or lab-tested.
- The log messages are a reading of the strongSwan 6.1.0 source; wording can differ in other releases.
swanctl --logshows only levels 0 and 1. Other log backends are needed for more detail.- The check does not cover EAP, XAuth or the older
ipsec.confandstrokesetup. - Secrets appear in
swanctl.confin readable form; read them only in a private session.
Sources
- swanctl.conf — strongSwan 6.1 documentation, no date shown, accessed 1 December 2026
- swanctl — strongSwan 6.1 documentation, no date shown, accessed 1 December 2026
- swanctl --initiate — strongSwan 6.1 documentation, no date shown, accessed 1 December 2026
- swanctl --load-creds — strongSwan 6.1 documentation, no date shown, accessed 1 December 2026
- swanctl --log — strongSwan 6.1 documentation, no date shown, accessed 1 December 2026
- swanctl --list-conns — strongSwan 6.1 documentation, no date shown, accessed 1 December 2026
- Logger configuration — strongSwan 6.1 documentation, no date shown, accessed 1 December 2026
- ike_auth.c — strongSwan source repository, tag 6.1.0, no date shown, accessed 1 December 2026
- psk_authenticator.c — strongSwan source repository, tag 6.1.0, no date shown, accessed 1 December 2026
- swanctl --terminate — strongSwan 6.1 documentation, no date shown, accessed 1 December 2026
- RFC 7296: Internet Key Exchange Protocol Version 2 (IKEv2) — IETF, October 2014, accessed 1 December 2026
This article was originally published on .