# Route

Global VPC currently supports six types of routes: **Subnet Routes, Static Routes, Policy-based Routes, Dynamic Routes, NAT Gateway Routes,** and **Default Internet Gateway Routes**.

## Subnet Routes

Subnet routes are automatically generated by the system and share the same lifecycle as the subnet. They cannot be deleted independently.\
Each time a subnet is created in a Global VPC, a corresponding subnet route is automatically generated with:

* **Destination IP range**: the subnet IP range (IPv6 subnet uses private or public IPv6 CIDR)
* **Next hop type**: subnet
* **Next hop ID**: subnet ID
* **Next hop region**: the region of the subnet

## Static Routes

Static routes are created by users. The destination IP range is user-defined but must not be more specific than the destination of any subnet route.

* **Next hop type**: Instance (primary network interface) or network interface
* **Next hop ID**: network interface ID
* **Next hop region**: the region of the network interface

## Policy-based Routes

Policy-based routes extend static routes by adding **source IP matching**. The source IP address is mandatory.

## Dynamic Routes

Dynamic routes are automatically learned and generated by the Border Gateway via Cloud Networking Layer 3 Cloud Router connections. They cannot be edited and have a fixed route priority of **65535**.

The scope of dynamic routes depends on the Border Gateway dynamic routing mode:

* **Regional mode**: routes are effective only within the corresponding region
* **Global mode**: routes are effective across the entire Global VPC

## NAT Gateway Routes

NAT gateway routes are automatically generated when a public NAT gateway is associated with a subnet or a Border Gateway.

* **Source IP range**: subnet IP range or Border Gateway
* **Destination IP range**: `0.0.0.0/0`
* **Next hop type**: NAT Gateway
* **Next hop region**: the region of the NAT gateway

## Default Network Gateway Routes

Default network gateway routes are automatically generated when an elastic compute is bound to an elastic IP.

* **Source IP address**: the private IP of the elastic compute instance
* **Destination IP range**:
  * IPv4: `0.0.0.0/0`
  * IPv6: `::/0`
* **Next hop type**: Network Gateway
* **Next hop ID / region**: empty

{% hint style="info" %} <mark style="color:blue;">**Note**</mark>

<mark style="color:blue;">Default Network Gateway Routes are</mark> <mark style="color:blue;">**not visible**</mark> <mark style="color:blue;">in the Console.</mark>
{% endhint %}

## Matching Order

In the VPC route table, the priority of the route types from highest to lowest is:

1. **Policy-based Routes**
2. **Subnet Routes**
3. **Static Routes = Dynamic Routes**
4. **Default Network Gateway Routes**
5. **NAT Gateway Routes**

Overall, routing follows the **“most specific destination prefix first”** principle. The matching logic is consistent with Linux routing tables and aligns with major public cloud providers such as Google Cloud, AWS, and Alibaba Cloud.

### Route Matching Flow in Global VPC

The table below summarizes the route matching order from highest to lowest priority in a Global VPC network:

<table><thead><tr><th width="98.90411376953125">Priority</th><th width="148.788330078125">Route Type</th><th width="313.6861572265625">Matching Order</th><th>Note</th></tr></thead><tbody><tr><td>1</td><td>Layer 2 Direct Connectivity</td><td>Traffic is forwarded at Layer 2 if source and destination are within the same network.</td><td>If not matched, proceed to Policy-based Routes.</td></tr><tr><td>2</td><td>Policy-based Routes</td><td><ol><li>Match by policy priority (higher priority first).</li><li>If priorities are equal, match the longest source prefix.</li><li>If source prefixes are equal, match the longest destination prefix.</li></ol></td><td>If not matched, proceed to Subnet Routes.</td></tr><tr><td>3</td><td>Subnet Routes</td><td>Direct traffic within the specified subnet and match by longest destination prefix.</td><td>If not matched, proceed to Static and Dynamic Routes.</td></tr><tr><td>4</td><td>Static Routes = Dynamic Routes</td><td><ol><li>Match by longest destination prefix.</li><li>If destination prefixes are equal, match by route priority (higher priority first).</li></ol></td><td>If not matched, proceed to Default Network Gateway Routes.</td></tr><tr><td>5</td><td>Default Network Gateway Routes</td><td>Matched only when the instance is bound to an elastic IP.</td><td>If not matched, proceed to NAT Gateway Routes.</td></tr><tr><td>6</td><td>NAT Gateway Routes</td><td><ol><li>Match by source (subnet or Border Gateway).</li><li>After source match, match by longest destination prefix.</li></ol></td><td>If no NAT gateway route matches, the packet is dropped.</td></tr></tbody></table>

This table represents the order of route types used for matching within a Global VPC network following the "most specific destination prefix first" principle.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/welcome/elastic-compute/networking/route.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
