Set up and manage VPC Network Peering
Google Cloud VPC Network Peering enablesinternal IPaddress connectivity across twoVirtual Private Cloud (VPC) networks, regardless of whether they belong to thesame Google Cloud project or organization. Peering supports connectivity betweennetworks having any combination of IPv4-only, dual-stack, and IPv6-onlysubnets.
Before you begin
- ReadVPC Network Peering andAbout peering connections.
- Enablethe Compute Engine API in your project.
IAM permissions
Make sure that you have one of the following roles on the project:
- Compute Network Admin role (
roles/compute.networkAdmin) - A custom role that includes the following permissions:
compute.networks.addPeeringcompute.networks.updatePeeringcompute.networks.removePeeringcompute.networks.listPeeringRoutes
Create a peering configuration
Before you begin, you must have the name of the VPC networkthat you intend to peer with. If that network is located in another project, youmust also have its project ID. You can't list peering requests for yourVPC network. If necessary, ask the administrator of the networkthat you intend to peer with for the network name and project ID.
Your network and the other network are connected after each network has apeering configuration that references the other network. For more information,seeAbout peering connections.
Google Cloud allows only one peering operation at a time acrosspeered networks. For example, if you set up peering with one network andimmediately try to set up another, the operation fails with the following:Error: There is a peering operation in progress on the local or peer network.Try again later.
Console
Perform the following steps for each side of the peering connection.
In the Google Cloud console, go to theVPC Network Peering page.
ClickCreate connection.
ClickContinue.
In thePeering connection name field, enter a name for your peeringconfiguration.
In theYour VPC network field, select a network you want to peer.
In thePeered VPC network section, select the network to peer with:
- If the network that you want to peer with is in the same project,selectIn project [name-of-your-project] and then the network topeer with.
- If the network that you want to peer with is in a different project,selectIn another project. Specify the project ID that includesthe network you want to peer with and the name of theVPC network.
Select the IP version of routes that you want to exchange between thepeered networks:
- IPv4 (single-stack): exchange IPv4 routes only.
- IPv4 and IPv6 (dual-stack): exchange both IPv4 and IPv6 routes.
To exchange IPv4 custom routes, in theExchange IPv4 custom routessection, choose one or both of the following options:
- Import custom routes: import custom routes from the peer network.The peer network must enable custom route export for routes to beimported.
- Export custom routes: export custom routes to the peernetwork. The peer network must enable custom route import forroutes to be exported.
If your network or the peer network has privately used public IPv4ranges in their subnets, these routes are exported by default, but notimported by default.
To import privately used public IPv4 subnet routes, in theExchange subnet routes with privately used public IPv4 addresses section, selectImport subnet routes with public IP.
InAdvanced options section, choose the update strategy forthe peering connection:
- Independent (default): when this option is selected, either sideof the peering connection can update or delete the connection at anytime. For more information, seeConnection mode.
- Consensus: when this option is selected, both sides of thepeering connection must submit a deletion request before theconnection can be deleted. For more information, seeConnection mode.
ClickCreate.
gcloud
Use thegcloud compute networks peerings create command.
You can create a peering configuration using the default configuration,or you can customize your configuration.
Create a default peering configuration
To create a default peering configuration, run the following command:
gcloud compute networks peerings createPEERING_NAME \ --network=NETWORK \ --peer-project=PEER_PROJECT_ID \ --peer-network=PEER_NETWORK_NAME
Replace the following:
PEERING_NAME: the name of the peeringconfiguration.NETWORK: the name of the network in your projectthat you want to peer.PEER_PROJECT_ID: the ID of the project that containsthe network that you want to peer with. If the peer network is inthe same project as your network, this flag is optional.PEER_NETWORK_NAME: the name of the network thatyou want to peer with.
For example, to peernetwork-a inproject-a withnetwork-binproject-b, do the following:
Create a peering configuration for
network-a. This step isusually performed by a network administrator ofnetwork-a.gcloud compute networks peerings create peering-a \ --network=network-a \ --peer-project=project-b \ --peer-network=network-b
Create a peering configuration for
network-b. This step isusually performed by a network administrator ofnetwork-b.gcloud compute networks peerings create peering-b \ --network=network-b \ --peer-project=project-a \ --peer-network=network-a
The peering state changes toACTIVE in both networks.
Customize a peering configuration
To customize a peering configuration, you can use the following optionalparameters:
--stack-typesets the stack type for the peering connection. Bydefault, only IPv4 routes are exchanged, and the stack type is set toIPV4_ONLY. To exchange both IPv4 and IPv6 routes, specifyIPV4_IPV6.--import-custom-routestells the network to acceptcustom routes from the peered network.The peered network must export the routes first.--export-custom-routestells the network to exportcustom routes to the peered network.The peered network must be set to import the routes.--import-subnet-routes-with-public-iptells the network to acceptsubnet routes from the peered network ifthat network has privately used public IPv4 addresses in itssubnets. The peered network must export the routes first.--export-subnet-routes-with-public-iptells the network to exportsubnet routes that contain privatelyused public IPv4 addresses. The peered network must be set to import theroutes.--update-strategysets the update strategy for the peeringconnection. By default, the update strategy is set toINDEPENDENT. Toconfigure the connection to use consensus mode, specifyCONSENSUS.The update strategy must be the same for both sides of the connection.For more information, seeConnection mode.
Example: Exchange custom routes in a peering connection
To enablenetwork-a inproject-a andnetwork-b inproject-b toexchange custom routes, do the following when creating thepeering connection:
Create a peering configuration for
network-a. This step isusually performed by a network administrator ofnetwork-a.gcloud compute networks peerings create peering-a \ --network=network-a \ --peer-project=project-b \ --peer-network=network-b \ --import-custom-routes \ --export-custom-routes
Create a peering configuration for
network-b. This step isusually performed by a network administrator ofnetwork-b.gcloud compute networks peerings create peering-b \ --network=network-b \ --peer-project=project-a \ --peer-network=network-a \ --import-custom-routes \ --export-custom-routes
The peering state changes toACTIVE in both networks. For more informationabout this example, see thePeer two VPC networks quickstart.
Example: Create a peering connection in consensus mode
To create a peering connection in consensus mode, set the updatestrategy toCONSENSUS. In this example, you configurenetwork-a inproject-a to peer withnetwork-b inproject-b.
Create a peering configuration for
network-a. This step isusually performed by a network administrator ofnetwork-a.gcloud compute networks peerings create peering-a \ --network=network-a \ --peer-project=project-b \ --peer-network=network-b \ --update-strategy=CONSENSUS
Create a peering configuration for
network-b. This step isusually performed by a network administrator ofnetwork-b.gcloud compute networks peerings create peering-b \ --network=network-b \ --peer-project=project-a \ --peer-network=network-a \ --update-strategy=CONSENSUS
The peering state changes toACTIVE in both networks.
Terraform
You can use aTerraform module to create a peering configuration.
module "peering1" { source = "terraform-google-modules/network/google//modules/network-peering" version = "~> 13.0" local_network = var.local_network # Replace with self link to VPC network "foobar" in quotes peer_network = var.peer_network # Replace with self link to VPC network "other" in quotes}For the two peered VPC networks, each self link includes a project ID andthe name of the VPC network. To get the self link for a VPC network, you canuse thegcloud compute networksdescribe command or thenetworks.get method in eachVPC network's project.
When you create a peering from thelocal_network to thepeer_network,the peering relationship is bidirectional. The peering from thepeer_network to thelocal_network gets created automatically.
To learn how to apply or remove a Terraform configuration, seeBasic Terraform commands.
Verify that traffic is passing between peered VPC networks
You can useVPC Flow Logs to view network flows sentfrom and received by VM instances. You can also useFirewall Rules Logging toverify that traffic is passing between the networks.CreateVPC firewall rulesthat allow (or deny) traffic between the peered networks, and turn onFirewall Rules Logging for those rules. You can then view whichfirewall rules were hit using Cloud Logging.
Update a peering connection
When you update an existing peering connection, you can do thefollowing:
- Change whether your VPC network exports or imports customroutes or privately used public IPv4 subnet routes to or from the peerVPC network.
- Update the peering connection to enable or disable the exchange ofIPv6 routes between the peered networks.
- Update the peering connection mode from independent (default) toconsensus, bychanging the update strategy for the connection.
Your network imports routes only if the peer network is also exportingthe routes, and the peer network receives routes only if it importsthem.
Important: Even if the dynamic routing mode of the VPC network is set to global,IPv6 routes learned from the Cloud Router are regional. For more information,seeLimitations.Update a connection (independent mode)
Console
In the Google Cloud console, go to theVPC Network Peering page.
Select the peering connection to update.
ClickEdit.
To update the IP version of routes that you want to exchange between thepeered networks, select one of the following:
- IPv4 (single-stack): stop the existing exchange of IPv6 routesand continue exchanging only IPv4 routes.
- IPv4 and IPv6 (dual-stack): start exchanging both IPv4 and IPv6routes, provided the matching peering configuration also has thisoption enabled.
To exchange IPv4 custom routes, in theExchange IPv4 custom routessection, choose one or both of the following options:
- Import custom routes: import custom routes from the peer network.The peer network must enable custom route export for routes to beimported.
- Export custom routes: export custom routes to the peernetwork. The peer network must enable custom route import forroutes to be exported.
If your network or the peer network has privately used public IPv4ranges in their subnets, these routes are exported by default, but notimported by default.
To import privately used public IPv4 subnet routes, in theExchange subnet routes with privately used public IPv4 addresses section, selectImport subnet routes with public IP.
ClickSave.
gcloud
Use thegcloud compute networks peerings update command.The square brackets[] in the following command indicate optionalflags:
--stack-typesets the stack type for the peering connection. Bydefault, only IPv4 routes are exchanged, and the stack type is set toIPV4_ONLY. To exchange both IPv4 and IPv6 routes, specifyIPV4_IPV6.--import-custom-routestells the network to acceptcustom routes from the peered network.The peered network must export the routes first.--export-custom-routestells the network to exportcustom routes to the peered network.The peered network must be set to import the routes.--import-subnet-routes-with-public-iptells the network to acceptsubnet routes from the peered network ifthat network is using privately used public IPv4 addresses in itssubnets. The peered network must export the routes first.--export-subnet-routes-with-public-iptells the network to exportsubnet routes that contain privatelyused public IPv4 addresses. The peered network must be set to import theroutes.--update-strategysets the update strategy for the peeringconnection. By default, the update strategy is set toINDEPENDENT. Toconfigure the connection to use consensus mode, specifyCONSENSUS.The update strategy must be the same for both sides of the connection.For more information, seeConnection mode.
gcloud compute networks peerings updatePEERING_NAME \ --network=NETWORK \ [--stack-type=STACK_TYPE] \ [--import-custom-routes] \ [--export-custom-routes] \ [--export-subnet-routes-with-public-ip] \ [--import-subnet-routes-with-public-ip] \ [--update-strategy=UPDATE_STRATEGY]
Replace the following:
PEERING_NAME: the name of the existing peeringconfiguration.NETWORK: the name of the network in your project thatis peered.STACK_TYPE: the stack type for the peeringconnection.- Specify
IPV4_ONLYto stop the existing exchange of IPv6 routesand continue exchanging only IPv4 routes. - Specify
IPV4_IPV6to start exchanging both IPv4 and IPv6 routes,provided the matching peering connection also hasstack_typesettoIPV4_IPV6.
- Specify
UPDATE_STRATEGY: the update strategy for thepeering connection—eitherINDEPENDENT(default) orCONSENSUS.To use this option, seeUpdate a connection to consensus mode.
Update a connection to consensus mode
You update a peering connection from independent (default) to consensus mode bychanging the update strategy for the connection. Before changing the updatestrategy, review the requirements forconsensus mode.
Console
In the Google Cloud console, go to theVPC Network Peering page.
Click the peering connection to update.
ClickEdit.
In theAdvanced options section, selectConsensus.
ClickSave.
The update strategy changes toConsensus for the local configuration.To complete the update request, a network administrator for the peernetwork must accept the request by performing steps 1-4 for the peerconfiguration.
After both configurations are updated, the effectiveupdate strategy of the peering connection changes to Consensus.
gcloud
Use thegcloud compute networks peerings update command.
Update the local peering configuration:
gcloud compute networks peerings updatePEERING_NAME \ --network=NETWORK \ --update-strategy=CONSENSUS
Replace the following:
PEERING_NAME: the name of the existing peeringconfiguration.NETWORK: the name of the network in your projectthat is peered.
View the status of the update request:
gcloud compute networks describeNETWORK
Replace
NETWORKwith the name of the network in yourproject that is peered.In the output, the
consensusStatefield must display the followingstatus:- In the configuration for the local network,
PENDING_PEER_ACKNOWLEDGMENT - In the matching configuration for the peer network,
PENDING_LOCAL_ACKNOWLEDGMENT
- In the configuration for the local network,
Accept the update request by running the command in step 1 for thepeer side of the connection.
This step is usually performed by a network administrator for the peernetwork. After the request is complete, the
consensusStatefieldchanges toIN_SYNCfor both configurations.
To revert an update request that is waiting for approval by the peernetwork, reset the update strategy to independent.
List peering connections
List existing peering connections to view their status and whether they'reimporting or exporting custom routes.
Console
In the Google Cloud console, go to theVPC Network Peering page.
Select the peering connection to view its details.
gcloud
gcloud compute networks peerings list
View a peering connection
Console
In the Google Cloud console, go to theVPC Network Peering page.
In theStatus column, view the status of your connection.
gcloud
Use thegcloud compute networks describe command.
gcloud compute networks describeNETWORK
ReplaceNETWORK with the name of the network in yourproject that is peered.
In the output, thepeerings.connectionStatus field describes theeffective status of the peering connection. For more information, seeConnection status.
List peering routes
Console
Use theEffective routes tab to view all applicableroutetypes in a VPC network,including imported peering subnet, peering static, and peering dynamicroutes.
In the Google Cloud console, go to theRoutes page.
On theEffective routes tab, do the following:
- Select aVPC network.
- Select aRegion.
ClickView.
Click theFilter text field, and do the following:
- ChooseType from theProperties menu.
- Choose one of the following from theValues menu.
- Peering subnet: to see subnet routes from peerVPC networks.
- Peering static: to see imported static routes from peerVPC networks.
- Peering dynamic: to see imported dynamic routes from peerVPC networks.
Optionally, clickShow suppressed routes to view routes that aresuppressed. Place your pointer over the icon in theStatus column toview the reason why a route has been suppressed. The reason includes alink to therouting orderdocumentation with an explanation.
gcloud
Use the following Google Cloud CLI command to:
- Listroute exports sent from your VPC network to peerVPC networks.
- Listroute import candidates for your VPC network.
gcloud compute networks peerings list-routesPEERING_NAME \ --network=NETWORK \ --region=REGION \ --direction=DIRECTION
Replace the following:
PEERING_NAME: the name of an existing peeringconnection.NETWORK: the name of the network in your project thatis peered.REGION: the region where you want to list all dynamicroutes. Subnet and static routes are global and are shown for all regions.DIRECTION: specifies whether to list imported(incoming) or exported (outgoing) routes.
Delete a peering connection
When a peering configuration is deleted in your network, the peering connectionbecomes inactive in the other network, and all routes shared among the networksare removed.
The procedure for deleting a peering connection depends on the update strategyconfigured for the connection:
- Independent (default): you or a network administrator for the peerVPC network can delete the connection at any time. SeeDelete a connection (independent mode).
- Consensus: both you and a network administrator for the peerVPC network must submit a delete request before the connectioncan be deleted. SeeDelete a connection (consensus mode).
Warning: Don't delete a VPC Network Peering connection that is already in use by Google Cloud resources. Deleting an in-use peering connection can cause problems, including the following:
- If you delete a peering connection that is used by private services access, then you can't create new private connections for private services access. For more information, seeUnable to create a new private connection.
- If you delete a peering connection that is used by Google Kubernetes Engine (GKE), the cluster enters a repair state and all nodes show an
UNKNOWNstatus. For more information, seeVPC Network Peering connection is accidentally deleted.
Delete a connection (independent mode)
To delete a peering connection in independent mode (default), do the following.
Console
In the Google Cloud console, go to theVPC Network Peering page.
Select the checkbox next to the peering connection that you want toremove.
ClickDelete.
The status of the connection changes toInactive for the peernetwork. To remove the inactive configuration, a network administratorfor the peer network performs these steps for the peer side of theconnection.
gcloud
Use thegcloud compute networks peerings delete command.
gcloud compute networks peerings deletePEERING_NAME \ --network=NETWORK
Replace the following:
PEERING_NAME: the name of the peering configuration todelete.NETWORK: the name of the network in your project thatis peered.
The status of the connection changes toINACTIVE for the peer network.To remove the inactive configuration, a network administratorfor the peer network performs this step for the peer side of theconnection.
Delete a connection (consensus mode)
To delete a peering connection in consensus mode, do the following.
Console
In the Google Cloud console, go to theVPC Network Peering page.
Click the peering connection that you want to remove.
On thePeering connection details page, clickRequest deleteand thenConfirm.
Accept the deletion request by performing steps 1-3 for the peer side ofthe connection.
These steps are usually performed by a network administrator for the peernetwork. After both sides of the peering connection submit thedeletion request, the status of the connectionchanges toActive, delete acknowledged for both configurations.
Select the peering connection that you want to remove and thenclickDelete.
The status of the connection changes toInactive for the peernetwork. To remove the inactive configuration, the network administratorfor the peer network performs this step for the peer side of theconnection.
gcloud
Use thegcloud compute networks peerings request-delete andgcloud compute networks peerings delete commands.
Initiate a deletion request:
gcloud compute networks peerings request-deletePEERING_NAME \ --network=NETWORK
Replace the following:
PEERING_NAME: the name of the peering connection todelete.NETWORK: the name of the network in your projectthat is peered.
View the status of the deletion request:
gcloud compute networks describeNETWORK
Replace
NETWORKwith the name of the network in yourproject that is peered.In the output, the
deleteStatusfield must display the followingstatus:- In the configuration for the local network,
LOCAL_DELETE_REQUESTED - In the matching configuration for the peer network,
PEER_DELETE_REQUESTED
- In the configuration for the local network,
Accept the deletion request by running the command in step 1 for thepeer side of the connection.
This step is usually performed by a network administrator for the peernetwork. After both sides of the connection submit thedeletion request, the status of the
deleteStatusfieldchanges toDELETE_ACKNOWLEDGEDfor both configurations.Delete the peering connection:
gcloud compute networks peerings deletePEERING_NAME \ --network=NETWORK
Replace the following:
PEERING_NAME: the name of the peering configurationto delete.NETWORK: the name of the network in your projectthat is peered.
The status of the connection changes to
INACTIVEfor the peer network.To remove the inactive configuration, the network administrator for thepeer network performs this step for the peer side of the connection.
Troubleshooting
The following sections describe how to troubleshoot issues withVPC Network Peering.
Peer VMs are unreachable
After the peering connection is ACTIVE, it may take up to a minute for allthe traffic flows to be set up between the peered networks. This timedepends on the size of the networks that are peering. If you have recentlyset up the peering connection, wait up to a minute and try again.Also, ensure that there are no firewall rules blocking access to or from peerVPC network subnet CIDRs.
Custom routes are missing
This section describes how to troubleshoot missing custom routes.
Check the peering connection state
To check the state of your peering connection, do the following:
- List peering connections.
- Identify the peering connection to troubleshoot, and review its peeringstate.
- If the state is
ACTIVE, follow the steps in the next section. - If the peering state is
INACTIVE, a networkadministrator for the other network needs tocreate a peering configuration to yourVPC network.
- If the state is
Troubleshoot anACTIVE connection
To troubleshoot missing custom routes in anACTIVE peering connection:
List peering routes in your VPC network.In theEffective routes tab, do the following:
Consider that the regions in which dynamic routes are programmed depends onthe dynamic routing mode of the VPC network that exportscustom routes. For more details, seeEffects of the dynamic routingmode. In globaldynamic routing mode, only the highest ranked dynamic route is programmedin regions that don't match the region of the next hop.
Click theShow suppressed routes toggle to the on position, then checkfor your route. To view the reason why a route has been suppressed, pointto the icon in theStatus column. Google Cloud provides routeconflict resolution on a region-by-region basis in the VPCnetwork that imports routes using VPC Network Peering.
Look for a warning indicating that your VPC network hasreached the limit for thedynamic routes per region per peeringgroup quota. If your VPCnetwork has reached the limit for this quota, one or more peering dynamicroutes aren't programmed. Because it's not possible to show exactly whichpeering dynamic routes aren't programmed, request a quota limitincrease for the dynamic routes per region per peering group quota.
If you still don't see the route you expect, do the following:
Review your peering configuration, andupdate your peering configuration ifnecessary so that it imports custom routes.
Ensure that the route is not one of the following route types that can'tbe exchanged using VPC Network Peering:
Peering subnet, peering static, and peering dynamic routes in a peeredVPC networkthat are received from its other peer networkscannot be exchanged to your VPC network usingVPC Network Peering.
Static routes that use the default internet gateway next hop and staticroutes with network tagscannot beexchanged usingVPC Network Peering.
For more information, seeRoute exchange options.
Ask a network administrator of the peered VPC network to:
List routes in their VPCnetwork, looking for the routeyou expect.
Review their peering configuration, andupdate the peering configuration ifnecessary so that it exports custom routes.
Traffic destined for a peer network is being dropped
You can useConnectivity Teststo help determine why traffic destined for a peer network is being dropped. Iftraffic should be sent using custom routes, seeCustom routes are missing.
Traffic is being sent to an unexpected next hop
You can useConnectivity Teststo help determine why traffic is being sent to an unexpected next hop. Iftraffic should be sent using custom routes, seeCustom routes are missing.
Unable to peer with a particular VPC network
If you cannot create a peering configuration with certain VPCnetworks, an organization policy might be constraining the VPCnetworks that your network can peer with. In the organization policy, add thenetwork to the list of allowed peers or contact your organization administrator.For more information, refer to theconstraints/compute.restrictVpcPeeringconstraint.
IPv6 routes are not exchanged
First, verify that both your peering connection and the peering connection ofthe peered VPC network have their stack types set toIPV4_IPV6.If necessary:
- Update your peering connection to set its stacktype to
IPV4_IPV6. - Ask a network administrator of the peered VPC network to updatetheir peering connection, setting its stack type to
IPV4_IPV6.
After both peering connections have their stack types set toIPV4_IPV6, IPv6subnet routes (both internal and external) are exchanged. IPv6 subnet routes areunique among all Google Cloud VPC networks.
To exchange IPv6 custom routes:
- Update your peering connection to import and exportcustom routes.
- Ask a network administrator of the peered VPC network to updatetheir peering connection to import and export custom routes.
What's next
- For more information about VPC routing, seeRoutes.
- For limits related to VPC Network Peering, seeVPC Network Peering limits.
- For information about how to use an internal passthrough Network Load Balancer as the next hopfor a custom static route, seeUse an internal passthrough Network Load Balancer as a nexthop.
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 2026-02-19 UTC.