Creating Cloud Routers

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.

For more information about the dynamic routing mode or custom route advertisements, see Dynamic routing mode or BGP route advertisements in the Cloud Router Overview.

Console


  1. Go to the create Cloud Router page in the Google Cloud Platform Console.
    Go to the Routers page
  2. Specify the Cloud Router's details.
    • Name — The name of the Cloud Router. This name is displayed in the console and used by the gcloud command-line tool to reference the Cloud Router. Example: my-router
    • VPC network — The network that contains the instances that you want to reach. Example: my-network
    • 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: asia-east1
    • Google ASN — The private ASN (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 network. Example: 65001
  3. To specify custom route advertisements, expand the Advertised routes section.
    1. For the Routes, select Create custom routes.
    2. Choose whether to advertise the subnets available to the Cloud Router. Enabling this option mimics the Cloud Router's default behavior.
    3. Select Add custom route to add an advertised route, and then configure it.
      Your new Cloud Router appears on the Cloud Router listing page. Select it to view its details and configure a BGP session.

gcloud


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 --set-advertisement-mode to custom and use the --set-advertisement-ranges and --set-advertisement-groups flags to specify route advertisements.

The --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 value is 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 1.2.3.4 and 6.7.0.0/16:

gcloud compute routers create my-router \
    --network [NETWORK] \
    --asn [ASN_NUMBER] \
    --set-advertisement-mode custom \
    --set-advertisement-groups all_subnets \
    --set-advertisement-ranges 1.2.3.4,6.7.0.0/16

What's next

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Router