Palo Alto Networks NGFW
This tutorial includes the steps required to configure IPsec tunnels to connect a Palo Alto Networks Next-Generation Firewall (NGFW) to Cloudflare Magic WAN through a Layer 3 deployment.
- PAN-OS 9.1.14-h4
- Magic WAN: Connecting two or more locations with RFC-1918 ↗ private non-routable address space.
- Magic WAN with Cloudflare Zero Trust (Gateway egress): Same as Magic WAN, with the addition of outbound Internet access from Magic WAN protected sites egressing the Cloudflare edge network.
This tutorial assumes you have a standalone NGFW with two network interfaces:
- One in a trust security zone (
Trust_L3_Zone
) with an RFC-1918 ↗ non-Internet routable IP address (internal network); - And the other in an untrust security zone (
Untrust_L3_Zone
) with a legally routable IP address (Internet facing).
Additionally, there must be a default gateway set on the Virtual Router (default) pointing to the router of your Internet service provider(s).
The following IP addresses are used throughout this tutorial. Any legally routable IP addresses have been replaced with IPv4 Address Blocks Reserved for Documentation (RFC5737 ↗) addresses within the 203.0.113.0/24
subnet.
Description | Address | Address |
---|---|---|
NGFW external interface | 203.0.113.254/24 | |
NGFW internal interface | 10.1.100.254/24 | |
Local trust subnet (LAN) | 10.1.100.0/24 | |
NGFW tunnel interface 01 | 10.252.2.26/31 (Cloudflare side) | 10.252.2.27/31 (NGFW side) |
NGFW tunnel interface 02 | 10.252.2.28/31 (Cloudflare side) | 10.252.2.29/31 (NGFW side) |
Magic WAN anycast IP | 162.159.66.164 | 172.64.242.164 |
Magic WAN health check anycast IP | 172.64.240.253 | 172.64.240.254 |
VLAN0010 - remote Magic WAN site | 10.1.10.0/24 | |
VLAN0020 - remote Magic WAN site | 10.1.20.0/24 |
Use the Cloudflare dashboard or API to configure two IPsec Tunnels. The settings mentioned in Add IPsec tunnels below are used for the IPsec tunnels referenced throughout the remainder of this guide.
These are the target IP addresses for bidirectional tunnel health checks:
172.64.240.253
: Use with the primary IPsec tunnel.172.64.240.254
: Use with the secondary IPsec tunnel.
-
Follow the Add tunnels instructions to create the required IPsec tunnels with the following options:
- Tunnel name:
SFO_IPSEC_TUN01
- Interface address:
10.252.2.96/31
- Customer endpoint:
203.0.113.254
- Cloudflare endpoint:
162.159.66.164
- Health check rate: Low (default value is Medium)
- Health check type: Reply
- Health check target: Custom (default is Default)
- Target address:
172.64.240.253
- Tunnel name:
-
Select Add pre-shared key later > Add tunnels.
-
Repeat the process to create a second IPsec tunnel with the following options:
- Tunnel name:
SFO_IPSEC_TUN02
- Interface address:
10.252.2.98/31
- Customer endpoint:
203.0.113.254
- Cloudflare endpoint:
172.64.242.164
- Health check rate: Low (default value is Medium)
- Health check type: Reply
- Health check target: Custom (default is Default)
- Target address:
172.64.240.254
- Tunnel name:
When you create IPsec tunnels with the option Add pre-shared key later, the Cloudflare dashboard will show you a warning indicator:
- Select Edit to edit the properties of each tunnel.
- Select Generate a new pre-shared key > Update and generate pre-shared key.
- Copy the pre-shared key value for each of your IPsec tunnels, and save these values somewhere safe. Then, select Done.
After creating your IPsec tunnels, the Cloudflare dashboard will list them under the Tunnels tab. Select the arrow (>) on each of your IPsec tunnel to collect the FQDN ID value from each of them. The FQDN ID value will be required when configuring IKE Phase 1 on the Palo Alto Networks Next-Generation Firewall.
If you refer to the Environment section, you will notice there is one subnet within Trust_L3_Zone
: 10.1.100.0/24
.
Create a static route for each of the two IPsec tunnels configured in the previous section, with the following settings (settings not mentioned here can be left with their default settings):
- Description:
SFO_VLAN100_01
- Prefix:
10.1.100.0/24
- Tunnel/Next hop:
SFO_IPSEC_TUN01
- Description:
SFO_VLAN100_02
- Prefix:
10.1.100.0/24
- Tunnel/Next hop:
SFO_IPSEC_TUN02
While Tags are optional ↗, they can greatly improve object and policy visibility. The following color scheme was implemented in this configuration:
Tag | Color |
---|---|
Trust_L3_Zone | Green |
Untrust_L3_Zone | Red |
Cloudflare_L3_Zone | Orange |
Use the Palo Alto Networks Next-Generation Firewall command-Line to set the tags:
set tag Trust_L3_Zone color color2set tag Untrust_L3_Zone color color1set tag Cloudflare_L3_Zone color color6
The use of Address and Address Group objects wherever possible is strongly encouraged. These objects ensure that configuration elements that reference them are defined accurately and consistently.
Any configuration changes should be applied to the objects and will automatically be applied throughout the remainder of the configuration.
Name | Type | Address | Tags |
---|---|---|---|
CF_Health_Check_Anycast_01 | IP Netmask | 172.64.240.253 | Cloudflare_L3_Zone |
CF_Health_Check_Anycast_02 | IP Netmask | 172.64.240.254 | Cloudflare_L3_Zone |
CF_Magic_WAN_Anycast_01 | IP Netmask | 162.159.66.164 | Cloudflare_L3_Zone |
CF_Magic_WAN_Anycast_02 | IP Netmask | 172.64.242.164 | Cloudflare_L3_Zone |
CF_MWAN_IPsec_VTI_01_Local | IP Netmask | 10.252.2.27/31 | Cloudflare_L3_Zone |
CF_MWAN_IPsec_VTI_01_Remote | IP Netmask | 10.252.2.26 | Cloudflare_L3_Zone |
CF_MWAN_IPsec_VTI_02_Local | IP Netmask | 10.252.2.29/31 | Cloudflare_L3_Zone |
CF_MWAN_IPsec_VTI_02_Remote | IP Netmask | 10.252.2.28 | Cloudflare_L3_Zone |
CF_WARP_Client_Prefix | IP Netmask | 100.96.0.0/12 | Cloudflare_L3_Zone |
Cloudflare_IPv4_01 | IP Netmask | 173.245.48.0/20 | Cloudflare_L3_Zone |
Cloudflare_IPv4_02 | IP Netmask | 103.21.244.0/22 | Cloudflare_L3_Zone |
Cloudflare_IPv4_03 | IP Netmask | 103.22.200.0/22 | Cloudflare_L3_Zone |
Cloudflare_IPv4_04 | IP Netmask | 103.31.4.0/22 | Cloudflare_L3_Zone |
Cloudflare_IPv4_05 | IP Netmask | 141.101.64.0/18 | Cloudflare_L3_Zone |
Cloudflare_IPv4_06 | IP Netmask | 108.162.192.0/18 | Cloudflare_L3_Zone |
Cloudflare_IPv4_07 | IP Netmask | 190.93.240.0/20 | Cloudflare_L3_Zone |
Cloudflare_IPv4_08 | IP Netmask | 188.114.96.0/20 | Cloudflare_L3_Zone |
Cloudflare_IPv4_09 | IP Netmask | 197.234.240.0/22 | Cloudflare_L3_Zone |
Cloudflare_IPv4_10 | IP Netmask | 198.41.128.0/17 | Cloudflare_L3_Zone |
Cloudflare_IPv4_11 | IP Netmask | 162.158.0.0/15 | Cloudflare_L3_Zone |
Cloudflare_IPv4_12 | IP Netmask | 104.16.0.0/13 | Cloudflare_L3_Zone |
Cloudflare_IPv4_13 | IP Netmask | 104.24.0.0/14 | Cloudflare_L3_Zone |
Cloudflare_IPv4_14 | IP Netmask | 172.64.0.0/13 | Cloudflare_L3_Zone |
Cloudflare_IPv4_15 | IP Netmask | 131.0.72.0/22 | Cloudflare_L3_Zone |
Internet_L3_203-0-113-254--24 | IP Netmask | 203.0.113.254/24 | Untrust_L3_Zone |
VLAN0010_10-1-10-0--24 | IP Netmask | 10.1.10.0/24 | Cloudflare_L3_Zone |
VLAN0020_10-1-20-0--24 | IP Netmask | 10.1.20.0/24 | Cloudflare_L3_Zone |
VLAN0100_10-1-100-0--24 | IP Netmask | 10.1.100.0/24 | Trust_L3_Zone |
VLAN0100_L3_10-1-100-254--24 | IP Netmask | 10.1.10.254/24 | Trust_L3_Zone |
Use the Palo Alto Networks Next-Generation Firewall command-Line to set the objects:
set address CF_Health_Check_Anycast_01 ip-netmask 172.64.240.253set address CF_Health_Check_Anycast_01 tag Cloudflare_L3_Zoneset address CF_Health_Check_Anycast_02 ip-netmask 172.64.240.254set address CF_Health_Check_Anycast_02 tag Cloudflare_L3_Zoneset address CF_Magic_WAN_Anycast_01 ip-netmask 162.159.66.164set address CF_Magic_WAN_Anycast_01 tag Cloudflare_L3_Zoneset address CF_Magic_WAN_Anycast_02 ip-netmask 172.64.242.164set address CF_Magic_WAN_Anycast_02 tag Cloudflare_L3_Zoneset address CF_MWAN_IPsec_VTI_01_Local ip-netmask 10.252.2.27/31set address CF_MWAN_IPsec_VTI_01_Local tag Cloudflare_L3_Zoneset address CF_MWAN_IPsec_VTI_02_Local ip-netmask 10.252.2.29/31set address CF_MWAN_IPsec_VTI_02_Local tag Cloudflare_L3_Zoneset address CF_MWAN_IPsec_VTI_01_Remote ip-netmask 10.252.2.26set address CF_MWAN_IPsec_VTI_01_Remote tag Cloudflare_L3_Zoneset address CF_MWAN_IPsec_VTI_02_Remote ip-netmask 10.252.2.28set address CF_MWAN_IPsec_VTI_02_Remote tag Cloudflare_L3_Zoneset address CF_WARP_Client_Prefix ip-netmask 100.96.0.0/12set address CF_WARP_Client_Prefix tag Cloudflare_L3_Zoneset address Cloudflare_IPv4_01 ip-netmask 173.245.48.0/20set address Cloudflare_IPv4_01 tag Cloudflare_L3_Zoneset address Cloudflare_IPv4_02 ip-netmask 103.21.244.0/22set address Cloudflare_IPv4_02 tag Cloudflare_L3_Zoneset address Cloudflare_IPv4_03 ip-netmask 103.22.200.0/22set address Cloudflare_IPv4_03 tag Cloudflare_L3_Zoneset address Cloudflare_IPv4_04 ip-netmask 103.31.4.0/22set address Cloudflare_IPv4_04 tag Cloudflare_L3_Zoneset address Cloudflare_IPv4_05 ip-netmask 141.101.64.0/18set address Cloudflare_IPv4_05 tag Cloudflare_L3_Zoneset address Cloudflare_IPv4_06 ip-netmask 108.162.192.0/18set address Cloudflare_IPv4_06 tag Cloudflare_L3_Zoneset address Cloudflare_IPv4_07 ip-netmask 190.93.240.0/20set address Cloudflare_IPv4_07 tag Cloudflare_L3_Zoneset address Cloudflare_IPv4_08 ip-netmask 188.114.96.0/20set address Cloudflare_IPv4_08 tag Cloudflare_L3_Zoneset address Cloudflare_IPv4_09 ip-netmask 197.234.240.0/22set address Cloudflare_IPv4_09 tag Cloudflare_L3_Zoneset address Cloudflare_IPv4_10 ip-netmask 198.41.128.0/17set address Cloudflare_IPv4_10 tag Cloudflare_L3_Zoneset address Cloudflare_IPv4_11 ip-netmask 162.158.0.0/15set address Cloudflare_IPv4_11 tag Cloudflare_L3_Zoneset address Cloudflare_IPv4_12 ip-netmask 104.16.0.0/13set address Cloudflare_IPv4_12 tag Cloudflare_L3_Zoneset address Cloudflare_IPv4_13 ip-netmask 104.24.0.0/14set address Cloudflare_IPv4_13 tag Cloudflare_L3_Zoneset address Cloudflare_IPv4_14 ip-netmask 172.64.0.0/13set address Cloudflare_IPv4_14 tag Cloudflare_L3_Zoneset address Cloudflare_IPv4_15 ip-netmask 131.0.72.0/22set address Cloudflare_IPv4_15 tag Cloudflare_L3_Zoneset address Internet_L3_203-0-113-254--24 ip-netmask 203.0.113.254/24set address Internet_L3_203-0-113-254--24 tag Untrust_L3_Zoneset address VLAN0010_10-1-10-0--24 ip-netmask 10.1.10.0/24set address VLAN0010_10-1-10-0--24 tag Trust_L3_Zoneset address VLAN0020_10-1-20-0--24 ip-netmask 10.1.20.0/24set address VLAN0020_10-1-20-0--24 tag Trust_L3_Zoneset address VLAN0100_10-1-100-0--24 ip-netmask 10.1.100.0/24set address VLAN0100_10-1-100-0--24 tag Trust_L3_Zoneset address VLAN0100_L3_10-1-100-254--24 ip-netmask 10.1.100.254/24set address VLAN0100_L3_10-1-100-254--24 tag Trust_L3_Zone
The Address Group object used in this configuration provides a single object representation of the entire Cloudflare IPv4 public address space.
Name | Type | Addresses | Tags |
---|---|---|---|
Cloudflare_IPv4_Static_Grp | Static | Cloudflare_IPv4_01 | Cloudflare_L3_Zone |
Cloudflare_IPv4_Static_Grp | Static | Cloudflare_IPv4_02 | Cloudflare_L3_Zone |
Cloudflare_IPv4_Static_Grp | Static | Cloudflare_IPv4_03 | Cloudflare_L3_Zone |
Cloudflare_IPv4_Static_Grp | Static | Cloudflare_IPv4_04 | Cloudflare_L3_Zone |
Cloudflare_IPv4_Static_Grp | Static | Cloudflare_IPv4_05 | Cloudflare_L3_Zone |
Cloudflare_IPv4_Static_Grp | Static | Cloudflare_IPv4_06 | Cloudflare_L3_Zone |
Cloudflare_IPv4_Static_Grp | Static | Cloudflare_IPv4_07 | Cloudflare_L3_Zone |
Cloudflare_IPv4_Static_Grp | Static | Cloudflare_IPv4_08 | Cloudflare_L3_Zone |
Cloudflare_IPv4_Static_Grp | Static | Cloudflare_IPv4_09 | Cloudflare_L3_Zone |
Cloudflare_IPv4_Static_Grp | Static | Cloudflare_IPv4_10 | Cloudflare_L3_Zone |
Cloudflare_IPv4_Static_Grp | Static | Cloudflare_IPv4_11 | Cloudflare_L3_Zone |
Cloudflare_IPv4_Static_Grp | Static | Cloudflare_IPv4_12 | Cloudflare_L3_Zone |
Cloudflare_IPv4_Static_Grp | Static | Cloudflare_IPv4_13 | Cloudflare_L3_Zone |
Cloudflare_IPv4_Static_Grp | Static | Cloudflare_IPv4_14 | Cloudflare_L3_Zone |
Cloudflare_IPv4_Static_Grp | Static | Cloudflare_IPv4_15 | Cloudflare_L3_Zone |
Use the Palo Alto Networks Next-Generation Firewall command-Line to set the address group object:
set address-group Cloudflare_IPv4_Static_Grp static [ Cloudflare_IPv4_01 Cloudflare_IPv4_02 Cloudflare_IPv4_03 Cloudflare_IPv4_04 Cloudflare_IPv4_05 Cloudflare_IPv4_06 Cloudflare_IPv4_07 Cloudflare_IPv4_08 Cloudflare_IPv4_09 Cloudflare_IPv4_10 Cloudflare_IPv4_11 Cloudflare_IPv4_12 Cloudflare_IPv4_13 Cloudflare_IPv4_14 Cloudflare_IPv4_15 ]set address-group Cloudflare_IPv4_Static_Grp tag Cloudflare_L3_Zone
Interface Mgmt profiles control what traffic is allowed to the firewall, as opposed to through the firewall.
Adding an Interface Mgmt profile to the tunnel interfaces will provide the ability to ping the Virtual Tunnel Interface on your firewall(s).
You can define an Interface Management Profile to allow ping from the dashboard:
- Go to Network Profiles > Interface Mgmt.
- In the Network tab select Add.
- Create profiles to allow Ping, and in the Network Services group select Ping.
You can also use the command line to allow ping:
set network profiles interface-management-profile Allow_Ping userid-service noset network profiles interface-management-profile Allow_Ping ping yes
Palo Alto Networks Next-Generation Firewall (NGFW) is configured with two Ethernet interfaces:
Interface | Interface Type | IP Address | Virtual Router |
---|---|---|---|
ethernet1/1 | Layer3 | 10.1.100.254/24 | default |
ethernet1/2 | Layer3 | 203.0.113.254/24 | default |
Follow the guidance on the images below to set up the Ethernet interfaces through the dashboard.
Name | Option | Value |
---|---|---|
ethernet1/1 | Interface Type | Layer3 |
Netflow Profile | None | |
Config tab | Virtual Router | default |
Security Zone | Trust_L3_Zone | |
IPv4 tab | Type | Static |
IP | VLAN0100_L3_10-1-100-254--24 address object | |
Advanced tab | Management Profile | Mgmt_Services |
Name | Option | Value |
---|---|---|
ethernet1/2 | Interface Type | Layer3 |
Netflow Profile | None | |
Config tab | Virtual Router | default |
Security Zone | Untrust_L3_Zone | |
IPv4 tab | Type | Static |
IP | Internet_L3_203-0-113-254--24 address object | |
Advanced tab | Management Profile | Allow_Ping |
MTU | 576 - 1500 | |
Adjust TCP MSS | Enable | |
IPv4 MSS Adjustment | 64 |
After setting up your Ethernet interfaces, they should show up on the overview page:
You can also use the command line to set up the Ethernet interfaces.
set network interface ethernet ethernet1/1 layer3 ndp-proxy enabled noset network interface ethernet ethernet1/1 layer3 lldp enable noset network interface ethernet ethernet1/1 layer3 ip VLAN0100_L3_10-1-100-254--24set network interface ethernet ethernet1/1 layer3 interface-management-profile Mgmt_Servicesset network interface ethernet ethernet1/2 layer3 ndp-proxy enabled noset network interface ethernet ethernet1/2 layer3 lldp enable noset network interface ethernet ethernet1/2 layer3 ip Internet_L3_203-0-113-254--24set network interface ethernet ethernet1/2 layer3 interface-management-profile Allow_Pingset network interface ethernet ethernet1/2 layer3 adjust-tcp-mss enable yesset network interface ethernet ethernet1/2 layer3 adjust-tcp-mss ipv4-mss-adjustment 64
Establishing IPsec Tunnels to Cloudflare Magic WAN requires two tunnel interfaces - one to each of the two Cloudflare anycast IP addresses. You also have to ensure that Allow_Ping
is bound to both tunnel adapters in Advanced > Managementt Profile.
Review the images below for more information.
Name | Option | Value |
---|---|---|
tunnel.1 | Netflow Profile | None |
Config tab | Virtual Router | default |
Security Zone | Cloudflare_L3_Zone | |
IPv4 tab | IP | CF_MWAN_IPsec_VTI_01_Local address object |
Advanced tab | Management Profile | Allow_Ping |
MTU | 1450 |
Name | Option | Value |
---|---|---|
tunnel.2 | Netflow Profile | None |
Config tab | Virtual Router | default |
Security Zone | Cloudflare_L3_Zone | |
IPv4 tab | IP | CF_MWAN_IPsec_VTI_02_Local address object |
Advanced tab | Management Profile | Allow_Ping |
MTU | 1450 |
After setting up your Tunnel interfaces, they should show up on the overview page:
You can also set up your tunnels in the command line:
set network interface tunnel units tunnel.1 ip CF_MWAN_IPsec_VTI_01_Localset network interface tunnel units tunnel.1 mtu 1450set network interface tunnel units tunnel.1 interface-management-profile Allow_Pingset network interface tunnel units tunnel.2 ip CF_MWAN_IPsec_VTI_02_Localset network interface tunnel units tunnel.2 mtu 1450set network interface tunnel units tunnel.2 interface-management-profile Allow_Ping
The Palo Alto Networks Next-Generation Firewall (NGFW) used to create this tutorial includes the following zones and corresponding network interfaces:
Zone | Interface | Interface |
---|---|---|
Trust_L3_Zone | ethernet1/1 | |
Untrust_L3_Zone | ethernet1/2 | |
Cloudflare_L3_Zone | tunnel.1 | tunnel.2 |
The tunnel interfaces are placed in a separate zone to facilitate the configuration of more granular security policies. The use of any other zone for the tunnel interfaces will require adapting the configuration accordingly.
Name | Option | Value |
---|---|---|
Trust_L3_zone | Log setting | None |
Type | Layer3 | |
Interfaces | ethernet1/1 | |
Zone Protection Profile | None |
Name | Option | Value |
---|---|---|
Untrust_L3_zone | Log setting | None |
Type | Layer3 | |
Interfaces | ethernet1/2 | |
Zone Protection Profile | Untrust_Zone_Prof |
Name | Option | Value |
---|---|---|
Cloudflare_L3_zone | Log setting | None |
Type | Layer3 | |
Interfaces | tunnel.1 tunnel.2 | |
Zone Protection Profile | None |
You can also use the command line to associate zones and interfaces:
set zone Trust_L3_Zone network layer3 ethernet1/1set zone Untrust_L3_Zone network layer3 ethernet1/2set zone Cloudflare_L3_Zone network layer3 [ tunnel.1 tunnel.2 ]
This would be a good time to save and commit the configuration changes made so far. Once complete, make sure you test basic connectivity to and from the firewall.
Add a new IKE crypto profile to support the required parameters for Phase 1.
Multiple DH groups and authentication settings are defined in the desired order. Palo Alto Networks Next-Generation Firewall (NGFW) will automatically negotiate the optimal settings based on specified values.
Name | Option | Value |
---|---|---|
CF_IKE_Crypto_CBC | DH Group | group20 |
Authentication | sha512 sha384 sha256 | |
Encryption | aes-256-cbc | |
Key Lifetime | 24 hours | |
IKEv2 Authentication Multiple | 0 |