This tutorial creates a pair of Active/Passive VM-Series firewalls on Google Cloud. This deployment model provides solutions for the following key use-cases:
- Maintaining session continuity through stateful failover between the VM-Series firewalls.
- Terminating IPsec tunnels directly to the VM-Series firewall through the external load balancer.
- Preserving the original client IP address for internet inbound traffic to internal applications protected by the VM-Series firewalls.
The autoscale architecture is recommended in most use-cases. Please see VM-Series on Google Cloud for more information on VM-Series deployment models.
In this model, each VM-Series firewall belongs to an unmanaged instance group. Only the primary VM-Series firewall receives network traffic from Google Cloud load balancers. The health check configured on the load balancers determines the HA state of the primary VM-Series firewall. If the health check fails on the primary VM-Series firewall, the load balancers send all traffic, including existing sessions, to the secondary VM-Series firewall. At that point, the secondary VM-Series firewall becomes the primary firewall.
Note
The VM-Series firewalls synchronize session state over the HA2 interface. During a failure event, the connection tracking policy on the load balancers moves existing connections to the new active firewall, which already has their session state.
| Resources | |
VM-Series |
|
External LB |
An external pass-through load balancer with two forwarding rules:
|
Internal LB |
An internal pass-through load balancer with a single forwarding rule. Traffic from workload networks uses the load balancer's forwarding rule as the next hop within their VPC route table. |
Policy-based route |
Sends traffic between the test VMs in the trust subnet (vm1 and vm2) to the internal load balancer, so the VM-Series inspects it.
|
| VPC Networks | |
Mgmt VPC |
Contains the VM-Series MGT interfaces. This interface also serves as the HA1 interface. |
HA2 VPC |
Contains the VM-Series HA2 interfaces. |
Untrust VPC |
Serves as the internet gateway for resources within the trust VPC. |
Trust VPC |
Contains the workloads protected by the VM-Series. This VPC can also serve as a hub network with multiple VPCs peered to it. |
Important
After deployment, the load balancer's health checks will only pass on the active VM-Series firewall. This is because the dataplane of the passive firewall is inactive and is unable to pass the health checks. During a failure event, the passive firewall becomes active and the health checks will pass.
-
In Cloud Shell, enable the required APIs, generate an SSH key, and clone the repository.
gcloud services enable compute.googleapis.com networkconnectivity.googleapis.com ssh-keygen -f ~/.ssh/panw-tutorial -t rsa git clone https://github.com/PaloAltoNetworks/google-cloud-vmseries-ha-tutorial cd google-cloud-vmseries-ha-tutorial -
Create a
terraform.tfvarsfile.cp terraform.tfvars.example terraform.tfvars -
Edit the
terraform.tfvarsfile and set values for the following variables:Variable Description project_idSet to your Google Cloud deployment project. regionThe Google Cloud region for the deployment. public_key_pathSet to the public key you created previously ( ~/.ssh/panw-tutorial.pub).mgmt_allow_ipsSet to a list of IPv4 ranges that can access the VM-Series management interface. mgmt_public_ipIf true, set a public IP create_workload_vms(Optional) Set to falseto skip creating the workload VMs used for testing.vmseries_image_name(Optional) Defines the VM-Series image to deploy. A full list of images can be found here. -
(Optional) If you are using a BYOL image (e.g.
vmseries-flex-byol-*), the license can be applied during deployment by adding your VM-Series authcode tobootstrap_files/authcodes. -
Save your
terraform.tfvarsfile.
When no further changes are necessary in the configuration, deploy the resources:
-
Initialize and apply the Terraform plan.
terraform init terraform apply -
Enter
yesto start the deployment. -
After all the resources are created, Terraform displays the following message:
Apply complete! Resources: 72 added, 0 changed, 0 destroyed. Outputs: ATTENTION = "The firewalls take ~10 minutes to boot after the apply completes. Wait before logging in or testing."
Caution
After the apply completes, it may take ~10 minutes for the VM-Series to become available.
Set a password for the admin user on the active firewall. The password syncs to the standby firewall when you commit.
-
In Cloud Shell, save both firewalls' management addresses and SSH into the active firewall
read ACTIVE_FW_IP STANDBY_FW_IP <<< "$(gcloud compute instances list \ --filter='tags.items=(panw-tutorial) AND name~vmseries' \ --sort-by=name \ --format='value(networkInterfaces[1].accessConfigs[0].natIP, networkInterfaces[1].networkIP)' \ | awk '{printf "%s ", $1}')" ssh admin@$ACTIVE_FW_IP -i ~/.ssh/panw-tutorial
Tip
If the management interfaces do not have public addresses, the variables are set to their private addresses. Run the remaining steps from a network that can reach the management VPC.
-
Set a password for the
adminuser. Enter the password twice when prompted.configure set mgt-config users admin password -
Commit the changes.
commit -
Once the commit completes, enter
exittwice. -
Retrieve the URL of each firewall, then log in to both as
admin. Keep both tabs open for the failover test.echo https://$ACTIVE_FW_IP echo https://$STANDBY_FW_IP
You can now test the deployment, including failover, by accessing vm1 that resides in the trust VPC network. All of the vm1 traffic is routed directly through the VM-Series HA pair.
-
In Cloud Shell, save the address of the external load balancer's
inboundforwarding rule to an environment variable.export EXTERNAL_LB_IP=$(gcloud compute forwarding-rules list \ --filter="name~extlb-inbound" \ --format="value(IPAddress)") echo http://$EXTERNAL_LB_IP -
Open the URL from the previous step in a web browser to access the web service on
vm1through the VM-Series firewall.
-
Use the same address to open an SSH session through the VM-Series to
vm1.ssh paloalto@$EXTERNAL_LB_IP -i ~/.ssh/panw-tutorial -
On
vm1, check the egress address. The output is the address of theoutboundforwarding rule on the external load balancer.curl https://icanhazip.com
Note
Egress traffic from vm1 is routed to the internal load balancer's forwarding rule. The VM-Series inspects and translates the request to the outbound forwarding rule on the external load balancer.
-
On
vm1, open an interactive session tovm2in the same subnet. A policy-based route sends this traffic through the VM-Series.create-sessions -
Type
helloand press Enter.vm2replies with the session number and the time the session opened.Connecting to vm2 (10.0.2.6) through the VM-Series. Type a message and press Enter. Ctrl+C to quit. vm2: connected. This is session 1, opened 17:20:01. hello vm2: received "hello" | session 1, opened 17:20:01 | message 1
Important
Leave this session open for the rest of the test.
-
In each firewall's web interface, check the HA status in the bottom right corner. The standby firewall shows as Passive.
Active firewall 
Standby firewall 
-
On the active firewall, go to Device → High Availability → Operational Commands.
-
Click Suspend local device for high availability, then click OK. The standby firewall takes over as active.
-
Return to your SSH session on
vm1. It is still connected, which shows that the session failed over to the new active firewall. -
In the same session, type
after failoverand press Enter. The reply can take a few seconds while the load balancers switch to the new active firewall.after failover vm2: received "after failover" | session 1, opened 17:20:01 | message 2
Note
The reply still shows session 1, so the session to vm2 also failed over without reconnecting. If no reply arrives within a minute, the session did not fail over.
- On the suspended firewall, go to Device → High Availability → Operational Commands and click Make local device functional. It becomes the active firewall again.
To publish another internet-facing application, add a forwarding rule to the external load balancer and a NAT rule on the active firewall. The firewalls do not need to be redeployed.
In this section, you deploy a web application on a new VM (app-vm) in the trust subnet and publish it on a new public address.
-
In Cloud Shell, save the deployment's zone, region, trust subnet, and external load balancer to environment variables.
read ZONE SUBNET <<< "$(gcloud compute instances list \ --filter='tags.items=(panw-tutorial) AND name~vmseries01' \ --format='value(zone.basename(), networkInterfaces[2].subnetwork.basename())')" export REGION=${ZONE%-*} export EXTERNAL_LB=$(gcloud compute backend-services list \ --filter="name~extlb" \ --format="value(name)") -
Create
app-vmin the trust subnet. Its startup script (scripts/app_startup.sh) installs a sample web application.gcloud compute instances create app-vm \ --zone=$ZONE \ --subnet=$SUBNET \ --no-address \ --machine-type=e2-small \ --image-project=debian-cloud \ --image-family=debian-13 \ --metadata=startup-script-url=https://raw.githubusercontent.com/PaloAltoNetworks/google-cloud-vmseries-ha-tutorial/main/scripts/app_startup.sh -
Create a forwarding rule (
fwd-rule-app-vm) on the external load balancer. This gives the application its own public address and sends its traffic through the firewalls' untrust interfaces.gcloud compute forwarding-rules create fwd-rule-app-vm \ --region=$REGION \ --load-balancing-scheme=EXTERNAL \ --ip-protocol=L3_DEFAULT \ --ports=ALL \ --backend-service=$EXTERNAL_LB -
Save the two addresses for the NAT rule.
export APP_PUBLIC_IP=$(gcloud compute forwarding-rules describe fwd-rule-app-vm \ --region=$REGION \ --format='value(IPAddress)') export APP_PRIVATE_IP=$(gcloud compute instances describe app-vm \ --zone=$ZONE \ --format='value(networkInterfaces[0].networkIP)') echo "Destination Address (forwarding rule): $APP_PUBLIC_IP" echo "Translated Address (app-vm): $APP_PRIVATE_IP" -
On the active firewall, go to Policies → NAT, click Add, and name the rule
inbound-app2. -
In the Original Packet tab, set the following:
Field Value Source Zone untrustDestination Zone untrustService service-httpDestination Address The Destination Address from step 4
-
In the Translated Packet tab, set Destination Address Translation as follows:
Field Value Translation Type Static IPTranslated Address The Translated Address from step 4 Translated Port 80
-
Click OK, then Commit.
-
Open the application in a web browser. If the page does not load, wait a minute for the
app-vmstartup script to finish.echo http://$APP_PUBLIC_IP
-
On the active firewall, go to Monitor → Traffic to view the traffic to
app-vm.
To avoid charges to your Google Cloud account, delete the resources you created in this tutorial.
-
If you completed the Onboard internet applications section, delete the forwarding rule and
app-vmfirst. Terraform cannot delete the external load balancer while the forwarding rule uses it, or the trust subnet whileapp-vmis in it.gcloud compute forwarding-rules delete --quiet \ $(gcloud compute forwarding-rules list --filter="name=fwd-rule-app-vm" --uri) gcloud compute instances delete --quiet \ $(gcloud compute instances list --filter="name=app-vm" --uri) -
From the repository directory, delete the remaining resources. Enter
yeswhen prompted.terraform destroyWhen the deletion completes, Terraform displays
Destroy complete!.
- Learn about the VM-Series on Google Cloud.
- Getting started with Palo Alto Networks PAN-OS.
- Read about securing Google Cloud Networks with the VM-Series.
- Learn about VM-Series licensing on all platforms.
- Use the VM-Series Terraform modules for Google Cloud.
