Routes

Represents a Route resource.

A route is a rule that specifies how certain packets should be handled by the virtual network. Routes are associated with virtual machines by tag, and the set of routes for a particular virtual machine is called its routing table. For each packet leaving a virtual machine, the system searches that virtual machine's routing table for a single best matching route.

Routes match packets by destination IP address, preferring smaller or more specific ranges over larger ones. If there is a tie, the system selects the route with the smallest priority value. If there is still a tie, it uses the layer three and four packet headers to select just one of the remaining matching routes. The packet is then forwarded as specified by the next_hop field of the winning route -- either to another virtual machine destination, a virtual machine gateway or a Compute Engine-operated gateway. Packets that do not match any route in the sending virtual machine's routing table will be dropped.

For more information, review the routes documentation.

For a list of methods for this resource, see the end of this page.

Resource representations

Represents a Route resource. A route specifies how certain packets should be handled by the network. Routes are associated with instances by tags and the set of routes for a particular instance is called its routing table.

For each packet leaving a instance, the system searches that instance's routing table for a single best matching route. Routes match packets by destination IP address, preferring smaller or more specific ranges over larger ones. If there is a tie, the system selects the route with the smallest priority value. If there is still a tie, it uses the layer three and four packet headers to select just one of the remaining matching routes. The packet is then forwarded as specified by the nextHop field of the winning route - either to another instance destination, an instance gateway, or a Google Compute Engine-operated gateway.

Packets that do not match any route in the sending instance's routing table are dropped.

{
  "kind": "compute#route",
  "id": unsigned long,
  "creationTimestamp": string,
  "name": string,
  "description": string,
  "network": string,
  "tags": [
    string
  ],
  "destRange": string,
  "priority": unsigned integer,
  "nextHopInstance": string,
  "nextHopIp": string,
  "nextHopNetwork": string,
  "nextHopGateway": string,
  "warnings": [
    {
      "code": string,
      "message": string,
      "data": [
        {
          "key": string,
          "value": string
        }
      ]
    }
  ],
  "nextHopVpnTunnel": string,
  "selfLink": string
}
Property name Value Description Notes
creationTimestamp string [Output Only] Creation timestamp in RFC3339 text format.
description string An optional description of this resource. Provide this property when you create the resource.
destRange string The destination range of outgoing packets that this route applies to. Only IPv4 is supported.
id unsigned long [Output Only] The unique identifier for the resource. This identifier is defined by the server.
kind string [Output Only] Type of this resource. Always compute#routes for Route resources.
name string Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
network string Fully-qualified URL of the network that this route applies to.
nextHopGateway string The URL to a gateway that should handle matching packets. You can only specify the internet gateway using a full or partial valid URL: projects/<project-id>/global/gateways/default-internet-gateway
nextHopInstance string The URL to an instance that should handle matching packets. You can specify this as a full or partial URL. For example:
https://www.googleapis.com/compute/v1/projects/project/zones/zone/instances/
nextHopIp string The network IP address of an instance that should handle matching packets. Only IPv4 is supported.
nextHopNetwork string [Output Only] The URL of the local network if it should handle matching packets.
nextHopVpnTunnel string The URL to a VpnTunnel that should handle matching packets.
priority unsigned integer The priority of this route. Priority is used to break ties in cases where there is more than one matching route of equal prefix length. In the case of two routes with equal prefix length, the one with the lowest-numbered priority value wins. Default value is 1000. Valid range is 0 through 65535.
tags[] list A list of instance tags to which this route applies.
warnings[] list [Output Only] If potential misconfigurations are detected for this route, this field will be populated with warning messages.
warnings[].code string [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response.
warnings[].data[] list [Output Only] Metadata about this warning in key: value format. For example:
"data": [ { "key": "scope", "value": "zones/us-east1-d" }
warnings[].data[].key string [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding).
warnings[].data[].value string [Output Only] A warning data value corresponding to the key.
warnings[].message string [Output Only] A human-readable description of the warning code.

Methods

The following are valid Route resource methods:

delete
Deletes the specified Route resource.
get
Returns the specified Route resource. Get a list of available routes by making a list() request.
insert
Creates a Route resource in the specified project using the data included in the request.
list
Retrieves the list of Route resources available to the specified project.

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Compute Engine