Custom learned routes

Cloud Router learns routes dynamically from external routers by using Border Gateway Protocol (BGP). However, you can also configure a BGP session on your Cloud Router to apply additional learned routes that you manually define. These manually configured routes are called custom learned routes. When you specify routes for a BGP session, the Cloud Router behaves as if it had learned the routes from the BGP peer.

How it works

You can configure custom learned routes at the same time that you create a BGP session. Alternatively, you can update the session later to add or update its custom learned routes.

To configure custom learned routes, you update your BGP session to include the following:

  • A comma-separated list of IPv4 prefixes that you want to specify as destinations. The next hop of these custom learned routes is the IPv4 address of the BGP peer. You can include IPv6 prefixes as well, but Cloud Router ignores them unless the conditions for IPv6 route exchange have been met (example).

  • A priority value between 0 and 65535 (inclusive). Optional. This priority applies to all the routes that you configure for a session. Google Cloud gives greater preference to routes that have smaller priority values. That is, a route with a priority of 100 is given greater preference than one with a priority of 200. If you don't define a priority, internally Google Cloud applies a default priority of 100.

Best path selection

Cloud Router evaluates custom learned routes as follows:

  • If a route is configured as a custom learned route for multiple BGP peers, Google Cloud gives preference to the route that has the smallest priority value, as described in the preceding section.

  • If multiple routes with different next hops share the same priority, Google Cloud uses equal-cost multipath (ECMP) to allocate traffic among the routes.

If custom learned routes overlap with routes that were learned from BGP peers, they are evaluated together. That is, the best custom learned routes and the best routes learned through BGP are evaluated together as described in the preceding list.

Custom learned routes also honor the dynamic routing mode of the network and all other routing behavior that affects learned routes.

Virtual Private Cloud (VPC) networks also use other types of routes, and Google Cloud uses a set of rules to select routes. For information about this process, see Routing order in the VPC documentation.

BGP state changes

Custom learned routes become active when their related BGP session is established. If the BGP session goes down, the availability of the routes varies as follows:

  • If the session goes down because of a connection problem, such as a physical problem with a Cloud Interconnect connection, the custom learned routes are suppressed. This behavior prevents traffic from being dropped.

  • If a session goes down temporarily because of a Cloud Router maintenance event, the custom learned routes are not suppressed, as long as BGP graceful restart is enabled. Cloud Router maintenance events typically take less than 60 seconds and are designed so that they don't stop data traffic from being forwarded. If graceful restart is not enabled, the routes are suppressed.

  • If a session goes down because of a planned Cloud Interconnect maintenance event, custom learned routes are withdrawn. For this reason, make sure that your Cloud Interconnect configuration is designed for high availability.

Benefits

Custom learned routes can be helpful if you want to avoid the limitations of static routes. Like custom learned routes, static routes let you manually define a route. However, static routes have certain limitations:

  • When you configure a static route, you can't use a Cloud Interconnect VLAN attachment or Cloud VPN HA VPN tunnel as the next hop. Custom learned routes don't have these limitations.

  • Static routes can't detect a loss of reachability in the next hop of a route. In contrast, custom learned routes can detect a loss of reachability, and they react accordingly to avoid dropping traffic without notification. For more information about this behavior, see BGP state changes.

Limitations

Custom learned routes have the following limitations.

Google Cloud limits on custom learned routes

Limits exist for both of the following:

  • For a given BGP session, there is a maximum number of custom learned routes that can be specified.

  • For a given region in a VPC network, there is a maximum number of unique IP address ranges that can be configured as custom learned routes. This limit allows for the same ranges to be used on multiple peers.

Custom learned routes are also affected by limits that affect all learned routes, including those that are learned through BGP peers.

For more information, see Limits.

Site-to-site data transfer is not supported

The Network Connectivity Center site-to-site data transfer feature doesn't honor custom learned routes. This feature lets you use the Google network as a wide area network (WAN) that connects external sites, such as your on-premises networks. If you use custom learned routes on BGP sessions associated with this feature, the routes are not propagated to the external sites.

What's next