Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Create two custom VPCs with subnetworks and firewall rules.
/ 10
Create two VPN gateways and necessary forwarding rules.
/ 10
Create two VPN tunnels.
/ 10
Create two VMs and install iperf via ssh.
/ 10
Create two custom VPCs with subnetworks and firewall rules.
/ 10
Create two VPN gateways and necessary forwarding rules.
/ 10
Create two VPN tunnels.
/ 10
Create two VMs and install iperf via ssh.
/ 10
This hands-on lab shows you how to create a secure, high-throughput VPN and test the speed.
Secure communication between Google Cloud and other clouds or on-premises systems is a common, critical need. Fortunately, Google Cloud makes it easy for you to create a secure Internet Protocol security (IPsec) virtual private networks (VPNs) to achieve this goal. If a single tunnel does not provide necessary throughput, Google Cloud can smoothly distribute traffic across multiple tunnels to provide additional bandwidth.
In this lab you do the following:
Create VPN
cloud to simulate your Google Cloud network, and a VPC named on-prem (on-premises) to simulate an external network.cloud VPC.on-prem VPC, creating a second VPN.Test VPNs
iperf.To maximize your learning, you should:
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.
This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the right is the Lab setup and access panel with the following:
Note that the lab timer is located near the top of the page, showing the remaining time.
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
If necessary, copy the Username below and paste it into the Sign in dialog.
You can also find the Username in the Lab setup and access panel.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab setup and access panel.
Click Next.
Click through the subsequent pages:
After a few moments, the Google Cloud console opens in this tab.
Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.
Click Activate Cloud Shell at the top of the Google Cloud console.
Click through the following windows:
When you are connected, you are already authenticated, and the project is set to your Project_ID,
gcloud is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.
Output:
Output:
gcloud, in Google Cloud, refer to the gcloud CLI overview guide.
In this section, you:
cloud associated with your Google Cloud project by running the following:This VPC allows you to use non-default IP addressing, but does not include any default firewall rules.
SSH and icmp, because you'll need a secure shell to communicate with VMs during load testing:In this solution, you use 10.0.1.0/24 and the
In this section you create a simulation of your on-prem VPC, or any network you want to connect to cloud. In practice you'd already have resources here, but for the purpose of creating tunnels and validating configurations, follow these steps:
on-prem by running:SSH and icmp for hosts in the on-prem VPC, because you need a secure shell to communicate with VMs during load testing:Each environment requires VPN gateways for secure external communication. Follow these steps to create the initial gateways for your cloud and on-prem VPCs:
on-prem-gw1 in the on-prem VPC and cloud-gw1 in the cloud VPC and The VPN gateways each need a static, external IP address so that systems outside the VPC can communicate with them. Now you create IP addresses and routes on the cloud and on-prem VPCs.
cloud-gw1 VPN gateway:on-prem-gw1 VPN gateway:First, for the cloud-gw1 gateway:
Second, for the on-prem-gw1 gateway:
cloud VPC. You need to create forwarding rules in both directions.Forward the Encapsulating Security Payload (ESP) protocol from cloud-gw1:
Forward UDP:500 traffic from cloud-gw1:
Forward UDP:4500 traffic from cloud-gw1:
on-prem VPC. This step allows the IPsec tunnel to exit your firewalls:Forward the ESP protocol from on-prem-gw1:
Forward UDP:500 traffic, used in establishing the IPsec tunnel from on-prem-gw1:
Forward UDP:4500 traffic, which carries the encrypted traffic from on-prem-gw1:
Ordinarily you would need to go generate a secret for the next step, where you create and validate the tunnels on-prem-tunnel1 and cloud-tunnel1. For details about how to create and securely store secrets, view the Secret Manager conceptual overview guide. For now just use the string "sharedsecret".
Create a tunnel for the local network on-prem-tunnel1, and for the cloud-based network cloud-tunnel1. Each network must have a VPN gateway, and the secrets must match. In the following two commands, where you would, in a production scenario, replace [MY_SECRET] with the secret you generated, replace it with "sharedsecret"
on-prem to cloud:Now that you've created the gateways and built the tunnels, you need to add routes from the subnets through the two tunnels.
on-prem VPC to the cloud 10.0.1.0/24 range into the tunnel:cloud VPC to the on-prem 192.168.1.0/24 range into the tunnel:At this point, you've established a secure path between the on-prem and cloud VPCs. To test throughput use iperf, an open-source tool for network load testing. To test, you need a VM in each environment, one to send traffic and the other to receive it, and you'll create them next.
Now you create a virtual machine for the cloud VPC named is cloud-loadtest. This example uses a Debian Linux image for the OS.
on-prem VPC named on-prem-loadtest. This example uses the same Debian image as in the cloud VPC. Omit this step if you have existing resources.Run the following:
on-prem-loadtest VM, run this command:You have created an iperf server on the VM that reports its status every 5 seconds.
cloud-loadtest VM, run this command:This creates an iperf client with twenty streams, which reports values after 10 seconds of testing.
You can delete the created VPN tunnels by following command:
Make sure you installed iperf on both VMs.
In case of connection refused error, verify that:
on-prem-loadtest
cloud-loadtest
In this lab, you successfully built a high-throughput VPN between two simulated networks, a cloud VPC and an on-premises VPC. You learned how to create custom VPCs, configure VPN gateways, establish secure IPsec tunnels, and route traffic through those tunnels. Finally, you tested the throughput of your VPN using iperf to validate its performance.
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated March 30, 2025
Lab Last Tested February 25, 2025
Copyright 2026 Google LLC. All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one
Complete this quick step to start your lab.