Create a Cloud Router that you can use to dynamically exchange routes between a VPC network and your on-premises network. After you can create a router, you can establish BGP sessions between it and your on-premises router.
When you create a Cloud Router, you can use its default route advertisements or specify custom advertisements. By default, Cloud Router advertises subnets in its region for regional dynamic routing or all subnets in a VPC network for global dynamic routing.
With custom route advertisement, you choose which routes Cloud Router advertises, such as external static IP addresses or specific CIDR ranges.
- Go to the create Cloud Router page in the Google Cloud Console.
Go to the Routers page
- Specify the Cloud Router's details.
- Name — The name of the Cloud Router.
This name is displayed in the console and used by the
gcloudcommand-line tool to reference the Cloud Router. Example:
- VPC network — The network that contains
the instances that you want to reach. Example:
- Region — The region where you want to locate the
Cloud Router. The Cloud Router advertises all
subnets in the region where it's located. Example:
- Google ASN — The
(64512 - 65534, 4200000000 - 4294967294) for the
Cloud Router you are configuring. It can be any private ASN
that you aren't already using as a peer ASN in the same region and
- Name — The name of the Cloud Router. This name is displayed in the console and used by the
- To specify custom route advertisements, expand the Advertised routes
- For the Routes, select Create custom routes.
- Choose whether to advertise the subnets available to the Cloud Router. Enabling this option mimics the Cloud Router's default behavior.
- Select Add custom route to add an advertised route, and then
Your new Cloud Router appears on the Cloud Router listing page. Select it to view its details and configure a BGP session.
Create a Cloud Router in the region that contain the instances that you want to reach.
- Replace [ASN_NUMBER]. You can use any private ASN (64512 - 65534, 4200000000 - 4294967294) that you are not already using in the on-premises network.
- Replace [NETWORK] with the VPC network that contains the instances that you want to reach.
- Replace [REGION] with the region where you want to locate the Cloud Router. The Cloud Router advertises all all subnets in the region where it's located.
gcloud compute routers create my-router \ --network [NETWORK] \ --asn [ASN_NUMBER] --region [REGION]
To create a Cloud Router with custom route advertisements, set the
custom and use the
--set-advertisement-groups flags to
specify route advertisements.
--set-advertisement-ranges accepts a list of CIDR ranges. The
--set-advertisement-groups flag accepts Google-defined groups that
Cloud Router dynamically advertises. Currently, the only valid
all_subnets, which advertises subnets based on the VPC network's
dynamic routing mode (similar to the default advertisements).
The following example advertises subnets and the custom IP ranges
gcloud compute routers create my-router \ --network [NETWORK] \ --asn [ASN_NUMBER] \ --advertisement-mode custom \ --set-advertisement-groups all_subnets \ --set-advertisement-ranges 188.8.131.52,184.108.40.206/16
- Establish BGP sessions between your Cloud Router and your on-premises router.