① IKE Phase 1 + Phase 2 — what actually happens before your packet flows
IPSec uses a two-phase handshake. Phase 1 (IKE SA) establishes a secure control channel between the two endpoints — they authenticate each other and agree on encryption / hashing. Phase 2 (Child SA in IKEv2 / Quick Mode in IKEv1) negotiates the actual data-plane SAs that encrypt user traffic. Phase 1 protects Phase 2; Phase 2 protects your data.
The two-phase split is why "tunnel half-up" is such a common state — Phase 1 succeeds because the IKE peers can negotiate auth and crypto, but Phase 2 fails because the proxy-IDs (the IP networks declared on each side) don't match. The IKE SA shows established; show vpn ipsec-sa shows nothing. Half-up. Frustrating.
Negotiates encryption, hash, DH group, auth method, lifetime. Builds the secure control channel. IKEv1: main mode (6 packets) or aggressive (3); IKEv2: 4 packets total. UDP 500 (or 4500 with NAT-T).
Negotiates ESP encryption + auth for actual user data. Match proxy-IDs (local + remote subnet IDs). Two SAs per tunnel — one each direction. Both peers must agree.
IKEv2 is faster (4 packets), more reliable, supports built-in DPD (Liveness Check), MOBIKE for mobile peers, EAP. Azure REQUIRES IKEv2 for route-based VPN. Default to IKEv2 in 2026; IKEv1 only for legacy peers that don't support it.
Phase 1 default: 8 hrs. Phase 2 default: 1 hr (or volume-based). At ~80–90% of lifetime, the peer triggers a rekey. Mismatched lifetimes → periodic minute-long outages every hour. Match them on both sides.
Watch IKEv2 establish a tunnel — 4 packets, two SAs
▶ IKEv2 Phase 1 + Phase 2 timeline
Press Play. Sneha at Infosys is configuring a new tunnel from PA-3220 (HQ Mumbai) to PA-440 (branch Bengaluru). Watch the IKE conversation.
UDP 500
tunnel.1 · ESP encrypted with Child SA key · sent to branch public IP
Want to fire IKE packets yourself?
The Techclick IPSec Simulator lets you build a PA-side tunnel config, mismatch a setting on purpose, and see exactly which phase fails — without touching prod.
Sneha at Infosys configures IKEv2 between HQ and branch. The IKE SA shows established. show vpn ipsec-sa is empty. Pings across the tunnel fail. What is happening at the protocol level?
② Proxy-ID — the AWS / Azure killer
Palo Alto runs route-based VPN by default: if a packet's destination matches a route pointing to the tunnel interface, encrypt and send. Most third-party peers (Cisco ASA, AWS site-to-site VPN, Azure VNG, SonicWall, Juniper SRX in policy mode) run policy-based VPN: encrypt only packets matching a specific (local-subnet, remote-subnet) pair declared at IKE time. That pair is called the proxy-ID.
When a PA peers with AWS/Azure, the PA silently proposes proxy-ID = (0.0.0.0/0, 0.0.0.0/0) because it's route-based and doesn't care. AWS/Azure rejects this — they want explicit subnet pairs like (10.10.0.0/16, 172.16.0.0/16). Phase 2 fails. IKE SA shows up. No traffic. Welcome to 4 hours of misery if you've never seen this before.
▶ Proxy-ID mismatch — PA ↔ AWS scenario
Rahul at TCS connects on-prem PA to AWS VPN Gateway. Default proxy-ID = any-any. AWS expects specific subnets. Watch where it breaks.
show vpn ike-sa says state=Mature.(10.10.0.0/16, 172.16.0.0/16) (on-prem ↔ VPC). Any-any doesn't match.
cannot find matching phase-2 tunnel for received proxy ID
show vpn ipsec-sa shows nothing. No traffic.clear vpn ike-sa gateway AWS · test vpn ipsec-sa tunnel AWS · Child SA forms · traffic flows
For PA ↔ AWS Site-to-Site VPN, Azure VPN Gateway, GCP Cloud VPN — always set explicit Proxy-IDs matching the exact local-subnet ↔ remote-subnet pairs. One proxy-ID per pair. Don't rely on the default 0.0.0.0/0. Azure additionally requires IKEv2 for route-based VPN. AWS supports both IKEv1 and IKEv2; pick IKEv2 for new builds. The error "cannot find matching phase-2 tunnel for received proxy ID" in PA system logs is the dead giveaway.
Priya at HCL configures a tunnel PA ↔ Azure VPN Gateway for VNets 10.20.0.0/16 ↔ 192.168.50.0/24. She leaves proxy-IDs at the PA default. IKE SA establishes, IPSec-SA is empty. What is the single fix?
③ Route-based vs Policy-based — the architectural choice
Two ways to decide which packets get encrypted:
PA's native mode. A static or dynamic route points to a tunnel interface. Whatever the FIB sends to that tunnel gets encrypted. Scales cleanly — to add a remote subnet, add a route.
Pre-declared subnet pairs (proxy-IDs) decide what gets encrypted. No tunnel interface routing — IKE itself enforces the matching. Cisco ASA crypto-maps, AWS Site-to-Site VPN, Azure work this way.
PA stays route-based; the proxy-ID tab lets you "lie" about being policy-based for the peer's sake. Configure proxy-IDs that match the policy-based peer's expectations, while internally PA still routes via tunnel interface.
Run BGP over the tunnel.1 interface — the remote subnets are learned dynamically, no static-route maintenance, no proxy-ID per subnet (use 0.0.0.0/0 with peers that accept it). Standard for SD-WAN / multi-site.
show vpn ike-sa show vpn ipsec-sa show vpn flow
GwName: Branch-Bengaluru-GW PeerIP: 198.51.100.42 Cookie:f6a3a7c... PeerCookie:8a2f04b... Auth: PSK Hash: sha256 Encr: aes-256-cbc DH: group14 Lifetime: 28800 sec State: Mature
A team needs PA at HQ to peer with a Cisco ASA branch running policy-based VPN. They configure PA in route-based mode with a static route 10.99.0.0/16 → tunnel.5. The ASA side has crypto-map ACL matching 10.10.0.0/16 ↔ 10.99.0.0/16. What MUST be done on the PA side?
④ DPD, NAT-T, Tunnel Monitoring — keeping tunnels healthy
A tunnel that's "up" can still drop traffic if the underlying network breaks. Three tools detect that:
- DPD (Dead Peer Detection) — periodic "R-U-THERE" pings between IKE peers. If silence, declare peer dead, tear down SA, attempt re-establish. Match on both sides; mismatched DPD = reliability problems.
- Tunnel Monitoring — PAN-OS sends ICMP echoes through the tunnel to a configured destination IP. If unreachable, mark tunnel down. Triggers re-keying which in turn re-validates the IKE-SA. This is how DPD actually becomes "persistent" — the next callout explains.
- NAT-T (NAT Traversal) — encapsulates ESP inside UDP 4500 so it can survive NAT devices in the path. Auto-detected during IKE; if either peer is behind NAT, both switch from UDP 500 → UDP 4500 mid-handshake.
Palo Alto's DPD is documented as "not persistent": it only triggers on a Phase-2 rekey event. If your Phase-2 lifetime is 1 hour, DPD only checks the peer once an hour. In between, the peer can die silently and the tunnel will look "up" until next rekey. Fix: enable Tunnel Monitoring on the tunnel interface with a sensible monitor IP and short interval. Tunnel Monitoring failure forces a re-key, which in turn fires DPD — so the combination of Tunnel Monitor + DPD produces the "always-on" liveness behaviour everyone assumes DPD alone provides.
A tunnel comes up fine when both peers are on public IPs. After a site move, one peer ends up behind a NAT router and the tunnel fails to establish. IKE_SA_INIT requests are seen on tcpdump but no responses. What's the fix?
⑤ The 3 commands you'll actually run when a tunnel breaks
show vpn ike-sa gateway <gw-name> show vpn ipsec-sa tunnel <tunnel-name>
show vpn flow show vpn flow tunnel-id <n>
Encap bytes: 1,234,567 ← my side is encrypting and sending Decap bytes: 0 ← peer side is silent / NAT/firewall is dropping ESP
clear vpn ike-sa gateway <gw-name> test vpn ipsec-sa tunnel <tunnel-name>
(1) show vpn ike-sa — Phase 1 state? If Mature → Phase 1 OK. (2) show vpn ipsec-sa — Child SA(s) present? If empty → proxy-ID or Phase-2 crypto issue. (3) show vpn flow — Encap > 0 but Decap = 0 → ESP being dropped upstream; check NAT-T + intermediate firewalls allowing UDP 4500 / ESP. Decap > 0 but Encap = 0 → local routing isn't sending traffic to the tunnel; check static route → tunnel.X exists. Solves 90% of "tunnel down" tickets in under a minute.
🤖 Ask the AI Tutor
Tap any question — instant context-aware answer.
Pre-curated from PAN-OS docs + LIVECommunity TAC threads + AWS/Azure IPSec interop docs.
📝 Wrap-up — six more
You've already answered 4 inline. Six left. 70% (7 of 10) total marks the lesson complete.
📚 Sources
- Palo Alto Docs — Set Up IPSec Site-to-Site VPN (PAN-OS 11.x). docs.paloaltonetworks.com
- Palo Alto KB — How to Troubleshoot IPSec VPN connectivity issues. knowledgebase.paloaltonetworks.com
- LIVECommunity — IPSec and PROXY ID. live.paloaltonetworks.com/t5/general-topics/td-p/558227
- LIVECommunity — cannot find matching phase-2 tunnel for received proxy ID. td-p/530545
- LIVECommunity — The DPD is "not persistent" and is only triggered by a Phase 2 rekey. td-p/259864
- Microsoft Q&A — IPsec Tunnel from On-Prem Palo Alto to Azure VPN Gateway — Tunnel Up but No Traffic Flow. learn.microsoft.com/answers/questions/2282868
- AWS re:Post — Troubleshoot Site-to-Site VPN IPsec/Phase 2 failure. repost.aws/knowledge-center/vpn-tunnel-phase-2-ipsec
- Techclick — What is Dead Peer Detection & Tunnel Monitoring across IPSec Tunnel. techclick.in
What's next?
Next up: GlobalProtect End-to-End — Portal vs Gateway roles, internal vs external GP, HIP profile + HIP match, SAML SSO, certificate-based auth, split-tunnel design. The client-side VPN every enterprise rolled out during 2020 lockdown and still runs today.