Configure Private Google Access for on-premises hosts
Private Google Access for on-premises hosts provides a way for on-premisessystems to connect toGoogle APIs andservices by routing trafficthrough aCloud VPN tunnel or a VLAN attachment forCloud Interconnect.Private Google Access for on-premises hosts is an alternative toconnecting to Google APIs and services over the internet.
This document describes how to enable Private Google Access for on-premiseshosts.
Note: These instructions also apply to host machines in aBare Metal Solution region extension. Except in reference toname servers in theDNS configurationsection, the termon-premises in these instructions is equivalenttoBare Metal Solution. For DNS name servers, the DNS name server that youuse can be your own enterprise server in your actual on-premises environment,a DNS name server on Google Cloud, or, if you enableyour Bare Metal Solution machines to connect to the internet, a public DNSname server.Specifications and requirements
Private Google Access for on-premises hosts has the following requirements:
You must direct Google APIs and services traffic sent by on-premises systemsto the IP addresses associated with either the
private.googleapis.comor therestricted.googleapis.comspecial domain names. For details about what services can beaccessed on each domain, seeDomain options.Your on-premises network must be connected to aVPCnetwork by using either Cloud VPN tunnels orVLAN attachments.
The VPC network to which your on-premises network is connectedmust have appropriate routes for either the
private.googleapis.comorrestricted.googleapis.comdestination IP ranges. For details, seeVPC network routing.The VPC network to which your on-premises network is connectedmust have appropriate routes to reach the on-premises network. The next hopCloud VPN tunnels or VLAN attachments thatconnect to your on-premises network for these routes must be within the same regionwhere the request originated. If the next hop is in a region different from wherethe request to Private Google Access originated, response fromPrivate Google Access will not reach the on-premises network.
Your on-premises network must have routes for either the
private.googleapis.comorrestricted.googleapis.comdestination IP ranges.These routes must direct traffic to the appropriate Cloud VPN tunnelor VLAN attachment that connects to yourVPC network. For details, seeon-premises routing withCloud Router.To let IPv6 clients in your on-premises environment access Google APIs by using
private.googleapis.comorrestricted.googleapis.com, you must configure the connection to your VPCnetwork to support IPv6. For more information, see the following pages:On-premises clients can send requests from any IPv6 GUA or ULA addresses, except for the ULA range
fda3:e722:ac3:cc00::/64, which is reserved for internal use.If your project is providing access to Google APIs for on-premises hostsonly, you don't need to enable the Google APIs for the project.
However, if resources within the project need to access Google APIs, youmight need to separatelyenable the APIs forthe services that they need to access. For more information about usingPrivate Google Access for resources within a project, seeConfigurePrivate Google Access.
Permissions
Project owners, editors, and IAM principals with theNetworkAdmin role can create or updatesubnets and assign IP addresses.
For more information about roles, read theIAM roles documentation.
Network configuration
Private Google Access for on-premises hosts has specificnetworkrequirements for on-premises systems and for the VPCnetwork through which the on-premises systems send traffic to Google APIs andservices.
Domain options
Private Google Access for on-premises hosts requires that you direct servicesto one of the following special domains. The special domain you choosedetermines which services you can access.
Theprivate.googleapis.com andrestricted.googleapis.com VIPs supportonly HTTP-based protocols over TCP (HTTP, HTTPS, and HTTP/2). All other protocols, including MQTTand ICMP, are not supported.
| Domain and IP address ranges | Supported services | Example usage |
|---|---|---|
| Enables API access to most Google APIs and services regardless of whether they are supported by VPC Service Controls. Includes API access to Google Maps, Google Ads, Google Cloud, and most other Google APIs, including the following list. Does not support Google Workspace web applications such as Gmail and Google Docs. Does not support any interactive websites. Domain names that match:
| Use Choose
|
| Enables API access toGoogle APIs and services that are supported by VPC Service Controls. Blocks access to Google APIs and services that do not supportVPC Service Controls. Does not support Google Workspace APIs or Google Workspace web applications such as Gmail and Google Docs. | Use Choose The |
restricted.googleapis.com, as it provides additional risk mitigation for data exfiltration. Usingrestricted.googleapis.com denies access to Google APIs and services that are not supported by VPC Service Controls. SeeSetting up private connectivity in the VPC Service Controls documentation for more details.IPv6 support forprivate.googleapis.com andrestricted.googleapis.com
The following IPv6 address ranges can be used to direct traffic from IPv6clients to Google APIs and services:
private.googleapis.com:2600:2d00:0002:2000::/64restricted.googleapis.com:2600:2d00:0002:1000::/64
Consider configuring the IPv6 addresses if you want to use theprivate.googleapis.com orrestricted.googleapis.com domain, and youhave clients that use IPv6 addresses. IPv6 clients that also have IPv4 addresses configured canreach Google APIs and services by using the IPv4 addresses. Not all services accept traffic from IPv6 clients.
DNS configuration
Your on-premises network must have DNS zones and records configured so that thedomain names of the services that you're accessing resolve to the set of IPaddresses for eitherprivate.googleapis.com orrestricted.googleapis.com. Youcan create Cloud DNS managed private zones and use a Cloud DNSinbound server policy, or you can configure on-premises name servers. Forexample, you can useBIND orMicrosoftActive DirectoryDNS.
The following sections describe how to use DNS zones to send packets to the IPaddresses that are associated with your chosen VIP. Follow the instructions forall scenarios that apply to you:
- If you use services that have
*.googleapis.comdomain names, seeConfigure DNS forgoogleapis.com. If you use services that have otherdomain names, seeConfigure DNS for other domains. Forexample, if you use Google Kubernetes Engine (GKE), you also need toconfigure
*.gcr.ioand*.pkg.dev, or if you useCloud Run, you need to configure*.run.app.If you use Cloud Storage buckets, and you send requests to aCloud Storage custom domain name, seeConfigure DNS forCloud Storage custom domainnames.
If you implement the DNS configuration using Cloud DNS, seeConfigure DNS for on-premises systems.
When you configure DNS records for the VIPs, use only the IP addresses that aredescribed in the following steps. Do not mix addresses from theprivate.googleapis.com andrestricted.googleapis.com VIPs. This cancause intermittent failures because the services that are offered differbased on a packet's destination.
Note: There are public DNS records for private.googleapis.com orrestricted.googleapis.com. However, you can't use the public records to accessGoogle APIs. You must create a private DNS zone and records.
Configure DNS forgoogleapis.com
Create a DNS zone and records forgoogleapis.com:
- Create a private DNS zone for
googleapis.com. Considercreating aCloud DNS private zone for thispurpose. In the
googleapis.comzone, create the following private DNS records foreitherprivate.googleapis.comorrestricted.googleapis.com, depending on whichdomain you've chosen to use.For
private.googleapis.com:Create an
Arecord forprivate.googleapis.compointing to thefollowing IP addresses:199.36.153.8,199.36.153.9,199.36.153.10,199.36.153.11.To connect to APIs using IPv6 addresses, also configure an
AAAArecord forprivate.googleapis.compointing to2600:2d00:0002:2000::.
For
restricted.googleapis.com:Create an
Arecord forrestricted.googleapis.compointing to thefollowing IP addresses:199.36.153.4,199.36.153.5,199.36.153.6,199.36.153.7.To connect to APIs using IPv6 addresses, also create an
AAAArecord forrestricted.googleapis.compointing to2600:2d00:0002:1000::.
To create private DNS records in Cloud DNS, seeadd a record.
In the
googleapis.comzone, create aCNAMErecord for*.googleapis.comthat points to the domain that you've configured:private.googleapis.comorrestricted.googleapis.com.
Configure DNS for other domains
Some Google APIs and services are provided using additional domain names,including*.gcr.io,*.gstatic.com,*.pkg.dev,pki.goog,*.run.app, and*.gke.goog.Refer to thedomain and IP address ranges table inDomain optionsto determine if the additional domain's services can be accessed usingprivate.googleapis.comorrestricted.googleapis.com. Then, for each of the additional domains:
Create a DNS zone for
DOMAIN(for example,gcr.io).If you're using Cloud DNS, make sure this zone is located in thesame project as yourgoogleapis.comprivate zone.In this DNS zone, create the following private DNS records foreither
private.googleapis.comorrestricted.googleapis.com, depending on whichdomain you've chosen to use.For
private.googleapis.com:Create an
Arecord forDOMAINpointing to the followingIP addresses:199.36.153.8,199.36.153.9,199.36.153.10,199.36.153.11.To connect to APIs using IPv6 addresses, also create an
AAAArecord forDOMAINpointing to2600:2d00:0002:2000::.
For
restricted.googleapis.com:Create an
Arecord forDOMAINpointing to the followingIP addresses:199.36.153.4,199.36.153.5,199.36.153.6,199.36.153.7.To connect to APIs using IPv6 addresses, also create an
AAAArecord forDOMAINpointing to2600:2d00:0002:1000::.
In the
DOMAINzone, create aCNAMErecord for*.DOMAINthat points toDOMAIN.For example, create aCNAMErecord for*.gcr.iothat points togcr.io.
Configure DNS for Cloud Storage custom domain names
If you are using Cloud Storage buckets, and you send requests to aCloud Storage custom domain name,configuring DNS records for the custom Cloud Storage domain name to point tothe IP addresses forprivate.googleapis.com orrestricted.googleapis.com isnot sufficient to allow access to the Cloud Storage buckets.
If you want to send requests to a Cloud Storage custom domain name, you must also explicitlyset the HTTP request's Host header and TLS SNI tostorage.googleapis.com TheIP addresses forprivate.googleapis.com andrestricted.googleapis.com do notsupport custom Cloud Storage hostnames in HTTP request Host headers and TLSSNIs.
Configure DNS for on-premises systems
If you've implemented the DNS configuration using Cloud DNS, you'llneed to configure on-premises systems so that they can make queries to yourCloud DNS managed private zones:
- Create aninbound server policy in theVPC network to which your on-premises network connects.
- Identify theinbound forwarder entrypoints, in the region(s) where yourCloud VPN tunnels and VLAN attachmentsare located, in the VPC network to which your on-premisesnetwork connects.
- Configure on-premises systems and on-premises DNS name servers to forward
googleapis.comand any of the additional domain names to an inboundforwarder entry pointin the same region as the Cloud VPNtunnel or VLAN attachment that connects to theVPC network.
VPC network routing
The VPC network to which your on-premises network connects musthave routes for the IP address ranges used byprivate.googleapis.com orrestricted.googleapis.com. These routes must use the default internet gatewaynext hop.
Google Cloud doesn't publish routes on the internet for the IP addressranges used by theprivate.googleapis.com orrestricted.googleapis.com domains.Consequently, even though the routes in the VPC network sendtraffic to thedefault internet gateway next hop, packets sent to those IPaddress ranges remain within Google's network.
If the VPC network to which your on-premises network connectscontains adefault route whose next hopis the default internet gateway, that route meets the routing requirements forPrivate Google Access for on-premises hosts.
VPC network custom routing
If you've replaced or changed your default route, ensure that you have customstatic routes configured for the destination IP ranges used byprivate.googleapis.com orrestricted.googleapis.com. To check theconfiguration of custom routes for Google APIs and services in a given network,follow these directions.
Console
In the Google Cloud console, go to theRoutes page.
Use theFilter table text field to filter the list of routes usingthe following criteria, replacing
NETWORK_NAMEwith the nameof the VPC network to which your on-premises networkconnects:- Network:
NETWORK_NAME - Next hop type:
default internet gateway
- Network:
Look at theDestination IP range column for each route. Look for aroute whose destination range matches:
199.36.153.8/30if you choseprivate.googleapis.com199.36.153.4/30if you choserestricted.googleapis.com
gcloud
Use the followinggcloud command, replacingNETWORK_NAME withthe name of the VPC network to which your on-premises networkconnects:
gcloud compute routes list \ --filter="default-internet-gatewayNETWORK_NAME"
Routes are listed in table format unless you customize the command with the--format flag. Look in theDEST_RANGE column for a route whosedestination range matches:
199.36.153.8/30if you choseprivate.googleapis.com199.36.153.4/30if you choserestricted.googleapis.com
If you need to create routes in your VPC network, seeAdding astatic route.
On-premises routing with Cloud Router
Routes in your on-premises network must be configured to direct traffic for theIP address ranges used by theprivate.googleapis.com orrestricted.googleapis.com domains to the next hop Cloud VPN tunnelsor VLAN attachments that connect to your VPC network.
You can useCloud Router Custom RouteAdvertisementsto announce routes for the IP ranges used by theprivate.googleapis.com andrestricted.googleapis.com domains.
IPv6 routes are advertised only in BGP sessions whereIPv6 is enabled.
Important: IP address ranges forprivate.googleapis.com andrestricted.googleapis.com are not routable on the internet.Console
To update the route advertisement mode for all BGP sessions on aCloud Router, except for those BGP sessions that use custom BGPadvertisements themselves:
In the Google Cloud console, go to theCloud Router page.
Select the Cloud Router that manages BGP sessions for theCloud VPN tunnels or VLAN attachmentsthat connect your on-premises network to your VPCnetwork.
In the Cloud Router's detail page, selectEdit.
Expand theAdvertised routes section.
For theRoutes, selectCreate custom routes.
If you want to advertise all subnet routes available to theCloud Router, selectAdvertise all subnets visible to the Cloud Router. Thissetting replicates the default configuration to your custom configuration.
For each advertised route that you want to add, do the following:
- SelectAdd custom route.
- ForSource, selectCustom IP range.
- ForIP address range, enter one of the ranges that you want to use:
- If you use
private.googleapis.com:- For IPv4 connectivity:
199.36.153.8/30 - For IPv6 connectivity:
2600:2d00:0002:2000::/64
- For IPv4 connectivity:
- If you use
restricted.googleapis.com:- For IPv4 connectivity:
199.36.153.4/30 - For IPv6 connectivity:
2600:2d00:0002:1000::/64
- For IPv4 connectivity:
- If you use
- ClickDone.
After you're done adding routes, selectSave.
To update the route advertisement mode for a particular BGP session:
In the Google Cloud console, go to theCloud Router page.
Select the Cloud Router that manages the BGP session for aCloud VPN tunnel or VLAN attachmentthat connects your on-premises network to your VPCnetwork.
In the Cloud Router's detail page, select the BGP session toupdate.
In the BGP session details page, clickEdit.
For theRoutes, selectCreate custom routes.
SelectAdvertise all subnets visible to the Cloud Router toadvertise all subnet routes available to the Cloud Router if youdesire the Cloud Router's default behavior.
For each advertised route that you want to add, do the following:
- SelectAdd custom route.
- ForSource, selectCustom IP range.
- ForIP address range, enter one of the ranges that you want to use:
- If you use
private.googleapis.com:- For IPv4 connectivity:
199.36.153.8/30 - For IPv6 connectivity:
2600:2d00:0002:2000::/64
- For IPv4 connectivity:
- If you use
restricted.googleapis.com:- For IPv4 connectivity:
199.36.153.4/30 - For IPv6 connectivity:
2600:2d00:0002:1000::/64
- For IPv4 connectivity:
- If you use
- ClickDone.
After you're done adding routes, selectSave.
gcloud
Identify the name and region of the Cloud Router that managesBGP sessions on the Cloud VPN tunnels orVLAN attachments that connect youron-premises network to your VPC network.
Use
compute routersupdateto update theroute advertisement mode on all the Cloud Router's BGP sessions,except for those BGP sessions that use custom BGP advertisementsthemselves:gcloud compute routers updateROUTER_NAME \ --region=REGION \ --advertisement-mode=CUSTOM \ --set-advertisement-groups=ALL_SUBNETS \ --set-advertisement-ranges=CUSTOM_RANGES
You can append new advertisement ranges if you're already using the
CUSTOMadvertisement mode for the Cloud Router. This updatesthe route advertisement mode on all the Cloud Router's BGPsessions, except for those BGP sessions that use custom BGPadvertisements themselves:gcloud compute routers updateROUTER_NAME \ --region=REGION \ --add-advertisement-ranges=CUSTOM_RANGES
Alternatively, use
compute routersupdate-bgp-peerto configure a specific BGP peer on the Cloud Router:If you are adding IPv6 custom ranges, and if IPv6 traffic is disabled forthe BGP session, you can enable it with the
--enable-ipv6flag.gcloud compute routers update-bgp-peerROUTER_NAME \ --region=REGION \ --peer-name=PEER_NAME \ --advertisement-mode=CUSTOM \ --set-advertisement-groups=ALL_SUBNETS \ --set-advertisement-ranges=CUSTOM_RANGES
You can append new advertisement ranges if you're already using the
CUSTOMadvertisement mode for a BGP session on a Cloud RouterIf you are adding IPv6 custom ranges, and if IPv6 traffic is disabled forthe BGP session, you can enable it with the
--enable-ipv6flag.gcloud compute routers update-bgp-peerROUTER_NAME \ --region=REGION \ --peer-name=PEER_NAME \ --add-advertisement-ranges=CUSTOM_RANGES
In the commands above, replace the following with valid values:
ROUTER_NAME: The name of the Cloud RouterREGION: The region of the Cloud RouterPEER_NAME: The name of the BGP peer configured when youcreate a VLAN attachment forDedicated Interconnect, whenyoucreate a VLAN attachment forPartner Interconnect, or when youcreate anHA VPNtunnel- Leave
--set-advertisement-groups=ALL_SUBNETSin order to advertiseall subnet routes available to the Cloud Router. This is theCloud Router's default behavior. CUSTOM_RANGES: A comma-delimited list of custom ranges toadvertise.- For
private.googleapis.com:- For IPv4 connectivity:
199.36.153.8/30 - For both IPv4 and IPv6 connectivity:
199.36.153.8/30,2600:2d00:0002:2000::/64
- For IPv4 connectivity:
- For
restricted.googleapis.com:- For IPv4 connectivity:
199.36.153.4/30 - For both IPv4 and IPv6 connectivity:
199.36.153.4/30,2600:2d00:0002:1000::/64
- For IPv4 connectivity:
- For
Firewall considerations
Google Cloud firewall rules in the VPC network to whichyour on-premises network connects have no effect upon:
- Packets sent through a Cloud VPN tunnel connected to theVPC network
- Packets sent through a VLAN attachment connectedto the VPC network
- Incoming packets to Cloud DNS inbound forwarder IP addresses inthe VPC network
You should ensure that the firewall configuration of on-premises systems allowsoutbound traffic to and established responses from the appropriate IP addresses:
- If you use
private.googleapis.com:- For IPv4 connectivity:
199.36.153.8/30 - For IPv6 connectivity:
2600:2d00:0002:2000::/64
- For IPv4 connectivity:
- If you use
restricted.googleapis.com:- For IPv4 connectivity:
199.36.153.4/30 - For IPv6 connectivity:
2600:2d00:0002:1000::/64
- For IPv4 connectivity:
- Any Cloud DNS inbound forwarder IP addresses, if you're using Cloud DNS for theDNS configuration
What's next
- If you need VMs in your Google Cloud VPC network to access Google APIsand services, seeConfigure Private Google Access for VPC.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-17 UTC.