Stages & error codes

Read the negotiation from the top

Lesson 15 of 20 · 13 min · Module 5: Troubleshooting

A tunnel that is down gives you one useful fact: the stage where the negotiation stopped. Everything before that stage is correct, and everything after it has not been tested yet.

Start this lesson →

Free. No installation: you write and run the code in your browser, and it is checked automatically.

By the end, you’ll be able to…

  • Map each error to the stage and the settings it concerns
  • Fix one failure at a time
  • Avoid changing settings that already work

The idea

Work through a failed tunnel in order. IKE_SA_INIT fails on reachability, IKE version or the IKE proposal. IKE_AUTH fails on the key or the identities. The child SA fails on the IPsec proposal or the selectors. Fix the first failure, run again, and read the next one.

# 1  IKE_SA_INIT  ok
# 2  IKE_AUTH     FAILED  AUTHENTICATION_FAILED
# The peer address and the IKE proposal are right; look at the key and the identities.

01One stage, one short list

Timeout: the peer address, or something in between blocks UDP 500. NO_PROPOSAL_CHOSEN in IKE_SA_INIT: the IKE proposal. AUTHENTICATION_FAILED: the key or an identity. NO_PROPOSAL_CHOSEN in the child SA: the IPsec proposal. TS_UNACCEPTABLE: the selectors.

02Do not touch what passed

If IKE_SA_INIT is ok, the IKE proposal is correct. Changing it "just in case" while you hunt an authentication problem creates a second fault and hides the first.

03The same view on real devices

Look at the IKE SA first, then at the IPsec SA, then turn on debugging for one peer.

# FortiGate
diagnose vpn ike gateway list name to-branch
diagnose vpn tunnel list name to-branch
diagnose vpn ike log filter rem-addr4 198.51.100.2
diagnose debug application ike -1
diagnose debug enable

# Huawei USG
display ike sa
display ipsec sa

# Cisco IOS
show crypto ikev2 sa
show crypto ipsec sa
debug crypto ikev2

Your turn

This tunnel has never worked. It has three mistakes, one at each stage. The agreed key is Rm7-kV2x-Qp94-tLw8-Zc3h and the branch settings are in the panel. Fix them one at a time, running the lab after each, and change nothing that already passes.

What the checks look for

  • IKE_SA_INIT succeeds
  • IKE_AUTH succeeds
  • The child SA is created and the tunnel is stable
  • Only the three mistakes were changed
Try it in the editor →

Take this with you

Find the stage, fix its short list of settings, and test again. A negotiation is debugged from the top, one failure at a time.

Go a little further

After fixing everything, break only the selector and read the log: two stages pass and the third names the selector you proposed.

Learn VPN & IPsec Foundations for free

20 short lessons with real code and instant checks.

See the whole course →