Associate Cloud Engineer ยท Managing network resources
How does a VPC choose between several routes for one packet?
Routes, priority, next hop options, tags on routes, default route to the internet gateway, route precedence.
Key points
- First keep routes whose destination contains the packet's address and that apply to the VM (a route with a network tag applies only to VMs with that tag).
- Most specific destination wins: /24 beats /16 beats the 0.0.0.0/0 default route to the internet gateway.
- Priority (lower number wins) only separates routes of equal specificity.
- Static route next hop: a VM, internal passthrough load balancer or VPN tunnel.
Source: https://docs.cloud.google.com/vpc/docs/routes
Practice questions
What is the next hop of the system-generated default route in a new VPC network?
- The default internet gateway
- The first VM created in the network
- A Cloud Router in the nearest region
- The Cloud NAT gateway of the project
Show answer
Answer: A. The default internet gateway
The default route 0.0.0.0/0 points at the default internet gateway. It can be deleted or replaced, and it is used only when no more specific route matches.
Which can be used as the next hop of a custom static route?
- A Compute Engine VM instance
- An internal passthrough Network Load Balancer
- A Cloud VPN tunnel
- A VPC firewall rule
- A Cloud DNS managed zone
Show answer
Answer: A. A Compute Engine VM instance, B. An internal passthrough Network Load Balancer, C. A Cloud VPN tunnel
Static routes can point to a VM instance, an internal passthrough Network Load Balancer or a Cloud VPN tunnel. A firewall rule is a filter, not a forwarding target, and a DNS zone only resolves names.
True or false: a route with priority 1 always overrides a route with a more specific destination but priority 1000.
Show answer
Answer: False
False. Specificity is evaluated first; priority only breaks ties between routes with the same destination specificity.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
