
When a VM sends a packet, its VPC network picks the route with the most specific matching destination. This is longest prefix match. Route priority only matters as a tiebreaker between routes with the same prefix length, and a lower priority number means a higher priority. A /30 route always beats 0.0.0.0/0 for its range, and between two 0.0.0.0/0 routes, priority 500 beats priority 1000. Those two rules, together with the protections Google Cloud gives subnet routes and the limits on what a static route can point at, explain most routing behavior on the Professional Cloud Network Engineer exam.
Route selection happens in a fixed order. The VPC network first finds the most specific destination range that contains the packet's address. Only when two or more routes share that same prefix length does priority come into play. No priority value can make a broader route win over a more specific one.
That order matters when address ranges overlap. If a subnet in the VPC network overlaps a broader range learned from on-premises over BGP, the subnet route is more specific for every address inside the subnet, so traffic for those addresses stays in the VPC network instead of crossing the hybrid connection. A dynamic route can't override a subnet route for addresses inside that subnet, whatever its priority. That is why address planning for hybrid networks keeps cloud subnets clear of on-premises ranges.
Every subnet has a system-generated subnet route, and Google Cloud protects those routes in several ways:
Taken together, these rules mean a static route can't take over traffic that matches a subnet route in the same VPC network. Policy-based routes are the separate mechanism for changing the path of traffic between local subnets.
A custom static route sends traffic for a destination range to a next hop you choose. The next hop must be something the VPC network can deliver to, and there are four kinds to know.
A VPN tunnel. A static route into a Classic VPN tunnel uses the tunnel itself as the next hop. In gcloud compute routes create, you give the tunnel name with --next-hop-vpn-tunnel and the tunnel's region with --next-hop-vpn-tunnel-region.
An instance. A route with a next hop instance must reference a VM in the same VPC network as the route. A route in one network can't point at a VM, such as a firewall appliance, that lives in a peered network.
An internal passthrough Network Load Balancer. The forwarding rule of an internal passthrough Network Load Balancer can be a next hop. Compared with naming instances directly, this adds health checking, so the load balancer stops sending new connections to a backend that fails its check.
The default internet gateway. This next hop sends traffic to the internet. It doesn't deliver traffic to internal destinations, so a static route that sends another network's internal ranges to the default internet gateway never reaches the instances in that network.
A VPC Network Peering connection can't be a next hop. Peered networks learn each other's subnet routes through the peering itself, and a custom static route can't point at it.
Every VPC network has a system-generated default route for 0.0.0.0/0 that points to the default internet gateway with priority 1000. A custom route for the same destination is equally specific, so priority decides between them, and the lower number wins. Routes for narrower ranges, including subnet routes, are unaffected by that choice.
Network tags narrow a custom static route to specific VMs. A tagged route applies only to VMs that carry a matching tag, and every other VM ignores it. Tags aren't fixed at creation time, since a network tag can be added to a running VM without stopping or recreating it.
Peering changes which routes a network can see. Peered networks exchange subnet routes, while custom routes, such as static routes and dynamic routes, reach a peer only when one side exports them and the other imports them. Tagged routes aren't shared over peering at all. When a network already has its own route for a destination, such as its own default internet gateway route, that local route is preferred over an equally specific route imported from a peer.
Exporting and importing custom routes doesn't make peering transitive. It shares custom routes across a single peering, but it never passes routes learned from one peer on to a different peer.
For the Professional Cloud Network Engineer exam, it helps to evaluate a routing scenario in the same order the VPC network does. Check for a policy-based route first, since those are evaluated before subnet routes. Then find the most specific matching route, and use priority only to break ties between equal prefix lengths. Remember that subnet routes can't be deleted or overridden by static or dynamic routes, and confirm that every next hop is one the network can actually deliver to: a VPN tunnel, an instance in the same network, an internal passthrough Network Load Balancer or the default internet gateway.
Our Professional Cloud Network Engineer practice exams cover VPC routing alongside policy-based routes and VPC Network Peering, with detailed explanations that drill these distinctions.