Learned routes
Learned routes are routes that Cloud Router uses to reach another network. Cloud Router supports two types of learned routes:
BGP routes received from a peer router. The peer router can be an on-premises physical router, another Cloud Router, or a router from a different cloud provider.
Routes that you manually configure for an individual BGP session in Cloud Router, called custom learned routes.
With custom learned routes, the Cloud Router behaves as if it had learned the routes from the BGP peer.
Cloud Router enforces quotas for the number of unique prefixes for dynamic routes, including the prefixes that are BGP-received and the prefixes for custom learned routes. For more information, see Cloud Router quotas.
Cloud Router also enforces limits on the number of custom learned routes. For more information, see Limits.
Cloud Router doesn't automatically re-advertise custom learned routes.
Both types of Cloud Router learned routes are processed by a dynamic route control plane and then a VPC network control plane. The processing steps use destination prefix and route metrics to create dynamic routes in a VPC network. For information about the differences between the dynamic route control plane and the VPC network control plane, see How Cloud Router works.
Benefits of custom learned routes
Custom learned routes provide the same advantages as BGP-received dynamic routes. Unlike static routes, custom learned dynamic routes are automatically withdrawn when the BGP session for a next hop goes down.
Custom learned dynamic routes are the only way to define non-BGP routes for certain next hops, like Cloud Interconnect VLAN attachments and HA VPN tunnels.
For more information, see Specify and manage custom learned routes
Dynamic routing mode effects on learned routes
The dynamic routing mode of the VPC network that a Cloud Router belongs to determines how routes received from BGP peers and custom learned routes are processed by dynamic route control planes and VPC network control planes in order to create dynamic routes in the VPC network.
When using VPC Network Peering, the dynamic routing mode of the VPC network that exports custom routes controls how dynamic routes are created in peer VPC networks that import custom routes. For more information, see Effects of the dynamic routing mode in the VPC Network Peering documentation.
Google Cloud has two dynamic routing modes:
- Regional dynamic routing mode
- Each region's dynamic route control plane only processes BGP-received and custom learned routes from the Cloud Router BGP tasks in its own region. The resulting dynamic routes created in a particular region of a VPC have next hops only within that specific region.
- Global dynamic routing mode
- Each region's dynamic route control plane processes BGP-received and custom learned routes from the Cloud Router BGP tasks in its own region. Each region's dynamic route control plane also sends its top-ranked candidate for each prefix to the dynamic route control planes in all other regions used in the VPC network. The resulting dynamic routes created in a particular region of a VPC network can have next hops in any region.
Best path selection
The following sections describe how Cloud Router processes paths.
Cloud Router BGP task processing
Every Cloud Router BGP task applies the following ranking algorithm to each BGP-received unique destination prefix:
The Cloud Router BGP task discards all next hops except for those with the shortest AS path length.
The Cloud Router BGP task creates a list of all next hops, sorted from the smallest to the largest received multi-exit descriminator (MED) value.
The Cloud Router BGP task sends the list of next hops, including the corresponding received MED values, to the dynamic route control plane. The dynamic route control plane is located in the same region as the Cloud Router BGP task.
Important considerations for AS path length
AS path information is only relevant within a single Cloud Router BGP task. Cloud Router BGP tasks don't share AS path information with the dynamic route control plane. As a consequence, we recommend that you not rely on selecting a next hop based on AS path length when different Cloud Router BGP tasks receive the same destination prefix.
BGP sessions involve multiple Cloud Router BGP tasks except in the following situations:
Two HA VPN tunnels that use the same Cloud Router are both associated with the same interface on a HA VPN gateway.
Two Cloud Interconnect VLAN attachments that use the same Cloud Router are both associated with an Cloud Interconnect connection located within the same edge availility zone classification, such as zone 1 or zone 2.
A combination of HA VPN tunnels and Cloud Interconnect VLAN attachments that use the same Cloud Router and a compatible configuration. The following are the two compatible configurations:
- All tunnels on an interface 0 of an HA VPN gateway, and all VLAN attachments on a Cloud Interconnect connection in an edge availability domain 1
- All tunnels on an interface 1 of an HA VPN gateway, and all VLAN attachments on a Cloud Interconnect connection in an edge availability domain 2
Dynamic route control plane processing
Each region's dynamic route control plane applies the following algorithm for each unique destination prefix:
The dynamic route control plane creates a list of next hops for the prefix. The list consists of:
Next hops and MED values for the prefix received from each Cloud Router BGP task within the VPC network in its own region.
Next hops and priority values for custom learned routes that use the prefix. The priority of a custom learned route is treated like a MED value.
The following steps occur only when the VPC network that contains the Cloud Routers uses the global dynamic routing mode:
The dynamic route control plane sends only the next hops that have the lowest MED value to the dynamic route control planes in other regions. The information sent includes both the next hops and associated (lowest) MED value.
The dynamic route control plane receives a list of next hops and MED values from dynamic route control planes in other regions. The dynamic route control plane adds each next hop to its list of next hops for the prefix. When adding each next hop, the dynamic route control plane adjusts the MED value by adding an inter-regional cost.
The dynamic route control plane sorts its list of next hops for the prefix from smallest to largest received MED value.
The dynamic route control plane enforces the maximum number of Cloud Router unique destinations quotas. For information about what Cloud Router does when the unique destinations quota exceeds its limit, see Deterministic route dropping behavior.
Dropped prefixes aren't sent to the VPC control plane.
VPC control plane processing
Each region's VPC control plane receives candidate dynamic routes from the region's dynamic route control plane. Unless a dynamic route is dropped by the dynamic route control plane, the VPC control plane evaluates each candidate dynamic route. Evaluation results in either creating a dynamic route in the VPC network that contains the Cloud Routers or suppression of the candidate dynamic route. The following are reasons why a candidate dynamic route is suppressed:
The candidate dynamic route's destination prefix conflicts with a local, peering, or Network Connectivity Center subnet route. For more information, see Interactions with dynamic routes.
The VPC control plane determines that the next hop for the candidate dynamic route isn't usable before an updated BGP state is processed by Cloud Router. For more information, see the Disregard static and dynamic routes with unusable next hops.
Each region's VPC control plane can also create peering dynamic routes in peered VPC networks, if the VPC network containing the Cloud Routers exports custom routes and the peered VPC network imports custom routes. For information about custom route exchange using VPC Network Peering, see Options for exchanging dynamic routes.
When creating peering dynamic routes, each region's VPC control plane independently evaluates candidate dynamic routes on a per-network basis. In addition to the previously noted suppression cases, the following additional suppression cases apply in peered VPC networks:
If the destination prefix of a candidate peering dynamic route exactly matches the destination prefix of a local dynamic route, the VPC control plane suppresses the conflicting peering dynamic route.
If candidate peering dynamic routes for the same destination prefix are received from two or more peered VPC networks, the VPC control plane uses an internal algorithm to pick the network from which it imports peering dynamic routes. This internal algorithm is evaluated before considering route priority. For more information, see Next hops in a single VPC network.
If the dynamic routes per region per peering group quota exceeds its limit, the VPC control plane only suppresses peering dynamic routes.
Because each VPC control plane suppresses dynamic routes on a per-network basis, keep the following in mind:
If a candidate dynamic route becomes a local dynamic route in the VPC network that contains the Cloud Routers that created the candidate dynamic route, the candidate dynamic route might be suppressed in one or more peered VPC networks.
If a candidate dynamic route has been suppressed in the VPC network that contains the Cloud Routers that created the candidate dynamic route, the candidate dynamic route might become a peering dynamic route in one or more peered VPC networks.
BGP state changes
BGP-received and custom learned routes produce dynamic routes as described in Best path selection, for as long as the corresponding BGP session is established.
Dynamic routes created from BGP-received and custom learned routes are removed when the corresponding BGP session leaves the established state and either of the following is true:
- If graceful restart is enabled, the peer router's graceful restart timer has elapsed.
- The BGP keepalive timer has elapsed.
Cloud Router maintenance events typically take less than 60 seconds. Dynamic routes aren't removed during Cloud Router maintenance events.
Planned maintenance events for Cloud Interconnect take longer than 60 seconds, and do result in removal of dynamic routes whose next hops are the VLAN attachments associated with a Cloud Interconnect connection during the connection's maintenance. Ensure that your Cloud Interconnect VLAN attachments and connections adhere to the requirements of one of the following:
What's next
To configure custom learned routes, see Specify and manage custom learned routes.
To troubleshoot issues with Cloud Router, see the following: