Cloud VPN in Google Cloud
A complete, beginner-friendly guide to connecting your offices, data centers and other clouds to Google Cloud over encrypted tunnels: how Cloud VPN works inside, how to make it resilient, how to secure it, and how to run it well in production.
Imagine a company with a head office, fifty shops, and a new application running in the cloud. The shops’ tills must talk to the cloud application, and the head office must reach the cloud’s databases. But the only road between these places is the public internet, where anyone can listen in. How do you let private conversations cross a public road without anyone overhearing or tampering with them?
The classic answer is a VPN, a virtual private network. On Google Cloud, the service that provides it is called Cloud VPN. It builds encrypted tunnels between your network and your Google Cloud network, and it can do so in minutes instead of the weeks a physical cable would need. This guide assumes you know nothing about networking. We will explain every word as it appears, starting with what a tunnel is, and then walk through how Cloud VPN is built, how traffic flows, how to make it survive failures, how to keep it secure, how to troubleshoot it, and how real teams use it.
1What Is Cloud VPN and Why Does It Exist?
Cloud VPN securely connects another network to your Google Cloud network over the public internet, using encryption.
The problem
Most companies do not move everything to the cloud at once. Some systems stay in their own data centers for legal, technical or financial reasons. Others live in a second cloud. This mixture is called a hybrid or multi-cloud environment. The pieces must communicate using private addresses and with the same safety as if they sat in one building. Sending that traffic across the open internet unprotected would be like shouting your bank details across a crowded market.
What is a VPN?
A virtual private network makes two separate networks behave as if they were one private network, even though the data travels over a shared public path. It does this by wrapping each piece of data in an encrypted envelope, sending it across the internet, and unwrapping it at the other end. The path an encrypted conversation takes is called a tunnel.
Think of two offices in different cities that need to exchange confidential letters. Instead of handing letters to any courier, they place each letter in a locked metal box, send the box by ordinary post, and the receiving office opens it with a matching key. The postal service sees only locked boxes. A VPN tunnel is that locked-box service, running automatically for every message.
What is Cloud VPN specifically?
Cloud VPN is Google Cloud’s managed service for creating site-to-site IPsec VPN tunnels. “Site-to-site” means it joins two whole networks together, such as your office network and your Google Cloud network, not one person’s laptop to a network. “IPsec” is the standard set of rules for encrypting and authenticating network traffic. Because Google runs the gateway on its side as a managed service, you do not build, patch or scale a VPN server. You configure it, and Google operates it.
Private over public
Traffic is encrypted with IPsec, so it is protected while crossing the internet.
No server to run
Google operates the gateway on its side, including availability and scaling of the service itself.
Minutes, not weeks
No physical cables or provider lead times. You can create tunnels over your existing internet connection.
High availability option
HA VPN offers redundant interfaces and a 99.99 percent availability commitment when configured correctly.
Works with many devices
It connects to standard IPsec-capable routers, firewalls, and other clouds.
Pay per tunnel and traffic
Pricing is based on tunnel time and data sent out, with no upfront hardware.
Cloud VPN is for connecting networks to each other. It is not meant to let an individual employee dial in from a laptop. Remote access for individuals uses different tools, which we will mention later.
2Networking Basics You Need First
Five small ideas make everything else easy: IP addresses, private ranges, routing, encryption and BGP.
IP addresses and ranges
Every device on a network has an IP address, like a house number. A group of addresses is written as a range using slash notation, such as 10.0.0.0/16, which means “all addresses beginning with 10.0”. Private ranges such as 10.x.x.x, 172.16.x.x to 172.31.x.x and 192.168.x.x are reserved for internal use and are not reachable directly from the public internet. A VPN lets two networks use each other’s private addresses.
Private addresses are like room numbers inside a building. “Room 204” means something only inside that building. Two different buildings can each have a Room 204, which is exactly why overlapping ranges cause trouble when you connect networks.
Routing
A route is a rule that says “to reach this range of addresses, send traffic this way”. A network device checks its routes for every packet, much as a traveler checks road signs. VPN traffic works only if both sides have routes that point to the tunnel.
Encryption and authentication
Encryption scrambles data so only someone with the right key can read it. Authentication proves that the other side is who it claims to be, and that the data was not altered on the way. IPsec provides both. The keys used for encryption are created fresh and changed regularly, so even if one were stolen, it would expose only a small slice of traffic.
IPsec and IKE
IPsec is the family of standards for protecting traffic at the network layer. A companion protocol, IKE (Internet Key Exchange), is the negotiation step: the two ends use it to agree on algorithms, prove their identities, and generate the shared keys. Cloud VPN’s high availability service uses version 2, called IKEv2.
BGP: routes that update themselves
Writing every route by hand is slow and error-prone. BGP, the Border Gateway Protocol, lets two networks tell each other which address ranges they can reach, and update automatically if something changes. It is the same protocol the whole internet uses to find its way around. On Google Cloud, a service called Cloud Router speaks BGP for you.
| Term | Plain meaning | Analogy |
|---|---|---|
| Tunnel | An encrypted path between two VPN gateways | The locked-box delivery service |
| Gateway | The device at each end that starts and ends the tunnel | The mailroom that boxes and unboxes letters |
| Route | A rule saying where to send traffic for a range | A road sign |
| BGP | A protocol that exchanges routes automatically | Mailrooms phoning each other to say which addresses they serve |
| Pre-shared key | A secret password both ends know, used to prove identity | A secret handshake agreed in advance |
| MTU | The largest packet size a link accepts without splitting it | The biggest box that fits through the door |
For a VPN to work, four things must line up: both sides agree on encryption, both sides have routes into the tunnel, no firewall blocks the traffic, and the address ranges do not overlap.
3Core Concepts: Gateways, Tunnels, Cloud Router and Peers
Cloud VPN has a handful of building blocks. Meeting them one by one makes any diagram easy to read.
Picture a company with a mailroom in each city. The mailroom in Google Cloud is the Cloud VPN gateway. The mailroom at your office is the peer gateway. The locked-box service between them is a tunnel. The postmaster who keeps the address book up to date is Cloud Router.
| Building block | What it is |
|---|---|
| Cloud VPN gateway | The Google-side VPN endpoint. A regional resource attached to one VPC network. An HA VPN gateway has two interfaces, each with its own external IP address. |
| Peer VPN gateway | The other end: a router or firewall in your data center, or a gateway in another cloud. Described to Google as an external VPN gateway resource, with one, two or four interfaces. |
| VPN tunnel | One encrypted connection between a Cloud VPN interface and a peer interface. Each tunnel has its own security settings and shared secret. |
| Cloud Router | A managed service that speaks BGP, learning routes from your peer and advertising your VPC’s ranges to it. |
| BGP session | The conversation between Cloud Router and the peer router, carried inside a tunnel. |
| VPC network | Your private network in Google Cloud, where your virtual machines live. |
| Routes | Rules in the VPC that send traffic for on-premises ranges into the tunnels. |
| Firewall rules | Allow or deny rules that still apply to traffic arriving through the VPN. |
| Shared secret | The pre-shared key used by both ends to authenticate each other. |
The gateway and its interfaces
The Cloud VPN gateway sits in a specific region, such as Mumbai or Frankfurt, and belongs to one VPC network. In the high availability type, each gateway has two interfaces, each with a separate external IP address allocated by Google. Think of them as two separate front doors to the same mailroom. Having two doors is the heart of the high availability design.
Tunnels
A tunnel connects one Google interface to one interface on the peer. You usually build at least two tunnels, one from each Google interface, so that the loss of one does not break connectivity. Each tunnel carries both directions of traffic and has a bandwidth limit that we will examine in a later chapter.
Cloud Router and BGP
With dynamic routing, Cloud Router exchanges routes with the peer over BGP. When your office adds a new address range, the peer announces it, Cloud Router learns it, and routes in your VPC update themselves. When a tunnel fails, the matching routes are withdrawn and traffic moves to a healthy tunnel automatically. With static routing, you write the routes manually, and nothing updates itself.
Regional resources, global reach
A gateway lives in one region, but with global dynamic routing the learned routes can be shared across all regions of the VPC, so virtual machines in other regions can also reach on-premises networks through that gateway. We cover this in the routing chapter.
Draw your design on paper first, with the two networks, the four gateways’ interfaces, the tunnels, and the address ranges on each side. Most configuration mistakes are visible in a good drawing before anything is created.
4HA VPN and Classic VPN
Cloud VPN comes in two types. One is the modern recommendation. The other is older and being phased out.
HA VPN: the modern choice
HA VPN stands for high availability VPN. Its gateway has two interfaces, each with its own external IP address. Google offers a 99.99 percent availability service level agreement for the Google Cloud side, provided you configure it in the recommended redundant way: two tunnels, one on each interface, with dynamic routing, to a properly redundant peer. It requires dynamic routing through Cloud Router and BGP, uses IKEv2, and supports both IPv4 and, in dual-stack setups, IPv6 traffic.
Classic VPN: the legacy option
Classic VPN has a single interface with a single external IP address, and a lower availability commitment, around 99.9 percent. It supports static routing, and in the past a form of dynamic routing. Google has deprecated Classic VPN, which means that you should not use it for new designs and should plan to migrate existing tunnels. Check Google’s current announcements for timelines and for any remaining supported scenarios.
| Feature | HA VPN | Classic VPN |
|---|---|---|
| Gateway interfaces | Two, each with its own external IP | One external IP |
| Availability commitment | 99.99 percent with recommended setup | Around 99.9 percent |
| Routing | Dynamic with BGP through Cloud Router | Static, or limited legacy forms |
| IKE version | IKEv2 | IKEv1 and IKEv2 |
| IPv6 support | Yes, in dual-stack setups | No |
| Status | Recommended | Deprecated, migrate away |
| Redundancy design | Built around two tunnels and two interfaces | Single point of failure per gateway |
Classic VPN is a bridge with a single lane: if a truck breaks down, everything stops. HA VPN is a bridge with two separate roads built to different designs, each with its own signs. Even if one is closed for repair, traffic keeps flowing on the other.
Why two interfaces matter
Google needs to perform maintenance on its gateways from time to time. With one interface, maintenance means interruption. With two, Google can service one interface at a time while the other carries traffic. The 99.99 percent figure depends on you having tunnels on both interfaces, so that the surviving one picks up the load.
Creating an HA VPN gateway does not automatically give you the 99.99 percent guarantee. You must build the redundant tunnels and a redundant peer configuration as described in Google’s documentation. A single tunnel on an HA gateway has no better availability than any single path.
If you have old Classic VPN tunnels, treat migration as a planned project. Build the HA VPN beside the old one, test, move routes over, and then retire Classic. Do not wait until the last supported day.
5Architecture and Components
Let us put the building blocks together into a complete picture of a typical HA VPN connection.
flowchart LR
subgraph ONP["Your data center or office"]
SRV["Servers and users on 192.168.0.0/16"]
PR1["Peer VPN device interface 0"]
PR2["Peer VPN device interface 1"]
SRV --- PR1
SRV --- PR2
end
subgraph NET["Public internet"]
T1["Encrypted IPsec tunnel 1"]
T2["Encrypted IPsec tunnel 2"]
end
subgraph GCP["Google Cloud region"]
GI0["HA VPN gateway interface 0"]
GI1["HA VPN gateway interface 1"]
CR["Cloud Router with BGP"]
VPC["VPC network 10.0.0.0/16"]
VM["Virtual machines and services"]
GI0 --- CR
GI1 --- CR
CR --- VPC
VPC --- VM
end
PR1 --- T1 --- GI0
PR2 --- T2 --- GI1
Read the diagram from left to right. On the left is your own network with its servers. It connects to a VPN device, often a firewall or router, with two interfaces. Each interface builds an encrypted tunnel across the internet to one of the two interfaces on the Google Cloud VPN gateway. Inside the tunnels, Cloud Router and the peer router run BGP and exchange the address ranges they can reach. The learned routes appear in your VPC, so virtual machines can send traffic to on-premises addresses and have it automatically enter the tunnels.
Where each piece lives
- Google-managed: the VPN gateway service itself, its availability, and its software upkeep.
- In your Google Cloud project: gateway resources, tunnels, Cloud Router, routes, firewall rules and the VPC.
- Outside Google Cloud, your responsibility: the peer VPN device, its configuration, its internet connection and its availability.
The control side and the data side
It helps to separate two kinds of activity. The control plane is the set of conversations that set things up: negotiating keys with IKE and swapping routes with BGP. The data plane is the actual traffic of users and applications flowing through the tunnels. Problems in the control plane stop tunnels from forming or routes from appearing. Problems in the data plane show up as slow or broken applications even though everything looks “up”.
Think of a railway. The control plane is the signal room that agrees timetables and tracks. The data plane is the trains carrying passengers. The signal room can be perfect while the trains are overcrowded, or the trains can be ready while the signals are broken. You must watch both.
Different peers, same pattern
The right-hand and left-hand sides of the picture can be replaced by many things. The peer can be a hardware firewall in a branch office, a virtual router in a colocation facility, a gateway in another public cloud, or even another Google Cloud VPC with its own HA VPN gateway. The structure stays the same: gateways, tunnels, and routes.
Give resources descriptive names, such as the region, the peer location and a number. When you have a dozen tunnels, names like “mumbai-dc1-tunnel-a” will save you hours of confusion.
6Internal Working: How a Tunnel Is Built
Before any user data flows, the two gateways must introduce themselves, agree on rules and create keys. This is the work of IKE.
Phase one: building a secure conversation
The two gateways first send each other messages in the open to agree on which encryption methods they both support, and to run a mathematical exchange that lets both sides derive the same secret key without ever sending that key across the wire. Then they prove who they are, using the pre-shared key that an administrator typed in on both sides. After this step they have a protected channel for further negotiation. In IKEv2 this is called the IKE security association.
Two spies meet in a crowded cafe. They first agree on a language they both speak, then each shows a half of a torn banknote that matches the other’s, which proves identity. Only then do they lower their voices and plan the actual mission.
Phase two: creating the data tunnel
Next, within the protected channel, the gateways agree on which traffic will be sent through the tunnel and which keys will encrypt it. This creates the child security association, which uses a protocol called ESP (Encapsulating Security Payload). ESP wraps each packet in an encrypted envelope, adds a check value to detect tampering, and gives each packet a number to prevent replay attacks, where an attacker records a packet and sends it again later.
sequenceDiagram
participant P as Peer gateway
participant G as Cloud VPN gateway
P->>G: IKE_SA_INIT with supported algorithms and key exchange values
G->>P: IKE_SA_INIT with chosen algorithms and key exchange values
Note over P,G: Both sides now compute the same shared keys
P->>G: IKE_AUTH with identity and proof using pre-shared key
G->>P: IKE_AUTH with identity, proof and traffic rules
Note over P,G: Tunnel is established
P->>G: ESP encrypted data packets
G->>P: ESP encrypted data packets
Note over P,G: Keys are refreshed periodically using rekey
P->>G: Keepalive and dead peer detection messages
What goes over which port
IKE messages travel over UDP port 500. If a device in the path performs network address translation, that is, rewriting addresses on the fly, the traffic is switched to UDP port 4500 using a technique called NAT traversal. The encrypted data itself uses the ESP protocol. Firewalls on your side must allow these, or the tunnel will never come up.
Keeping the tunnel healthy
- Rekeying: Both sides replace the encryption keys on a schedule, so a stolen key has a short useful life. Mismatched lifetime settings are a common cause of brief outages.
- Dead peer detection: Small keepalive messages check that the other end is still alive. If the peer goes silent, the tunnel is marked down, and routes can fail over.
- Replay protection: Packet numbering lets the receiver discard duplicates.
Algorithms: the agreed recipe
Both ends must agree on a combination of methods for key exchange, encryption and integrity checking. Google publishes a list of supported ciphers, and recommends modern ones such as AES in Galois/Counter mode with strong key exchange groups. Using weak or obsolete settings might still connect, but weakens protection. Always check the current supported and recommended list before configuring the peer device.
| Stage | Protocol | Purpose |
|---|---|---|
| Negotiation | IKEv2 over UDP 500 or 4500 | Agree on algorithms, prove identities, create keys |
| Data protection | ESP | Encrypt and authenticate each packet |
| Route exchange | BGP inside the tunnel | Share reachable address ranges |
| Health checking | Dead peer detection, optionally BFD | Detect failures quickly |
The most common reason a tunnel will not come up is a mismatch: a different pre-shared key, a different cipher choice, a different IKE version, or a blocked UDP port. Compare both sides setting by setting.
7Routing: Static, Dynamic and BGP
A tunnel is only a road. Routing decides which traffic uses it.
Static routing
With static routing, an administrator writes down which ranges are reachable through which tunnel. It is simple and predictable, and fine for tiny, unchanging networks. But nothing adapts: if a tunnel fails, the static route may still point at it, and traffic is lost until a human fixes it. For this reason, HA VPN does not use static routes. It relies on dynamic routing.
Dynamic routing with Cloud Router
Cloud Router is a managed service that speaks BGP. It forms a BGP session with the peer router through each tunnel. The two exchange advertisements: Cloud Router tells the peer “I can reach these VPC ranges”, and the peer says “I can reach these on-premises ranges”. Routes then appear automatically, and disappear again if a session drops.
Static routing is a printed bus timetable pinned to the wall. If a road is closed, the timetable is wrong until someone reprints it. BGP is a live traffic app on every driver’s phone: the moment a road closes, all drivers are rerouted.
How BGP sessions are set up
- Each BGP session runs between two special addresses from the link-local range 169.254.0.0/16, a tiny private link used only for this conversation.
- Each side has an autonomous system number (ASN), an identity for a routing domain. Cloud Router and your peer must use different numbers, and private ranges of numbers are available for use.
- Sessions are kept alive by regular messages. If the messages stop for longer than a hold time, the session is considered down and its routes withdrawn.
- Optional BFD (Bidirectional Forwarding Detection) can detect failures in a second or so instead of tens of seconds.
Advertising the right ranges
By default, Cloud Router advertises the subnets of the VPC network. You can change this with custom advertisements, which allow you to announce additional ranges, for example a peered network’s ranges, or to announce only selected subnets. On the other side, you choose which on-premises ranges your peer announces. Advertising too much, or too little, is a frequent source of mysterious “I can ping A but not B” problems.
Dynamic routing mode: regional or global
A VPC network has a setting called dynamic routing mode. In regional mode, routes learned by Cloud Router are available only to subnets in the same region as the router. In global mode, they are available to subnets in every region of the VPC, and the VPC’s subnets in all regions are advertised to the peer. Global mode is convenient and is often needed for multi-region applications. Regional mode gives tighter control.
Priorities and choosing among tunnels
When two tunnels both lead to the same on-premises range, which is used? Two behaviors exist:
- Active/active: if routes have equal priority, traffic is shared across tunnels using ECMP (equal-cost multi-path routing), which spreads different flows over different tunnels. This adds up bandwidth and improves use of resources.
- Active/passive: if you give one set of routes a worse priority, using a value called MED, traffic uses the preferred tunnel, and the backup carries traffic only if the first fails. This is simpler to reason about but leaves the backup idle.
flowchart TB
subgraph OP["On premises"]
PR["Peer router with ASN 65001 announces 192.168.0.0/16"]
end
subgraph GC["Google Cloud"]
CR["Cloud Router with ASN 64512 announces 10.0.0.0/16"]
RT["VPC route table"]
VMS["Virtual machines"]
CR --> RT
RT --> VMS
end
PR -- "BGP session over tunnel 1" --> CR
PR -- "BGP session over tunnel 2" --> CR
CR -- "Learned 192.168.0.0/16 via tunnel 1 and tunnel 2" --> RT
Overlapping address ranges are a serious problem. If both sides use 10.0.0.0/16, neither side can tell which network a packet belongs to. Plan address ranges across your whole organization before connecting networks. Fixing an overlap later usually means renumbering or complicated translation.
8Redundancy and High Availability Topologies
Networks fail. Good design assumes every piece will fail at some point and makes sure no single failure cuts the connection.
What can fail?
- A tunnel, because of an internet path problem or a configuration change.
- A Google gateway interface, during maintenance or a fault.
- Your peer device, from hardware failure or a software update.
- Your internet connection to a provider.
- A whole site, such as an entire data center.
Peer topologies recommended for HA VPN
| Peer setup | How it connects | Protects against |
|---|---|---|
| Two peer devices, each with one interface | Each Google interface connects to a different peer device, so two tunnels | Failure of one Google interface, one peer device or one internet link |
| One peer device with two interfaces | Each Google interface connects to a different interface on the one device | Failure of a Google interface or one internet link, but not of the device itself |
| One peer device with one interface | Both Google interfaces connect to the same peer interface, two tunnels | Only Google interface failure. The peer remains a single point of failure |
| Four tunnels to a four-interface peer | Each Google interface connects to two peer interfaces | More bandwidth and more paths, as used with some other clouds |
flowchart LR
subgraph PEERS["Two peer devices in your data center"]
PA["Peer device A"]
PB["Peer device B"]
end
subgraph GW["Google HA VPN gateway"]
I0["Interface 0"]
I1["Interface 1"]
end
PA -- "Tunnel A with BGP" --> I0
PB -- "Tunnel B with BGP" --> I1
DC["Your servers"] --- PA
DC --- PB
I0 --- CRT["Cloud Router"]
I1 --- CRT
Redundancy is like having two separate roads, two cars and two drivers for an important delivery. If a road is blocked, a car breaks down, or a driver falls ill, the parcel still arrives. Having two roads but one car only protects against blocked roads.
Capacity during failure
Redundancy is not just about connection but about capacity. If two tunnels each carry 2 Gbps and one fails, can the other carry the full 4 Gbps? If not, you will keep your connection but suffer congestion. Plan so that either path alone can handle your peak traffic, or accept and document the reduced performance.
Multi-region redundancy
If a whole Google Cloud region is unavailable, the VPN in that region cannot help you. Critical designs create HA VPN gateways in two regions, with Cloud Routers and tunnels in each, and use global dynamic routing and route priorities so traffic prefers the nearest region and falls back to the other.
Many outages blamed on “the cloud” are really a single peer device in the data center. The 99.99 percent commitment covers Google’s side only, and the availability of your own device and internet line is your responsibility.
9Bandwidth, MTU and Performance
A VPN rides the public internet, so its speed has natural limits. Knowing them avoids unpleasant surprises.
Bandwidth per tunnel
Each Cloud VPN tunnel supports a maximum bandwidth of about 3 Gbps in total, counting traffic in both directions, along with a limit on the number of packets per second. These are ceilings, not guarantees. Actual throughput depends on packet sizes, encryption overhead, the capacity of your peer device, and the quality of the internet path between the two ends. Many peer devices struggle to encrypt at high speed, so the device is often the real bottleneck.
Scaling out with more tunnels
If one tunnel is not enough, you add more tunnels and use ECMP to spread traffic across them, so total bandwidth rises. There are limits on the number of tunnels per gateway and per region, so check current quotas. An important detail is that ECMP balances by flow, meaning each individual connection stays on one tunnel. A single very large file transfer will not be spread across several tunnels, but many different connections will.
Think of lanes on a motorway. Adding lanes lets more cars travel at once, but one car still goes only as fast as a single lane allows. A single huge truck cannot drive in three lanes at the same time.
MTU and why packets get stuck
The MTU (maximum transmission unit) is the largest packet size a link will carry. Ordinary networks use 1500 bytes. Inside Google Cloud, the default VPC value is lower, and the VPN adds its own wrapper, which uses additional bytes for headers. The usable packet size inside the tunnel is therefore smaller than normal. If an application sends packets that are too large, they must be split into fragments, which slows everything, or they are dropped, and the connection hangs mysteriously. A classic symptom is that small requests work, such as pinging or logging in, but large transfers stall.
The usual cure is to set the MSS (maximum segment size) so that TCP connections naturally send smaller pieces, often done on the peer device, and to follow the MTU values that Google recommends in its documentation for tunnel traffic.
A VPN puts every parcel into a bigger protective box. If the parcel was already close to the size of the doorway, the boxed parcel no longer fits. You must either repack into smaller parcels (lower MSS) or use a wider door.
Latency and jitter
Traffic over the internet takes whatever route providers choose at the moment, so delay varies. Latency, the time for a message to travel, and jitter, the variation of that time, can be higher and less predictable than on a private line. This matters for voice, video, trading and chatty database calls. Measure real round-trip times between your site and the Google Cloud region, and choose a region near your users or data center.
| Factor | Effect | What to do |
|---|---|---|
| Per-tunnel limit | Caps total throughput of one tunnel | Add tunnels and use ECMP |
| Peer device encryption speed | Often the true limit | Use hardware with enough crypto capacity |
| Packet size and MTU | Fragmentation or silent drops | Tune MSS and MTU as recommended |
| Internet path quality | Variable latency and loss | Use good providers, consider Interconnect for critical flows |
| Single large flow | Cannot exceed one tunnel’s speed | Parallelize transfers |
| Distance | Adds fixed delay | Pick the nearest region |
Test with real traffic patterns, not only a ping. Run large file transfers and your own application’s calls through the tunnel before cutover, and watch for drops and slow starts.
10Data Flow: The Life of a Packet
Let us follow a single request from an on-premises computer to a virtual machine in Google Cloud, and see where each feature plays its part.
flowchart TD
A["On-premises server sends packet to 10.0.1.5"] --> B["Peer router checks routes"]
B --> C["Route says 10.0.0.0/16 is via the VPN tunnel"]
C --> D["Peer gateway wraps packet in ESP and encrypts it"]
D --> E["Packet crosses the public internet"]
E --> F["Cloud VPN gateway receives and decrypts it"]
F --> G["Packet enters the VPC network"]
G --> H{"Firewall rules allow it?"}
H -- "No" --> I["Packet dropped and optionally logged"]
H -- "Yes" --> J["Virtual machine receives packet"]
J --> K["Reply is sent to 192.168.4.20"]
K --> L["VPC route sends reply via the tunnel"]
L --> M["Cloud VPN gateway encrypts and returns it"]
Step by step
The sender picks a destination
An on-premises application sends a packet to a private address in the VPC, such as 10.0.1.5.
The local router consults its table
A route learned by BGP, or entered by hand, says that this range lies behind the VPN, so the packet is handed to the VPN device.
Encryption and wrapping
The VPN device encrypts the packet with the keys agreed during IKE, and wraps it in a new packet addressed to Google’s gateway.
Travel across the internet
Internet routers see only an encrypted packet from one gateway address to another. The contents and the inner addresses stay hidden.
Decryption at Google
The Cloud VPN gateway checks the packet’s authenticity, decrypts it, and removes the wrapper.
Entry into the VPC
The original packet is released into the VPC, where it is checked against firewall rules, just like traffic from any other source.
Delivery and reply
The virtual machine receives the packet. Its reply is routed back by the VPC to the tunnel, encrypted, and returned to the on-premises sender.
It is like sending a registered package through an armored courier. At the sender’s mailroom the package is sealed in a steel case, driven along public roads where nobody can see inside, unsealed at the receiving mailroom, and handed to the correct desk after the receptionist checks the visitor list (the firewall).
Symmetry matters
The reply must come back through the same VPN, or at least through a VPN that the original side recognizes. If the reply leaves through a different path, such as straight to the internet or through another tunnel that the peer’s firewall does not expect, connections break. This is called asymmetric routing, and it is a classic cause of connections that start but never complete.
When something does not work, trace the packet in both directions: out and back. Check routes on the sending side, routes in the VPC, firewall rules on both ends, and the return path. Almost every failure is found in one of those four places.
11Firewall Rules and Access Control
A tunnel opens a road between two networks. Firewalls and permissions decide who may use it.
The VPN does not bypass the firewall
Traffic coming out of a VPN tunnel into your VPC is treated like traffic from any other source. VPC firewall rules still apply. By default, a VPC network blocks all incoming connections unless a rule allows them. So after you build a perfect tunnel, you will still need a rule that says “allow traffic from the on-premises range to these virtual machines on these ports”. Forgetting this is one of the most common reasons that a working tunnel seems broken.
Building a private corridor between two offices does not mean visitors can walk into any room. Each office still has a receptionist with a guest list. The corridor only gets people to the lobby.
Writing good firewall rules for VPN traffic
- Be specific about sources: use the on-premises ranges as the source, not “anywhere”.
- Be specific about destinations: target particular virtual machines using tags or service accounts, not every machine.
- Be specific about ports: allow only what is needed, such as database or web ports, rather than all traffic.
- Think in both directions: VPC rules control incoming traffic to cloud machines. If you restrict outgoing traffic, also allow replies and outgoing calls to on-premises.
- Use firewall policies at the organization or folder level for common rules, such as blocking risky ports from on-premises ranges everywhere.
- Turn on firewall logging for key rules, so you can see allowed and denied connections.
The on-premises side
The peer’s firewall must permit the IKE and ESP traffic that builds the tunnel, and must also allow the traffic inside it. Many data centers have security policies that treat VPN traffic as a separate zone. Make sure policies in that zone are reviewed, and not simply “allow any”.
Who can manage the VPN itself?
Google Cloud Identity and Access Management controls who can create or change gateways, tunnels, routers and routes. Network administrators need powerful roles, such as the Compute Network Admin role. Others should have read-only roles. Changing a tunnel’s settings or deleting it can take down production connectivity within seconds, so restrict these permissions to a small group and review them regularly.
| Control | What it protects | Where it applies |
|---|---|---|
| VPC firewall rules | Which cloud machines may receive traffic from on premises | Google Cloud VPC |
| Hierarchical firewall policies | Company-wide rules applied across many projects | Organization or folder |
| On-premises firewall | Which internal systems may talk to the cloud | Your data center |
| IAM roles | Who can create, change or delete VPN resources | Google Cloud project and organization |
| Custom route advertisements | Which ranges are exposed over BGP | Cloud Router and peer router |
| Application-level security | Who may use each service, regardless of network | The applications themselves |
Do not treat the VPN as a trusted zone where everything is allowed. If one on-premises machine is compromised, a broad “allow all from on premises” rule lets the attacker roam through your cloud. Apply least privilege on both sides.
12Security: Encryption, Keys and Hardening
A VPN exists to protect data in motion. Here are the layers that make that protection real.
Think of an armored van. The metal body (encryption) protects the cargo, the locks and keys (pre-shared key and authentication) decide who can open it, the guards’ roster (firewalls and IAM) controls who may ride, and the cameras (logs) record every trip.
Strong encryption and modern algorithms
Cloud VPN uses IPsec with encryption and integrity checks. Choose current, recommended algorithms, such as AES with Galois/Counter mode and strong key exchange groups, and disable old ones that are known to be weak. IKEv2 is required for HA VPN and is generally more robust and secure than the older IKEv1.
Pre-shared key hygiene
The pre-shared key is the secret by which the two ends recognize each other. A weak or leaked key lets an attacker try to impersonate a gateway. Good habits:
- Use a long random key, not a word or phrase. Google can generate one for you.
- Use a different key for each tunnel.
- Store keys in a secret manager and not in emails, chat messages or documents.
- Rotate keys on a schedule and after staff changes.
- Share keys over a secure channel, never in plain text.
Perfect forward secrecy
With perfect forward secrecy, every rekey creates fresh keys that are mathematically unrelated to previous ones. If an attacker somehow gets the key for today’s traffic, they still cannot decrypt yesterday’s recorded traffic. Make sure it is enabled on both ends, using the supported groups.
Limit exposure and blast radius
- Advertise the minimum ranges needed over BGP.
- Segment networks: use separate VPCs, or separate tunnels, for production and test, or for different business units.
- Apply organization policies to restrict who can create VPN resources and where.
- Keep the peer device secure: patch it, restrict administrative access, and monitor it. A compromised VPN device is a direct door into your cloud.
- Protect against route hijacking: filter routes accepted from the peer so that a mistake or attack cannot redirect your traffic.
Encryption is not everything
A VPN protects data while it crosses the internet. It does not protect data at rest, it does not stop a compromised machine inside the tunnel from sending harmful traffic, and it does not replace application security such as sign-in and authorization. Keep these in mind and treat the VPN as one layer of defense.
Logging and auditing
Cloud Logging records VPN gateway and tunnel events, such as tunnel establishment, IKE negotiation messages and errors. Admin activity audit logs record who changed what. Send alerts for tunnel flaps, unexpected configuration changes and BGP session drops. Keep logs long enough for investigations and compliance.
| Threat | Main defenses |
|---|---|
| Eavesdropping on the internet path | IPsec encryption with strong algorithms |
| Fake gateway pretending to be your peer | Strong pre-shared keys, IKEv2 authentication, restricted peer addresses |
| Stolen or leaked key | Unique keys per tunnel, rotation, secret manager storage, forward secrecy |
| Wrong or malicious routes accepted | Route filtering, limited advertisements, monitoring |
| Compromised on-premises machine reaching the cloud | Least-privilege firewall rules, segmentation, application authentication |
| Accidental or malicious change to VPN resources | Narrow IAM roles, audit logs, change review, infrastructure as code |
| Denial of service on the gateway addresses | Google’s network protections, redundancy, allowed peer IP filtering where possible |
Sharing one pre-shared key across every tunnel and every site means one leak exposes them all. Use unique keys, and store them as carefully as you store passwords to production systems.
13VPC-to-VPC and Multi-Cloud Connections
Cloud VPN is not only for connecting to physical offices. It also joins cloud networks to each other.
Google Cloud VPC to Google Cloud VPC
Two VPC networks can be joined by creating an HA VPN gateway in each and connecting them with tunnels. Both sides are managed in Google Cloud, so there are no third-party devices to configure. This is useful when VPC peering is not suitable, for example when you need to connect networks with overlapping features, need encryption between them, or need to control routing in detail. Peering is usually simpler and faster when it fits, but a VPN gives you the control that peering does not.
VPC peering is a door cut directly between two neighboring offices: fast and simple, but with limited rules. A VPN between two VPCs is a secure courier service between them: slightly more setup, but with more control over routes and encryption.
Connecting to another cloud provider
Companies using two or more clouds often connect them with VPN. The pattern is identical: a gateway on each cloud, tunnels between them, and BGP to exchange routes. Because each cloud has its own naming and its own details, the main tasks are matching the cipher settings, and configuring each side’s route tables and security rules. Google publishes guides for connecting to common providers. A typical arrangement uses four tunnels to match the number of interfaces on the other side’s gateway and to reach full redundancy.
Connecting a branch or a store
Small sites such as shops or branch offices can use a normal internet connection with an IPsec-capable router. With dozens or hundreds of sites, automation becomes essential: use templates and infrastructure as code to create tunnels consistently. For many small sites, you can also connect them through a hub, as described in the next chapter.
Typical multi-cloud checklist
Plan non-overlapping ranges
Give each cloud’s networks unique ranges before creating anything.
Create gateways on both sides
Use high availability gateways with redundant interfaces on both clouds.
Match security settings
Agree on IKE version, ciphers, lifetimes and keys. Use a unique key per tunnel.
Configure BGP
Choose different private ASNs, set up link-local addresses, and verify route exchange.
Open firewalls
Allow only the necessary traffic in each cloud’s firewall or security group.
Test and fail over
Check connectivity in both directions, then deliberately disable one tunnel to verify automatic failover.
Data leaving a cloud provider is usually charged as egress, in both directions across a multi-cloud link. A chatty design between clouds can be surprisingly expensive, so keep heavy data close to where it is used.
14Hybrid Design Patterns: Hub and Spoke, Shared VPC and Transit
When you have many networks, you need a design that stays understandable as it grows.
Hub and spoke
In a hub-and-spoke design, one central VPC, the hub, holds the VPN connection to on premises. Several other VPCs, the spokes, connect to the hub and use its VPN to reach on-premises. This avoids building a separate VPN for every spoke, centralizes security controls and keeps costs down.
flowchart TB
DC["On-premises data center"] -- "HA VPN tunnels" --> HUB
subgraph GCP["Google Cloud"]
HUB["Hub VPC with HA VPN and Cloud Router"]
S1["Spoke VPC: production"]
S2["Spoke VPC: development"]
S3["Spoke VPC: data platform"]
HUB --- S1
HUB --- S2
HUB --- S3
end
FW["Central inspection and firewall rules"] --- HUB
The transitivity trap
A surprise that catches many beginners is that routing is not automatically transitive across VPC peering. If the hub is peered with a spoke, the spoke can reach the hub’s own subnets, but it does not automatically learn routes that the hub learned from the VPN. By default, the spoke cannot reach on-premises through the hub. Two common ways to solve this are:
- Custom route export and import: the hub exports its custom and dynamic routes over the peering, and the spokes import them. Cloud Router also advertises the spoke ranges to on-premises using custom advertisements.
- Network Connectivity Center: a Google Cloud service that acts as a managed hub, letting VPN tunnels and other spokes connect and exchange routes, including transit between on-premises sites over Google’s network.
Think of friends passing messages. If A can speak to B, and B can speak to C, A still cannot speak to C unless B agrees to pass messages along. Transit routing is B agreeing to forward.
Shared VPC
With Shared VPC, one project, the host project, owns the network and the VPN resources, while other projects, the service projects, run their virtual machines in subnets of that network. This lets many teams use one VPN connection without each building their own, while keeping central control of networking and security. It is a very common enterprise pattern.
Site-to-site data transfer through Google
With Network Connectivity Center, you can connect multiple on-premises sites, each with its own VPN to Google Cloud, and let them exchange data with each other across Google’s backbone network instead of the public internet. That makes Google’s network act as a private wide-area network between your sites.
| Pattern | Best for | Watch for |
|---|---|---|
| Single VPC with VPN | Small, simple environments | Hard to grow, mixes environments |
| Shared VPC with VPN in host project | Many teams in one organization | Central team becomes a dependency |
| Hub and spoke with peering | Several VPCs needing shared connectivity | Route export and import settings, limits on peering |
| Hub with Network Connectivity Center | Many sites, transit routing, large scale | Learning the service’s model and limits |
| Separate VPN per VPC | Strong isolation requirements | Cost and operations multiply |
Decide your overall network layout before building tunnels. Retrofitting a hub design into a patchwork of one-off VPNs is more work than starting with a plan.
15Cloud VPN Versus Cloud Interconnect and Other Options
VPN is one of several ways to connect to Google Cloud. Choosing well depends on bandwidth, reliability, cost and urgency.
The main choices
- Cloud VPN: encrypted tunnels over the public internet. Quick, low cost, moderate bandwidth.
- Cloud Interconnect, Dedicated: a physical connection from your network to Google at a colocation facility, with high capacity and consistent performance.
- Cloud Interconnect, Partner: a connection through a supported service provider, for places where you cannot reach Google’s facility directly, with a wide range of capacities.
- Cross-Cloud Interconnect: a dedicated link between Google Cloud and another cloud provider.
- Direct and carrier peering: ways to reach Google’s public services over a more direct path, but not for private VPC addresses.
| Question | Cloud VPN | Cloud Interconnect |
|---|---|---|
| Path | Public internet, encrypted | Private physical link |
| Setup time | Minutes to hours | Days to weeks |
| Bandwidth | Around 3 Gbps per tunnel, scalable with more tunnels | From tens of Mbps with partners up to 10 and 100 Gbps links, and beyond with bundles |
| Latency and jitter | Variable, depends on the internet | More predictable |
| Encryption | Built in with IPsec | Not encrypted by default, optional with HA VPN over Interconnect or other methods |
| Cost | Lower, pay per tunnel and traffic | Higher for ports and circuits, but lower data transfer rates |
| Typical use | Starting out, small sites, backup, moderate data | Heavy data movement, steady production traffic, strict performance needs |
Cloud VPN is sending armored vans along public roads: quick to arrange and cheap, but subject to traffic jams. Cloud Interconnect is building a private railway between your factory and Google: it costs more and takes time to build, but trains run on a dedicated track on schedule.
Using them together
- VPN as backup for Interconnect: if the physical link fails, traffic fails over to VPN tunnels using route priorities. It is a cost-effective way to add resilience.
- HA VPN over Interconnect: runs IPsec tunnels across an Interconnect connection to add encryption where required by policy.
- VPN first, Interconnect later: start with VPN to get going, then add Interconnect when traffic grows.
Remote access for individuals is different
If you want employees to reach cloud resources from home, Cloud VPN is not the right tool, since it joins networks, not people. Options include identity-aware access to applications and administration tools, and client VPN software running on a virtual machine. Choose based on whether you need to reach a few applications or a whole network.
A good rule of thumb: if you move a few hundred megabits or less, and can tolerate some variability, VPN is very comfortable. If you push several gigabits constantly, or need steady latency, price out Interconnect.
16Setting Up an HA VPN Connection, Step by Step
This chapter explains the order of work in plain words, so you understand what each step is for. Exact screens and commands change, so always follow the current documentation as you build.
flowchart TD
A["Plan ranges, regions, peer type and redundancy"] --> B["Create or choose the VPC network"]
B --> C["Create a Cloud Router with an ASN"]
C --> D["Create the HA VPN gateway in the region"]
D --> E["Describe the peer gateway as an external VPN gateway"]
E --> F["Create tunnels: one per Google interface"]
F --> G["Configure the peer device with matching settings"]
G --> H["Create BGP sessions on Cloud Router"]
H --> I["Configure BGP on the peer device"]
I --> J["Add firewall rules for on-premises ranges"]
J --> K["Test connectivity, performance and failover"]
K --> L["Add monitoring, alerts and documentation"]
Plan first
Choose the region closest to your site. List all address ranges on both sides and confirm there is no overlap. Decide the redundancy design: how many peer devices and interfaces you have, and what bandwidth you need. Pick ASNs and a naming scheme.
Create the Cloud Router
Create it in the VPC and region, with its own private ASN. It will speak BGP for you.
Create the HA VPN gateway
Google allocates two external IP addresses, one per interface. Note them, because the peer device needs them.
Describe the peer
Tell Google about your peer gateway: its public addresses and how many interfaces it has, so Google knows the redundancy type.
Create the tunnels
Create one tunnel on each Google interface, giving each a strong shared secret and selecting IKEv2.
Configure the peer device
On your router or firewall, create matching tunnels using Google’s IP addresses, the same shared secret, and compatible cipher settings. Allow the IKE ports.
Bring up BGP
Create a BGP session on Cloud Router for each tunnel, using link-local addresses and the peer’s ASN, and mirror it on the peer device. Check that sessions reach the established state and that routes are exchanged.
Firewall and verify
Create VPC firewall rules for the on-premises ranges. Test with simple pings, then with real application traffic, then with large transfers.
Test failure on purpose
Bring down one tunnel and confirm that traffic continues on the other. Repeat for the other tunnel. Time how long the switch takes.
Document and monitor
Record addresses, ASNs, keys’ storage locations, contacts and runbooks. Create dashboards and alerts.
Setting up a VPN is like opening a new branch with a private courier route. You first agree on addresses, then build the mailroom, exchange secret handshakes with the other mailroom, publish the address books, and finally send a few test parcels in both directions, including a test of what happens when one road is closed.
Infrastructure as code
Once you understand the steps, capture them in a tool such as Terraform. Written definitions are repeatable, reviewable and ideal for creating the same design in a test environment. They also leave a history of exactly what was changed, which is valuable when something goes wrong at midnight.
Build a test connection in a sandbox project before the real one. Practicing once with nothing at stake makes the production build calm and quick.
17Monitoring, Logging and Alerts
A tunnel that nobody watches is a tunnel that will fail quietly. Observability makes problems visible early.
What to measure
| Signal | What it tells you | Warning sign |
|---|---|---|
| Tunnel status | Whether each tunnel is established | Any tunnel not established |
| BGP session status | Whether routes are being exchanged | Session down or flapping |
| Number of learned and advertised routes | Whether expected ranges are present | Sudden drops or surprise increases |
| Bandwidth in and out | Load on each tunnel | Near the per-tunnel limit |
| Packet counts and drops | Health of the data path | Rising drops or discards |
| Round-trip time | Latency over the path | Spikes or steady creep |
| Tunnel flaps and rekey events | Stability | Frequent re-establishment |
| Configuration changes | Who touched what | Unexpected edits |
The tools
- Cloud Monitoring: gives metrics for gateways, tunnels and Cloud Router, with dashboards, uptime-style checks and alert policies.
- Cloud Logging: collects VPN gateway logs, including IKE negotiation messages, which are invaluable when tunnels refuse to come up.
- Audit logs: record administrative changes to VPN resources.
- VPC Flow Logs: sample the traffic flowing through the VPC, showing which on-premises addresses talk to which cloud machines.
- Firewall logs: show which connections were allowed or blocked.
- Network Intelligence Center: includes connectivity tests that analyze configuration and trace a hypothetical packet path, and topology views that show your network visually.
- The peer device’s own monitoring: do not forget it. Many problems begin on that side.
Think of monitoring as a railway control room. Lights show whether each track is open, counters show how many trains are on each line, and the log book records every signal change. When something goes wrong, the controller can see where and when.
Alerts worth having
- Tunnel down for more than a short period.
- BGP session down or flapping repeatedly.
- Only one healthy tunnel remains, meaning redundancy is lost even though service continues. This is easy to miss and important to catch.
- Bandwidth above 70 to 80 percent of the planned capacity for a sustained time.
- Route count changes outside expected limits.
- Configuration changes to VPN resources outside change windows.
Alert on “lost redundancy”, not only on “total outage”. A system running on one of two tunnels looks healthy to users but is one failure away from an incident. Fix it while there is no pressure.
18Troubleshooting Common Problems
Most VPN problems fall into a few families. Work from the bottom up: tunnel, then routes, then firewalls, then applications.
| Symptom | Likely causes | First things to check |
|---|---|---|
| Tunnel will not establish | Mismatched pre-shared key, mismatched IKE version or ciphers, peer address wrong, UDP 500 or 4500 blocked, NAT problems | Gateway logs for IKE errors, peer device logs, both sides’ settings, firewall on the peer side |
| Tunnel up but BGP session down | Wrong link-local addresses, wrong ASN, BGP not allowed inside the tunnel, authentication mismatch | BGP configuration on both sides, Cloud Router status messages |
| BGP up but no routes learned | Peer not advertising, route filters, wrong advertised ranges | Cloud Router learned routes, peer’s advertised list, filters |
| Routes present but cannot reach VMs | VPC firewall rules missing, on-premises firewall blocking, wrong destination | Firewall rules and logs, connectivity tests |
| Small packets work, large ones hang | MTU or MSS problem | Lower MSS on the peer device, test with different packet sizes |
| One direction works, the other does not | Asymmetric routing, missing return route, one-way firewall | Return path routes on both sides |
| Tunnel flaps often | Rekey mismatch, unstable internet link, device overload, dead peer detection too aggressive | Lifetime settings, link quality, device CPU |
| Slow throughput | Per-tunnel cap, peer device limit, MTU fragmentation, single flow | Bandwidth graphs, add tunnels, parallel transfers |
| Spokes cannot reach on premises | Transitive routing not enabled, missing custom route exchange | Peering import and export settings, custom advertisements |
| Cannot reach after adding a site | Overlapping ranges | Address plan for conflicts |
A calm troubleshooting method
What changed?
Ask about recent changes on either side: new rules, new devices, firmware updates, key rotations, new address ranges.
Check the tunnel
Is it established? If not, read the IKE logs on both sides for the error reason.
Check BGP and routes
Is the session established? Are the expected routes learned and advertised?
Check firewalls and the return path
Use firewall logs and connectivity tests to see if packets are dropped, and verify the reply route.
Check the application
Only when the network checks pass, look at name resolution, ports, and the application itself.
It is like figuring out why a phone call is failing. First check that the phone is plugged in (tunnel), then that you dialed the right area code (routes), then that the person is allowed to receive calls (firewall), and only then wonder whether they are simply not answering (the application).
Keep the logs of both sides side by side, aligned by time. A tunnel failure always has two stories, and the matching timestamps often reveal who spoke first and what they said.
19Failure Scenarios, Maintenance and Recovery
Plan for what happens on the bad days, because they will come.
Walk through the failures
| Failure | What happens in a good design | Your action |
|---|---|---|
| One tunnel drops | BGP withdraws its routes, traffic moves to the other tunnel within seconds to a minute | Investigate cause, restore redundancy |
| Google gateway interface under maintenance | The other interface carries traffic | None, but confirm via monitoring |
| Peer device fails | The second device’s tunnel carries traffic | Repair or replace the device |
| Internet provider outage at your site | A second provider’s tunnel, if available, takes over | Contact provider, consider multi-provider design |
| Whole Google Cloud region unavailable | Gateways in a second region take over, if designed | Verify application failover too |
| Wrong route advertised by mistake | Traffic is black-holed or sent the wrong way | Roll back the route change, use route filters in future |
| Pre-shared key suspected leaked | Tunnel remains up until changed | Rotate the key on both sides together |
Maintenance
Google periodically performs maintenance on VPN gateways. With HA VPN, only one interface is updated at a time, so correctly built redundant tunnels continue to carry traffic. During the short moment of switching, a few packets may be lost and some connections may reset. Applications should therefore retry briefly. On your side, plan firmware upgrades for peer devices one device at a time, never both together.
Recovery targets in plain words
Think about how long you can tolerate disconnection and how much traffic loss you can accept. If your application cannot survive even a minute of lost connectivity, you need redundant paths, fast failure detection with BFD, and applications with retry logic. If a short outage is acceptable, a simpler setup may be enough.
Think of a fire drill. The point is not that fires are frequent, but that when one happens, everyone already knows where the exits are and how long it takes to leave. Failover tests do the same for your network.
Practice failover
- Disable each tunnel in turn during a quiet period and measure the switch time.
- Simulate a peer device failure by shutting down its interface.
- Confirm that monitoring raised the right alerts and that the people on call knew what to do.
- Update runbooks with real timings and lessons.
A failover that has never been tested is a hope. Many teams discover during a real outage that their backup tunnel was never carrying routes, or that their firewall rules only allowed one of the two paths.
20Cost and Pricing Basics
Cloud VPN is one of the cheaper ways to connect networks, but costs still deserve attention.
What you pay for
Per tunnel per hour
Each tunnel is billed for the hours it exists. Redundant designs have at least two tunnels, and more for multi-cloud or higher capacity.
Data leaving Google Cloud
Traffic sent from Google Cloud through the tunnel to your site is charged as network egress, with rates depending on regions and destinations. Traffic arriving into Google Cloud is generally not charged.
Cloud Router
Cloud Router itself is not usually a significant cost, but check current rules.
Gateway addresses
Gateway addresses are part of the service. Check whether reserved addresses might incur charges.
Your peer and internet
Your own hardware, licences, bandwidth and any charges from other clouds are separate.
Operational effort
Time spent configuring, monitoring and troubleshooting is a real cost that is easy to forget.
Prices change and differ by region, so use Google’s current pricing page and calculator for exact figures. In many setups, the tunnel fees are small, and the egress traffic is the main driver.
Think of a courier contract. You pay a small monthly fee for each route that is kept open, plus a charge per parcel sent out. Parcels coming in are free, but heavy outbound shipments add up quickly.
Ways to spend less
- Right-size the number of tunnels. Two redundant tunnels are enough for many cases. Do not build ten unless you need the bandwidth.
- Reduce egress. Keep heavy data processing close to where data lives, compress data, cache results and avoid chatty calls across the link.
- Choose regions wisely. Rates and latency differ. Placing workloads in the same region as the gateway avoids extra inter-region transfer.
- Move bulk transfers to Interconnect if you constantly send many terabytes, since lower data transfer rates may outweigh port fees.
- Remove unused tunnels from old projects and experiments.
- Label and track costs by project and environment.
A backup job that copies a large database across the VPN every night can quietly become the biggest line on the bill. Estimate data volume before you decide the path of each flow.
21Advantages, Disadvantages and Trade-offs
An honest view of strengths and limits helps you decide when Cloud VPN is the right connection and when it is not.
Advantages
- Quick to set up: minutes or hours, with no cables or provider lead time.
- Encrypted by default using IPsec.
- Managed gateway service on Google’s side, with a 99.99 percent availability commitment for HA VPN when built redundantly.
- Low entry cost, with no upfront hardware.
- Works over any internet connection and with many standard devices and clouds.
- Dynamic routing with BGP gives automatic failover and updates.
- Scalable by adding tunnels and using ECMP.
- Good backup path for Interconnect.
Disadvantages
- Rides the public internet, so latency and jitter vary.
- Per-tunnel bandwidth limit of about 3 Gbps.
- Peer device performance and configuration can be the bottleneck.
- Single large flows cannot be spread over multiple tunnels.
- Configuration mistakes, such as mismatched settings, MTU or routes, are easy to make.
- Egress charges apply for data leaving Google Cloud.
- Not a remote-access solution for individual users.
- Transit routing needs extra design.
Choosing a connection style
| Need | Good fit | Why |
|---|---|---|
| Quick start, small or medium bandwidth, encryption needed | HA VPN | Fast, encrypted, affordable |
| Steady multi-gigabit traffic, predictable latency | Cloud Interconnect | Dedicated capacity and a consistent path |
| Resilient hybrid with cost control | Interconnect with VPN backup | High performance normally, encrypted fallback |
| Connect two Google Cloud networks simply | VPC peering | Simple, fast, no gateway to manage |
| Connect two Google Cloud networks with encryption or route control | HA VPN between VPCs | Control over routing and encryption |
| Many sites needing transit | Network Connectivity Center | Managed hub and spoke |
| Remote employees reaching specific apps | Identity-aware access | Per-application access, no network-wide trust |
Think of getting goods to a new shop. Hiring an armored van service (VPN) can start tomorrow and costs little. Building your own rail line (Interconnect) is expensive and slow, but moves enormous loads reliably. Many businesses start with vans and later add a railway for the heavy goods, keeping the vans as a backup.
You trade guaranteed performance for speed and low cost. If your traffic can handle the internet’s moods, VPN is hard to beat.
22Design Patterns and Anti-patterns
Patterns are proven solutions. Anti-patterns look reasonable but lead to pain.
Patterns worth knowing
Two tunnels, two interfaces, two devices
The standard recipe for removing single points of failure on both sides.
Dynamic routing everywhere
Use BGP instead of static routes, so failures and changes update themselves.
Hub VPC with shared connectivity
One central VPC owns the VPN and serves many spokes, centralizing security.
Interconnect with VPN backup
Primary traffic on the fast private link, an encrypted VPN as insurance.
Address plan first
Maintain a company-wide register of ranges so that new networks never overlap.
Infrastructure as code
Define tunnels and routers in version-controlled templates, so every environment is the same.
Multi-region gateways
Gateways and routers in two regions, with route priorities for preferred paths and fallback.
Least-privilege firewall policy
Only the needed sources, destinations and ports are open across the tunnel.
Anti-patterns to avoid
What it looks like
One tunnel to one peer device, labeled “high availability” because the gateway type is HA VPN.
Why it hurts
A single tunnel and a single device mean any fault causes an outage, and the 99.99 percent commitment does not apply.
Better approach
Build two tunnels on both interfaces to a redundant peer, with BGP, and test the failover.
What it looks like
Using the same private address range on premises and in the cloud, hoping to fix it later with translation.
Why it hurts
Routing becomes ambiguous, and workarounds add fragile complexity that is hard to debug.
Better approach
Plan unique ranges from the start. If you inherit overlap, renumber one side or isolate the overlapping part carefully.
What it looks like
A firewall rule that allows all traffic from all on-premises ranges to all cloud machines, because “the VPN is trusted”.
Why it hurts
One compromised office machine gets access to every cloud system, and audits cannot show who needed what.
Better approach
Allow specific sources to specific destinations and ports, and segment the network.
What it looks like
Static routes entered by hand across many sites, with the pre-shared key written in a shared document.
Why it hurts
Routes go stale after changes, failover does not work, and the key leaks to anyone with document access.
Better approach
Use dynamic routing, store keys in a secret manager, and rotate them regularly.
What it looks like
Pushing terabytes of bulk data over a VPN every night, and treating it as unlimited capacity.
Why it hurts
Tunnels saturate and interactive traffic suffers, while egress charges accumulate.
Better approach
Schedule and throttle bulk transfers, use Interconnect or transfer services for large volumes, and keep heavy processing near the data.
23Best Practices and Common Mistakes
If you remember only one chapter for real work, make it this one.
A practical order of work for a production connection
Agree on an address plan
Reserve unique ranges for every network and record them in one place.
Choose HA VPN with dynamic routing
Use two tunnels on both interfaces, to redundant peer devices, with BGP.
Use strong security settings
IKEv2, modern ciphers, forward secrecy, unique long pre-shared keys stored in a secret manager.
Size for failure
Make sure either path alone can carry your peak load, or document the reduced capacity.
Tune MTU and MSS
Follow Google’s recommendations so large transfers do not stall.
Write least-privilege firewall rules
Limit sources, destinations and ports on both sides.
Monitor and alert
Dashboards and alerts for tunnels, BGP, bandwidth, lost redundancy and changes.
Automate and rehearse
Define everything as code, and practice failover and key rotation regularly.
Common mistakes beginners make
- Building one tunnel and believing the connection is redundant.
- Overlapping address ranges between networks.
- Forgetting VPC firewall rules and blaming the tunnel.
- Mismatched settings between the two ends, such as key, IKE version, lifetimes or ciphers.
- Ignoring MTU until large transfers fail.
- Using static routes and expecting automatic failover.
- Assuming routes pass through peering without exporting and importing custom routes.
- One peer device, one internet provider, or both tunnels on the same line.
- Sharing one key across all tunnels and sites.
- No alert for lost redundancy, so the second failure becomes the outage.
- Upgrading both peer devices at once during maintenance.
- Leaving Classic VPN in place without a migration plan.
Turn this chapter into a launch checklist and review it before every new connection. Most incidents come from skipping a basic step, not from exotic failures.
24Real-World Usage Patterns
Here are the common ways organizations use Cloud VPN, based on typical industry practice. Google publishes customer stories for named examples, and you should consult them for current details.
Retail chains and branch networks
Stores need to reach central inventory, payment and loyalty systems that run in the cloud. Each store, or each regional hub, uses an internet connection with an IPsec router, connecting to a hub in Google Cloud. Automation creates tunnels consistently, and dashboards show which stores are connected.
Banks and insurers moving gradually
Financial firms keep core systems in their own data centers while building new digital services in the cloud. HA VPN provides encrypted links with strict firewall rules, dynamic routing and detailed logs, often with Interconnect added later for heavy traffic and VPN retained as a backup.
Migration projects
During a move to the cloud, applications and data are transferred in stages while old and new systems must talk to each other. A VPN is quick to set up, supports the temporary phase, and can be removed or downsized after the migration finishes.
Multi-cloud integrations
Companies with services in two clouds connect them using HA VPN, with four tunnels to match the other cloud’s gateway design. This is common for shared data services, identity systems or disaster recovery copies.
Software vendors serving enterprise customers
A vendor hosting an application in Google Cloud may need a private connection to each large customer’s network. Separate VPCs and tunnels per customer give isolation, and careful address planning or translation handles overlapping customer ranges.
Backup and disaster recovery
Organizations replicate data from their data centers to Google Cloud over VPN for off-site backup, or keep a warm standby environment that they can activate if their primary site is lost. Bandwidth planning and scheduling keep daily work unaffected.
Hybrid development and testing
Developers in the cloud need to reach test databases and internal services that remain on premises. A VPN with narrow firewall rules provides safe access without exposing those services to the internet.
25Advanced Topics: DNS, IPv6, BFD, NAT and Migration From Classic
Once the basics are solid, a few extra topics make hybrid networks smoother and more robust.
Name resolution across the tunnel
Machines are usually reached by name, such as “billing.internal”, not by number. Both sides need to resolve each other’s names. Cloud DNS supports forwarding zones, which send questions about on-premises names to your internal DNS servers, and inbound server policies, which allow your on-premises servers to ask Google Cloud for names of cloud machines. Without DNS set up, the tunnel works for numbers but applications fail with confusing “host not found” messages.
DNS is the phone book. A tunnel gives two offices a private road, but if neither has the other’s phone book, employees cannot look anyone up by name. Forwarding zones are exchanging copies of the phone books.
IPv6 and dual stack
As the internet moves to IPv6, HA VPN supports dual-stack setups where tunnels carry both IPv4 and IPv6 traffic, with BGP exchanging both kinds of routes. If your organization is adopting IPv6, plan address ranges and firewall rules for both families, and verify that your peer device supports it.
Faster failure detection with BFD
BGP normally notices a dead peer only after a hold timer expires, which can take tens of seconds. Bidirectional Forwarding Detection sends tiny, frequent probes and can declare a path dead in about a second. It speeds up failover but can cause false alarms on noisy links, so tune thresholds with testing.
NAT and the peer behind a router
Sometimes the peer device sits behind another device that performs address translation. IPsec can still work using NAT traversal, which encapsulates the traffic in UDP port 4500. Make sure the translating device allows it and keeps the mapping alive.
Network Connectivity Center and site-to-site transit
For organizations with many offices, Network Connectivity Center can use VPN tunnels as spokes. It lets sites exchange traffic through Google’s network and share routes in a managed way, avoiding a tangle of one-to-one tunnels.
Migrating from Classic VPN to HA VPN
flowchart TD
A["Inventory Classic tunnels, routes and peers"] --> B["Design HA VPN with two tunnels and BGP"]
B --> C["Create HA gateway, Cloud Router and tunnels in parallel"]
C --> D["Configure peer for new tunnels and BGP"]
D --> E["Verify routes and test traffic"]
E --> F{"Is HA VPN healthy?"}
F -- "No" --> G["Fix and retest"]
G --> E
F -- "Yes" --> H["Shift traffic: prefer HA routes over Classic"]
H --> I["Watch for a stable period"]
I --> J["Remove Classic tunnels, routes and gateway"]
Building the new connection beside the old one means you can test without risk, prefer the new routes using priorities, and keep the old tunnels as a fallback until you are confident. Pay attention to address ranges and static routes that referred to the old gateway, and plan the work according to Google’s current deprecation timeline.
Operating at scale
- Quotas: know the limits on tunnels, routes and BGP sessions, and request increases early.
- Route limits: too many advertised routes can exceed limits, so summarize ranges where possible.
- Change control: treat routing and tunnel changes as production changes with review and rollback plans.
- Documentation: keep diagrams, address plans and contact details up to date.
Summarize routes. Advertising one range for a whole region is simpler and safer than advertising hundreds of small ones, and it stays well within the limits.
26Frequently Asked Questions
27Summary and Key Takeaways
Cloud VPN gives you a fast, affordable and encrypted way to join your networks to Google Cloud over the public internet. HA VPN, the recommended type, uses two interfaces, IKEv2 and dynamic routing through Cloud Router, and offers a strong availability commitment when built with two tunnels and a redundant peer. Behind the scenes, IKE builds keys, ESP wraps each packet, and BGP keeps routes current, so failures are handled automatically. Performance is bounded by per-tunnel limits, your peer device and the internet path, which makes MTU tuning, extra tunnels and sometimes Interconnect important. Security depends on strong settings, unique keys, least-privilege firewall rules and careful route control. With a good address plan, monitoring for lost redundancy, rehearsed failover and automation, a VPN becomes a dependable bridge between your worlds.
Key Takeaways
- Cloud VPN joins networks, not people. It builds IPsec tunnels between your network and your VPC over the internet, and is not a client remote-access tool.
- Use HA VPN. Two interfaces, IKEv2 and BGP routing through Cloud Router. Classic VPN is deprecated and should be migrated away.
- Redundancy must be built. Two tunnels on both interfaces to a redundant peer earn the availability commitment. Your own device and internet line remain your responsibility.
- Plan addresses and routes first. Unique, non-overlapping ranges, summarized advertisements, and awareness that peering routes are not automatically transitive.
- Mind the limits. About 3 Gbps per tunnel, flow-based load sharing, MTU overhead and variable internet latency. Add tunnels, tune MSS, or consider Interconnect.
- Secure every layer. Modern ciphers, forward secrecy, unique rotated keys, least-privilege firewalls, narrow IAM roles and audit logs.
- Observe and rehearse. Alert on lost redundancy and BGP changes, automate with code, and practice failover so real incidents are calm.