Use it when traffic goes through a VPN or another interface although the default route points elsewhere.
Longest Prefix Match
Like a router, Windows uses the most specific route that contains the destination: a /24 to a VPN wins over the /0 default route, whatever the metrics.
1. List matching prefixes for the destination.
2. Most specific wins regardless of metric.
3. A /32 or more specific VPN route overrides default.
4. Remove or adjust the specific route.
5. Verify with Find-NetRoute.
all routes containing the destination → longest prefix wins
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Get-NetRoute -DestinationPrefix 10.20.0.0/16Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Commands Verify boundary
Get-NetRoute -DestinationPrefix 10.20.0.0/16
Find-NetRoute -RemoteIPAddress 10.20.5.9
route print -4
Step 2 Common mistakes Narrow the fault
- Assuming metric beats prefix length.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Metrics only decide between routes of the same prefix length. A VPN that pushes specific routes takes those destinations regardless of interface metrics. Check with Get-NetRoute for routes containing the destination.
Get-NetRoute— routing tableFind-NetRoute -RemoteIPAddress <ip>— selected route and sourceroute print— routing table in CMDtracert <dest>— path
ReferenceWhy it matters1 section · depth on demand
Worked example
Longest prefix match: the most specific matching route wins regardless of metric.
Worked example: routes 10.0.0.0/8 via 10.1.1.1 (metric 1), 10.20.0.0/16 via 10.2.2.1 (metric 50), 0.0.0.0/0 via 192.168.1.1. Destination 10.20.5.9 → /16 route (longest match, despite higher metric). Destination 10.99.0.1 → /8 route. Destination 8.8.8.8 → default route.
Find-NetRoute -RemoteIPAddress 10.20.5.9
ReferenceImportant terms & boundaries1 section · depth on demand
Example
Routes: 0.0.0.0/0 → 10.0.0.1, 10.0.0.0/8 → VPN, 10.20.0.0/16 → 10.0.0.254. A packet to 10.20.5.9 uses the /16 (longest match), 10.99.1.1 uses the /8 via VPN, 8.8.8.8 uses the default route. Check with Find-NetRoute -RemoteIPAddress 10.20.5.9.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Routing → Longest Prefix Match. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/windows-server/networking/ · confidence 94%