- Palo Alto Networks NGFW·续
- Web UI
- Define IPsec tunnel objects
- Commit Changes
- IPSec Tunnel Verification
- Security Policy
- CLI - Add Security Policy from trust to cloudflare
- Web UI - Add Security Policy from trust to cloudflare
- CLI - Add Security Policy from cloudflare to trust
- Web UI - Add Security Policy from cloudflare to trust
- Policy Based Forwarding
- Troubleshooting
- On this page
Palo Alto Networks NGFW·续
Web UI
- Go to Network > Network Profiles > IPsec Crypto.
- Select Add.
- Name:
ipsec-aes256cbc-sha256-dh20 - IPsec Protocol:
ESP - Encryption:
aes-256-cbc - Authentication:
sha256 - DH Group:
group20 - Lifetime (Hours):
8
Define IPsec tunnel objects
CLI - Define IPsec tunnels
- Tunnel 1
set network tunnel ipsec cf-wan-ipsec-tun-01 auto-key ike-gateway cf-wan-ike-gw-01
set network tunnel ipsec cf-wan-ipsec-tun-01 auto-key ipsec-crypto-profile ipsec-aes256cbc-sha256-dh20
set network tunnel ipsec cf-wan-ipsec-tun-01 tunnel-monitor enable no
set network tunnel ipsec cf-wan-ipsec-tun-01 tunnel-interface tunnel.1
set network tunnel ipsec cf-wan-ipsec-tun-01 anti-replay no
set network tunnel ipsec cf-wan-ipsec-tun-02 auto-key ike-gateway cf-wan-ike-gw-02
set network tunnel ipsec cf-wan-ipsec-tun-02 auto-key ipsec-crypto-profile ipsec-aes256cbc-sha256-dh20
set network tunnel ipsec cf-wan-ipsec-tun-02 tunnel-monitor enable no
set network tunnel ipsec cf-wan-ipsec-tun-02 tunnel-interface tunnel.2
set network tunnel ipsec cf-wan-ipsec-tun-02 anti-replay no
Web UI - Define IPsec Tunnels
- Go to Network > IPsec Tunnels.
- Select Add.
- Name:
cf-wan-ipsec-tun-01 - Tunnel interface:
tunnel.1 - Type:
Auto Key - Address Type:
IPv4 - IKE Gateway:
cf-wan-ike-gw-01 - IPsec Crypto Profile:
ipsec-aes256cbc-sha256-dh20 - Show Advanced Options - check the box.
- Uncheck
Enable Replay Protection. - IPsec Mode:
Tunnel
Repeat steps for tunnel 2
- Go to Network > IPsec Tunnels.
- Select Add.
- Name:
cf-wan-ipsec-tun-02 - Tunnel interface:
tunnel.2 - Type:
Auto Key - Address Type:
IPv4 - IKE Gateway:
cf-wan-ike-gw-02 - IPsec Crypto Profile:
ipsec-aes256cbc-sha256-dh20 - Show Advanced Options - check the box.
- Uncheck
Enable Replay Protection. - IPsec Mode:
Tunnel
Commit Changes
This is a good place to stop and perform a Commit to apply the configuration settings. You should be able to validate that tunnel connectivity is established.
IPSec Tunnel Verification
Web UI - View IPsec Tunnel Status
- Go to Network > IPsec Tunnels.
View the status of the red/green indicators - select Tunnel Info and IKE Info to obtain real-time status indicators.
Web UI - View IPsec Log Details
- Go to Monitor > Logs > System.
- Add the following to the filter/search dialog across the top:
( subtype eq vpn )
This will provide valuable information as to IKE/IPsec Phase 1 and Phase 2 status and error messages.
Security Policy
Palo Alto Networks NGFW automatically permits traffic originating from and destined to the same zone (intra-zone traffic). If you opted to add tunnel.1 and tunnel.2 into a separate Security Zone, you will require explicit firewall rules to allow traffic to flow from trust to cloudflare as well as from cloudflare to trust.
CLI - Add Security Policy from trust to cloudflare
Note
Firewall rules added from the CLI will always be at the very bottom of the rulebase.
Use the move rulebase security rules <RULE_NAME> [after|before|top|bottom] <RULE_NAME - Desired position>
set rulebase security rules trust-to-cloudflare to cloudflare
set rulebase security rules trust-to-cloudflare from trust
set rulebase security rules trust-to-cloudflare source any
set rulebase security rules trust-to-cloudflare destination any
set rulebase security rules trust-to-cloudflare application any
set rulebase security rules trust-to-cloudflare service application-default
set rulebase security rules trust-to-cloudflare action allow
set rulebase security rules trust-to-cloudflare log-start no
set rulebase security rules trust-to-cloudflare log-end yes
set rulebase security rules trust-to-cloudflare rule-type universal
Web UI - Add Security Policy from trust to cloudflare
- Go to Policies > Security.
- Select Add.
- General > Name:
trust-to-cloudflare - Rule Type:
universal (default)orinterzone - Source > Source Zone:
trust - Destination > Destination Zone:
cloudflare - Application >
Any - Service/URL Category >
application-default - Actions > Action setting:
Allow - Log Setting:
Log at Session End
CLI - Add Security Policy from cloudflare to trust
Note
Firewall rules added from the CLI will always be at the very bottom of the rulebase.
Use the move rulebase security rules <RULE_NAME> [after|before|top|bottom] <RULE_NAME - Desired position>
set rulebase security rules cloudflare-to-trust to trust
set rulebase security rules cloudflare-to-trust from cloudflare
set rulebase security rules cloudflare-to-trust source any
set rulebase security rules cloudflare-to-trust destination any
set rulebase security rules cloudflare-to-trust application any
set rulebase security rules cloudflare-to-trust service application-default
set rulebase security rules cloudflare-to-trust action allow
set rulebase security rules cloudflare-to-trust log-start no
set rulebase security rules cloudflare-to-trust log-end yes
set rulebase security rules cloudflare-to-trust rule-type universal
Web UI - Add Security Policy from cloudflare to trust
- Go to Policies > Security.
- Select Add.
- General > Name:
cloudflare-to-trust - Rule Type:
universal (default)orinterzone - Source > Source Zone:
cloudflare - Destination > Destination Zone:
trust - Application >
Any - Service/URL Category >
application-default - Actions > Action setting:
Allow - Log Setting:
Log at Session End
Policy Based Forwarding
Policy Based Forwarding ↗︎ (aka Policy-Based Routing) allows you to apply additional matching criteria to specific traffic flows that will override routes defined within the Virtual Router.
You may only want to direct traffic through Cloudflare WAN if destined for another Cloudflare WAN site, while Internet-bound traffic continues to get forwarded directly through local Internet breakout.
The following example routes ALL traffic from the LAN subnet behind NGFW (192.168.125.0/24) through the Cloudflare WAN IPsec tunnels. This lets you use the Cloudflare Secure Web Gateway functionality.
You can route traffic to specific destinations simply by adding subnets to the Destination match criteria.
Ensure any traffic flows processed by Policy Based Forwarding is exempted from NAT policies. Cloudflare Gateway will ensure NAT is applied to Internet bound traffic without the need for policy on local devices.
CLI - Add Policy Based Forwarding Rules
- Tunnel 1
set rulebase pbf rules cf-wan-to-internet-01 action forward nexthop ip-address cf-wan-ipsec-vti-01-remote
set rulebase pbf rules cf-wan-to-internet-01 action forward egress-interface tunnel.1
set rulebase pbf rules cf-wan-to-internet-01 from zone trust
set rulebase pbf rules cf-wan-to-internet-01 enforce-symmetric-return enabled no
set rulebase pbf rules cf-wan-to-internet-01 source lan-net-192-168-125-0--24
set rulebase pbf rules cf-wan-to-internet-01 destination any
set rulebase pbf rules cf-wan-to-internet-01 source-user any
set rulebase pbf rules cf-wan-to-internet-01 application any
set rulebase pbf rules cf-wan-to-internet-01 service any
- Tunnel 2
set rulebase pbf rules cf-wan-to-internet-02 action forward nexthop ip-address cf-wan-ipsec-vti-02-remote
set rulebase pbf rules cf-wan-to-internet-02 action forward egress-interface tunnel.2
set rulebase pbf rules cf-wan-to-internet-02 from zone trust
set rulebase pbf rules cf-wan-to-internet-02 enforce-symmetric-return enabled no
set rulebase pbf rules cf-wan-to-internet-02 source lan-net-192-168-125-0--24
set rulebase pbf rules cf-wan-to-internet-02 destination any
set rulebase pbf rules cf-wan-to-internet-02 source-user any
set rulebase pbf rules cf-wan-to-internet-02 application any
set rulebase pbf rules cf-wan-to-internet-02 service any
Web UI - Add Policy Based Forwarding Rules
-
Tunnel 1:
-
Go to Policies > Policy Based Forwarding.
- Select Add.
- Name:
cf-wan-to-internet-01 - Source Zone:
trust - Source Address:
lan-net-192-168-125-0--24 - Destination/Application/Service - Any/Any/Any
-
Forwarding > Action: Forward, Egress Interface: tunnel.1, Next Hop - IP Address:
cf-wan-ipsec-vti-01-remote -
Tunnel 2:
-
Go to Policies > Policy Based Forwarding.
- Select Add.
- Name:
cf-wan-to-internet-02 - Source Zone:
trust - Source Address:
lan-net-192-168-125-0--24 - Destination/Application/Service - Any/Any/Any
- Forwarding > Action: Forward, Egress Interface: tunnel.2, Next Hop - IP Address:
cf-wan-ipsec-vti-02-remote
Commit changes, then test traffic from a host on the 192.168.125.0/24 subnet to ensure it is forwarded through the Cloudflare WAN IPsec Tunnels.
Note
If you have Cloudflare One configured to perform HTTPS traffic inspection, ensure that you install the Root CA certificate prior to testing connectivity to any HTTPS-based sites, otherwise you will receive untrusted certificate warning messages.
Troubleshooting
Common issues
- Always check IKE Phase 1 & IPsec Phase 2 negotiated successfully - look for "no proposal chosen" in logs
- Verify Pre-Shared-Key and/or Local-Identity values are accurate and assigned to the correct tunnel
- Use ping to determine reachability between the CPE and Cloudflare sides of the VTI
- Tunnel 1: CPE VTI to Cloudflare VTI:
ping source 169.254.250.1 169.254.250.0 - Tunnel 2: CPE VTI to Cloudflare VTI:
ping source 169.254.250.3 169.254.250.2
Quick Reference Guide
Display IKE & IPsec Security Associations
Use show ↗︎ commands to display Phase 1 and Phase 2 security associations:
admin@panfw01> show vpn ike-sa
IKEv2 SAs
Gateway ID Peer-Address Gateway Name Role SN Algorithm Established Expiration Xt Child ST
---------- ------------ ------------ ---- -- --------- ----------- ---------- -- ----- --
1 162.159.135.1 cf-wan-ike-gw-01 Init 46 PSK/DH14/A256/SHA256 Mar.22 23:14:24 Mar.23 07:14:24 0 1 Established
2 172.64.135.1 cf-wan-ike-gw-02 Init 45 PSK/DH14/A256/SHA256 Mar.22 23:05:02 Mar.23 07:05:02 0 1 Established
IKEv2 IPSec Child SAs
Gateway Name TnID Tunnel ID Parent Role SPI(in) SPI(out) MsgID ST
------------ ---- ------ -- ------ ---- ------- -------- ----- --
cf-wan-ike-gw-01 1 cf-wan-ipsec-tun-01 452741 97 Init B7D055D3 4CB26B43 00000001 Mature
cf-wan-ike-gw-02 2 cf-wan-ipsec-tun-02 452742 98 Init B4629A07 165D416C 00000001 Mature
Show IKEv2 SA: Total 2 gateways found. 2 ike sa found.
Manually Initiate IKE & IPsec Security Associations
Use test ↗︎ commands to force Phase 1 and Phase 2 security associations:
admin@panfw01> test vpn ike-sa gateway cf-wan-ike-gw-01
Start time: Mar.30 21:23:23
Initiate 1 IKE SA.
admin@panfw01> test vpn ike-sa gateway cf-wan-ike-gw-02
Start time: Mar.30 21:23:24
Initiate 1 IKE SA.
admin@panfw01> test vpn ipsec-sa tunnel cf-wan-ipsec-tun-01
Start time: Mar.30 21:26:50
Initiate 1 IPSec SA for tunnel cf-wan-ipsec-tun-01.
admin@panfw01> test vpn ipsec-sa tunnel cf-wan-ipsec-tun-02
Start time: Mar.30 21:26:52
Initiate 1 IPSec SA for tunnel cf-wan-ipsec-tun-02.
Palo Alto Networks Documentation
Palo Alto Networks Knowledge Base
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/cloudflare-wan/configuration/third-party/palo-alto/#page","headline":"Palo Alto Networks NGFW","description":"Connect Palo Alto Networks NGFW to Cloudflare WAN.","url":"https://developers.cloudflare.com/cloudflare-wan/configuration/third-party/palo-alto/","inLanguage":"en","image":"https://developers.cloudflare.com/cloudflare-wan/configuration/third-party/palo-alto/og.png?v=395e407e91030afe","dateModified":"2026-10-12","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"},"keywords":["IPsec"]}
description: Connect pfSense to Cloudflare WAN. title: pfSense image: https://developers.cloudflare.com/cloudflare-wan/configuration/third-party/pfsense/og.png?v=b6c12b7ed3c97c40
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/cloudflare-wan/llms.txt
Use this file to discover all available pages before exploring further.
Docs