Use this when Windows sends traffic out the wrong interface or gateway.
Routing
Windows routing decides which interface and gateway each packet uses, from the routing table with longest prefix match first and then the lowest combined route and interface metric. View it with route print.
1. Find-NetRoute -RemoteIPAddress <dest> — route?
2. Get-NetRoute — expected route present?
3. Metrics if several match.
4. Persistent routes needed?
5. tracert to confirm.
destination → route lookup → next hop/interface
Context & applicabilityCommon mistakes · platform/version boundaries
- VPN clients pushing routes that override local networks.
- Static routes forgotten after network changes.
- Two default routes with equal metric on different networks.
Operational reference
Fast context before you go deeper.
route.exePrimary Commands
Configuration and operational commands for this Topic.
route.exeReferenceDisplay and change the Windows routing table.
Windows / Windows Server / PowerShell · mixedNew-NetRouteConfigureAdd a route to the Windows routing table.
Windows / Windows Server / PowerShell · mixedGet-NetRoute [-DestinationPrefix <prefix>]ReferenceDisplay Windows routes.
Use when: Use after confirming the Windows Networking target and before changing state.
Quick note: Windows / Windows Server / PowerShell. A running Windows service or successful cmdlet does not prove effective policy, replication, authorization or remote consumer success.
Windows PowerShell · mixedGet-NetRouteVerifyWindows route table as PowerShell objects.
Use when: Use after confirming the Windows Networking target and before changing state.
Quick note: Windows / Windows Server / PowerShell. A running Windows service or successful cmdlet does not prove effective policy, replication, authorization or remote consumer success.
Windows PowerShell · mixedGet-NetRoute -AddressFamily IPv4 | Sort-Object RouteMetricVerifyShows Windows route table entries and metrics.
Use when: Use after confirming the Windows Networking target and before changing state.
Quick note: Windows / Windows Server / PowerShell. A running Windows service or successful cmdlet does not prove effective policy, replication, authorization or remote consumer success.
Windows PowerShell · mixedFind-NetRoute -RemoteIPAddress {{destination}}ReferenceShows the route and source address Windows would use for a destination.
Use when: Use after confirming the PowerShell target and before changing state.
Quick note: Windows / Windows Server / PowerShell. A running Windows service or successful cmdlet does not prove effective policy, replication, authorization or remote consumer success.
Windows PowerShell · mixedSubtopics
Go one level deeper into this subject.
The Windows routing table lists destinations, masks, gateways, interfaces and metrics for IPv4 and IPv6, including on-link, loopback, multicast and default routes.
Subtopic Route SelectionWindows route selection first picks the longest matching prefix, then the lowest combined metric among equal prefixes.
Subtopic Longest Prefix MatchLongest prefix match means Windows uses the route with the most specific matching prefix, so 10.1.2.0/24 beats 10.0.0.0/8 and both beat 0.0.0.0/0, regardless of metric.
Subtopic Interface MetricThe interface metric in Windows routing is the cost added to every route on an interface.
Subtopic Route MetricThe route metric is the cost of a specific route. When several routes have the same prefix length, Windows picks the one with the lowest total of route metric plus interface metric.
Subtopic Persistent RoutesPersistent routes survive reboots. Add them with route -p add 10.20.0.0 mask 255.255.0.0 10.0.0.1 or New-NetRoute; routes added without -p disappear at restart.
Subtopic Routing TroubleshootingTroubleshoot Windows routing with route print or Get-NetRoute, Find-NetRoute for the chosen path, tracert to see the hops, and check for duplicate default gateways, VPN routes and wrong interface metrics.
- Longest matching prefix always wins before any metric is compared.
- Among equal prefixes the lowest route + interface metric wins.
- VPN clients add routes and can steal the default route.
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
Reading the routing table
route print
Get-NetRoute | Sort-Object DestinationPrefix
Find-NetRoute -RemoteIPAddress 10.20.0.5
route add 10.20.0.0 mask 255.255.0.0 10.10.20.254 -p # persistent static route
Windows picks the longest matching prefix; among equal prefixes it uses the lowest total metric (route metric + interface metric). -p makes a route survive reboot.
ReferenceHow it works1 section · depth on demand
In depth
Windows hosts route like any IP node: longest prefix match first, then lowest metric (route metric + interface metric). Windows Server can act as a router (RRAS or simple IP forwarding), but that is rarely appropriate in modern networks.
Get-NetIPInterface | ft InterfaceAlias,Forwarding
Set-NetIPInterface -InterfaceAlias Internal -Forwarding Enabled # enables routing between interfaces
Unintended forwarding on multi-homed hosts can bridge security zones — keep Forwarding disabled unless the host is meant to route.
ReferenceImportant terms & boundaries1 section · depth on demand
Reading `route print`
| Column | Meaning |
|---|---|
| Network Destination | Prefix |
| Netmask | Mask |
| Gateway | Next hop (On-link = directly connected) |
| Interface | Local IP used |
| Metric | Route metric + interface metric |
ReferenceConfiguration & state1 section · depth on demand
Commands
route print
Get-NetRoute -AddressFamily IPv4 | Sort-Object RouteMetric
Find-NetRoute -RemoteIPAddress 10.20.30.40
tracert -d 10.20.30.40
Documented example, not captured output.
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. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/windows-server/networking/ · confidence 94%