Setting up secure branch office connectivity or site-to-site tunneling requires precise parameter alignment on your firewall. A single mismatch in phase 1 or phase 2 parameters will break the cryptographic handshake and leave your tunnel down.
This guide walks through configuring an Palo Alto IPSec VPN connection on PAN-OS firewalls, covering cryptographic profiles, tunnel interfaces, and troubleshooting common phase failures. Whether you're connecting a remote branch office or establishing a secure link to a cloud provider, precise configuration prevents costly downtime.
Understanding the IPsec Tunnel Architecture
Before touching the CLI or web interface, you need to map out the two core components of a Palo Alto IPsec deployment: the IKE Gateway (Phase 1) and the IPsec Tunnel (Phase 2).
Phase 1 establishes a secure, authenticated channel between two peers using Internet Key Exchange (IKEv1 or IKEv2). Once this secure channel is active, Phase 2 negotiates the actual security associations (SAs) that protect the data flowing across the tunnel.
To set this up successfully, gather your networking parameters ahead of time:
- Public IP address of the local firewall interface
- Public IP address of the peer gateway
- Pre-shared key (PSK) or certificate for authentication
- Exact encryption, integrity, and Diffie-Hellman (DH) group settings agreed upon with the peer administrator
Step 1: Configure Crypto Profiles
Crypto profiles define the encryption algorithms, hashing methods, and key exchange groups your firewall will accept.
- Navigate to Network > Network Profiles > IKE Crypto and click Add.
- Name your profile. Select IKEv2 (preferred for faster re-keying and built-in NAT traversal) or IKEv1 depending on your peer's requirements.
- Choose your encryption algorithms (such as AES-256-GCM or AES-256-CBC) and authentication hashes (like SHA-256).
- Select the appropriate DH Group (such as Group 14 or 20). Both peers must match exactly.
- Go to Network > Network Profiles > IPsec Crypto and click Add to create the Phase 2 profile, selecting matching encryption and auth algorithms.
Step 2: Set Up the IKE Gateway
The IKE Gateway configuration defines how the local firewall communicates with the remote peer's public IP address.
- Go to Network > Network Profiles > IKE Gateways and click Add.
- Select the correct Interface on your firewall that faces the public internet and enter the peer's public IP address under Peer IP Type.
- Under Authentication, select Pre-Shared Key and enter a strong, complex string. Ensure both ends use the exact same key.
- In the Advanced Options tab, select the IKE Crypto Profile you created in Step 1. Enable NAT Traversal if either firewall sits behind a consumer or corporate NAT device.
Step 3: Create the Tunnel Interface
IPsec tunnels require a logical interface on the Palo Alto firewall to route traffic into the encrypted tunnel.
- Go to Network > Interfaces > Tunnel and click Add.
- Assign an unused tunnel interface number (e.g.,
tunnel.1). - Assign the interface to your default virtual router and assign it to the appropriate security zone (such as a dedicated
vpn-zone). Don't assign an IP address here unless your routing setup requires a point-to-point tunnel IP.
Step 4: Configure the IPsec Tunnel
Now tie your IKE gateway, tunnel interface, and Phase 2 crypto profiles together.
- Go to Network > IPsec Tunnels and click Add.
- Select your tunnel interface (
tunnel.1) and the IKE Gateway you created in Step 2. - In the IPsec Crypto tab, select your Phase 2 profile.
- Define your proxy IDs or let your static/dynamic routing handle traffic selection. If you're using policy-based routing, specify the local and remote subnet selectors accurately.
Step 5: Add Security Policies and Routing
Without explicit security rules and routing entries, traffic will drop even if the cryptographic tunnel turns green.
- Create a static route pointing your remote branch subnet toward
tunnel.1. - Go to Policies > Security and add a rule allowing traffic from your internal trust zone to your
vpn-zone(and vice versa) for the required applications or ports. - Commit your configuration changes and monitor the status under Network > IPsec Tunnels.
Common Configuration Pitfalls
Even experienced engineers run into silent drop conditions during deployment. Keep these troubleshooting points in mind:
- Phase 1 Mismatch: If your logs show
IKE phase-1 negotiation failed, check your pre-shared key, DH group, and encryption algorithms. A single character difference in the PSK breaks authentication instantly. - MTU and Fragmentation: VPN headers add overhead to packets. If users can connect but large file transfers hang or drop randomly, adjust your TCP MSS clamping or lower the interface MTU to 1350 or 1400 bytes.
- Security Policy Blocks: Palo Alto firewalls default to dropping traffic unless explicitly permitted. Always verify that your security policies reference the correct source and destination zones, not just the IP addresses.
Frequently Asked Questions
Should I use IKEv1 or IKEv2 for my IPsec tunnel?
Use IKEv2 whenever possible. It provides faster tunnel setup times, better handling of re-keying, built-in NAT traversal, and improved reliability over unstable internet connections. Use IKEv1 only if you are connecting to a legacy third-party device that doesn't support IKEv2.
Why is my IPsec tunnel showing green in the GUI but passing no traffic?
This typically points to missing security policies or incorrect routing. Even when the cryptographic tunnel is fully established, the firewall will drop packets unless you have a security policy permitting traffic between the zones and a static route directing traffic into the tunnel interface.
How do I troubleshoot phase 2 negotiation failures?
Run the command tail follow yes log ikemgr via the CLI to watch the real-time cryptographic handshake. Look for specific error codes regarding proxy ID mismatches, unsupported encryption transforms, or dead peer detection (DPD) timeouts.
Can I run dynamic routing protocols like OSPF over a Palo Alto IPsec tunnel?
Yes. You can run OSPF or BGP over your IPsec tunnel by assigning IP addresses to both ends of the tunnel interface and establishing a tunnel monitor or GRE encapsulation if multicast routing support is required by your routing daemon.