Review default routes
Documentation: Microsoft Learn
Filtering Get-NetRoute to the destination prefix 0.0.0.0/0 returns only the default routes.
The script
Script reader
Inspect before you run
Inspect the script below. It does not run in this browser.
Inspection only — no command has run.
Show reference output
Inspect this example’s structure
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Get-NetRoute -DestinationPrefix 0.0 . 0.0 / 0 | Select-Object ifIndex,NextHop,RouteMetric,InterfaceAlias- Stage 1Get-NetRoute
-DestinationPrefix - Stage 2Select-Object
Positional values or no named parameters
How it works
Filtering Get-NetRoute to the destination prefix 0.0.0.0/0 returns only the default routes. Select-Object reports the interface index and alias next to NextHop and RouteMetric, and the metric is what decides the winner whenever more than one default is present.
Adapting it
Drop the -DestinationPrefix filter and pipe into Where-Object NextHop -ne '0.0.0.0' to review every off-link route instead of just the defaults.
If the result is unexpected
Traffic leaves through the wrong interface even though the intended gateway appears in the output holding the lower metric.
Route selection compares the sum of the route metric and the interface metric, so an attractive RouteMetric can still lose because its interface metric is high. When the totals tie, the choice falls to binding order. Windows also assigns interface metrics automatically from link speed unless that behavior has been overridden.
- Read the interface metrics from Get-NetIPInterface and add them to each candidate's RouteMetric.
- Run Find-NetRoute with a destination address to see which route the stack actually chooses.
- Set an explicit value with Set-NetIPInterface -InterfaceMetric rather than adjusting the route itself.
- Disable automatic metric assignment on the interfaces involved so the values stop shifting with link state.
- Look for a second default route added by a VPN client, which is a common and temporary cause.
Validate the result
Find-NetRoute for a representative destination returns the intended interface, and a traceroute from the host leaves through the expected gateway.
Keep the check reliable
Set interface metrics explicitly on multi-homed servers instead of relying on automatic assignment, and write down the intended egress path.