Pcornel
Browse topics
Options
Recent
Favorites
Windows · Technical reference

Routing

Direct answer

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.

When to use this

Use this when Windows sends traffic out the wrong interface or gateway.

First 30 seconds

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.

Operational verification

destination → route lookup → next hop/interface

Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common mistakes
  • VPN clients pushing routes that override local networks.
  • Static routes forgotten after network changes.
  • Two default routes with equal metric on different networks.
Platform / version applicability
Windows networking and network services
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformWindows networking and network services · Windows / Windows Server / PowerShell · Windows PowerShell
Key commandroute.exe
Scope / prerequisiteUse this when Windows sends traffic out the wrong interface or gateway.
Configure · 1Verify · 2Reference · 3
What next?2 suggested next steps
Child topics (this level)7
Catalog command links6
Evidence0
On this pageJump to a specific section
Windows command reference

Primary Commands

Configuration and operational commands for this Topic.

Drill down

Subtopics

Go one level deeper into this subject.

Key points
  • 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.
Key checks
  • Get-NetRoute — routing table
  • Find-NetRoute -RemoteIPAddress <ip> — selected route and source
  • route print — routing table in CMD
  • tracert <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
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
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docWindows networking and network services current

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%
Confirmation

Confirm action

Continue?