Networks and tunnel routing (original) (raw)

This page describes supported Virtual Private Cloud (VPC) networks and routing options.

For definitions of terms used on this page, seeKey terms.

Supported networks

Cloud VPN supports custom mode VPC networks, auto mode VPC networks, and legacy networks. However, you should consider the following best practices:

Routing options for VPN tunnels

Classic VPN supports static routing options for VPN tunnels, while HA VPN supports the dynamic routing option. You can use Classic VPN tunnels that use dynamic routing only if the Classic VPN gateway connects to VPN gateway software running inside a Compute Engine VM.

Dynamic routing uses theBorder Gateway Protocol (BGP).

Dynamic (BGP) routing

Dynamic routing uses aCloud Router to automatically manage the exchange of routes by using BGP. A BGP interface on a Cloud Router in the same region as the corresponding Cloud VPN tunnel manages this exchange. The Cloud Router adds and removes routes without requiring that the tunnel be deleted and re-created.

The dynamic routing mode of your VPC network controls the behavior of all its Cloud Routers. This mode determines whether the routes learned from your peer network are applied to Google Cloud resources in the same region as the VPN tunnel, or if they are applied in all regions. You control the routes advertised by your peer router or gateway.

The dynamic routing mode also determines whether subnet routes from only the tunnel's region or all regions are shared with your peer router or gateway. In addition to these subnet routes, you can configure custom route advertisementson a Cloud Router.

Static routing

Classic VPN tunnels support policy-based and route-based static routing options. Consider a static routing option only if you cannot use dynamic (BGP) routing or HA VPN.

You can find more information about these two static routing options in the next section.

Traffic selectors

A traffic selector defines a set of IP address ranges or CIDR blocks used to establish a VPN tunnel. These ranges are used as part of the IKE negotiation for the tunnel. Some literature refers to traffic selectors as encryption domains.

There are two types of traffic selectors:

Traffic selectors are an intrinsic part of a VPN tunnel, used to establish the IKE handshake. If either the local or remote CIDRs need to be changed, the Cloud VPN tunnel and its peer counterpart tunnel must be destroyed and re-created.

Routing options and traffic selectors

The IP range (CIDR block) values for local and remote traffic selectors depend on the routing option used by the Cloud VPN tunnel.

HA VPN tunnels
Tunnelrouting option Localtraffic selector Remotetraffic selector Routesto the VPC network Routesto the peer network
Requiresdynamic (BGP) routing Always0.0.0.0/0 for IPv4 (single-stack) or 0.0.0.0/0,::/0 for IPv4 and IPv6 (dual-stack) or ::/0 for IPv6 (single-stack) Always0.0.0.0/0 for IPv4 (single-stack) or 0.0.0.0/0,::/0 for IPv4 and IPv6 (dual-stack) or ::/0 for IPv6 (single-stack) Unless modified bycustom advertisements, the Cloud Router managing the BGP interface for the Cloud VPN tunnel shares the routes to the subnets in the VPC network according to thedynamic routing mode of the network and quotas and limits for Cloud Router. Subject to restrictions oncustom routes and thequotas and limits for Cloud Router, the Cloud Router managing the BGP interface for the Cloud VPN tunnel learns routes sent to it by the peer VPN gateway, and adds them to the VPC network ascustom dynamic routes.
Classic VPN tunnels
Tunnelrouting option Localtraffic selector Remotetraffic selector Routesto the VPC network Routesto the peer network
Dynamic (BGP) routing Always0.0.0.0/0 Always0.0.0.0/0 Unless modified by custom advertisements, the Cloud Router managing the BGP interface for the Cloud VPN tunnel shares the routes to the subnets in the VPC network according to the dynamic routing mode of the network and quotas and limits for Cloud Router. Subject to restrictions on custom routes and the quotas and limits for Cloud Router, the Cloud Router managing the BGP interface for the Cloud VPN tunnel learns routes sent to it by the peer VPN gateway and adds them to the VPC network as custom dynamic routes.
Policy-based routing Configurable. See policy-based tunnels and traffic selectors. Required. See policy-based tunnels and traffic selectors. You must manually create and maintain the routes to the subnets in your VPC network on your peer routers. If you use the Google Cloud console to create the policy-based VPN tunnel, custom static routes are created automatically. If you use the gcloud CLI to create the tunnel, you must use additional gcloud commands to create the routes. For instructions, seeCreate a Classic VPN using static routing.
Route-based VPN Always0.0.0.0/0 Always0.0.0.0/0 You must manually create and maintain the routes to the subnets in your VPC network on your peer routers. If you use the Google Cloud console to create the route-based VPN tunnel, custom static routes are created automatically. If you use the gcloud CLI to create the tunnel, you must use additional gcloud commands to create the routes. For instructions, seeCreate a Classic VPN using static routing.

Policy-based tunnels and traffic selectors

This section describes special considerations for traffic selectors when you create policy-based Classic VPN tunnels. It does not apply to any other type of Classic VPN or HA VPN tunnel.

You can choose to specify the local traffic selector of a policy-based Cloud VPN tunnel when you create it:

Specify the remote traffic selector of a policy-based Cloud VPN tunnel when you create it. If you use the Google Cloud console to create the Cloud VPN tunnel, custom static routes whose destinations correspond to the CIDRs of the remote traffic selector are automatically created. IKEv1limits remote traffic selectors to a single CIDR. For instructions, seeCreate a Classic VPN using static routing.

Important considerations for traffic selectors

Before you create a Cloud VPN policy-based tunnel, consider the following:

For consistent and predictable VPN behavior, do the following:

Multiple CIDRs per traffic selector

When you create a policy-based Classic VPN tunnel, if you use IKEv2, you can specify multiple CIDRs per traffic selector. Cloud VPN always uses a single Child Security Association (SA), regardless of IKE version.

The following table summarizes Cloud VPN support for multiple CIDRs per traffic selector in policy-based VPN tunnels.

IKE version Multiple CIDRs per traffic selector
IKEv1 No The IKEv1 protocol only supports a single CIDR per Child SA as defined in RFC 2407 and RFC 2409. Because Cloud VPN requires a single Child SA per VPN tunnel, when you use IKEv1, you can only supply a single CIDR for the local traffic selector and a single CIDR for the remote traffic selector. Cloud VPN does not support creating a VPN tunnel by using IKEv1 with multiple Child SAs, each with a single CIDR.
IKEv2 Yes, if the following conditions are met: Your peer VPN gateway uses a single Child SA. All CIDRs for the local traffic selector and all CIDRs for the remote traffic selector must be in a single Child SA. The number of CIDRs that you configure does not cause IKE proposal packets to exceed Cloud VPN's maximum MTU of 1460 bytes. If IKE proposals exceed this MTU, Cloud VPN tunnels don't establish. You don't exceed any restriction for the number of CIDRs supported by your on-premises gateway. For details, consult your gateway vendor's documentation. A best practice is to use 30 or fewer CIDRs per traffic selector so that you don't create an IKE proposal packet that exceeds the maximum MTU.

Traffic selector strategies

Consider the following strategies if your on-premises VPN gateway creates multiple Child SAs per VPN tunnel, or if multiple CIDRs per traffic selector would cause an IKE proposal for IKEv2 to exceed 1460 bytes (for details, seeRouting options and traffic selectors):

  1. Use dynamic routing for the VPN tunnel. If your peer VPN gateway supports BGP, configure both local and remote traffic selectors for the VPN tunnel to allow any IP address. Use 0.0.0.0/0 for IPv4 only or use 0.0.0.0/0,::/0 for IPv4 and IPv6 traffic. Routes are exchanged automatically between the peer VPN gateway and the Cloud Router associated with your Cloud VPN tunnel. If you can use dynamic routing, consider HA VPN.
  2. Use broad, single CIDR traffic selectors and static tunnel routing:
    • Use a route-based VPN. Both traffic selectors are0.0.0.0/0 by definition for route-based VPNs. You can create routes that are more specific than the traffic selectors.
    • Use policy-based routing and configure the local and remote traffic selectors to be as broad as possible. For policy-based Cloud VPN tunnels, you can create routes to on-premises networks in your VPC network whose destinations are more specific than the CIDR blocks specified in the remote traffic selectors. Use the gcloud CLI to create the routes separately from the VPN tunnels by following the steps atCreate a Classic VPN using static routing.
  3. Use policy-based routing to create multiple Cloud VPN tunnels so that each tunnel only has one CIDR block for its local traffic selector and one CIDR block for its remote traffic selector. Configure the on-premises counterpart tunnel in a similar way. Cloud VPN supports multiple tunnels per gateway; however, using multiple tunnels has some implications:
    • Your peer VPN gateway must offer separate external IP addresses to which each Cloud VPN tunnel can connect. Tunnels on the same Classic VPN gateway must connect to unique peer gateway IP addresses. Your peer VPN gateway might also require that its tunnels connect to unique IP addresses. In some situations, you need to create a separate Cloud VPN gateway per Cloud VPN tunnel.
    • When you use the Google Cloud console to create route-based or policy-based Cloud VPN tunnels, routes to the peer network are automatically created in addition to the tunnel. If routes are automatically created for multiple VPN tunnels that each use the same remote traffic selectors—as is the case if you create route-based VPNs—you can have multiple routes in your VPC network, all with identical destinations but different next hops. This can lead to unpredictable or unexpected behavior because traffic is delivered to a VPN tunnel according to the applicability and order of routes. If you don't use dynamic (BGP) tunnel routing, create and review static routes in both your VPC network and your peer network.

What's next