guide · static export
PC · network

Add a Persistent Route to a Second Network

Two networks, one PC, and traffic leaves through the wrong interface. A persistent route plus the right interface metric sends each subnet where it belongs.

by@guidox updated:10/31/26 time:25 min level:Advanced tested on:Windows 11 24H2 works on:Windows 10, Windows 11, Windows Server 2019 tools:PowerShell as administrator
TL;DR

Read **Get-NetRoute**, add the route into the **PersistentStore** with **New-NetRoute**, and adjust **InterfaceMetric**. Verify with **Find-NetRoute** before you test with ping.

Before you start

Requirements

  • Admin rights
  • Two network adapters or subnets
  • 25 minutes
Step by step

Instructions

01

Read the routing table as it is

Every route has a **metric** and an **interface**. The lowest total metric wins, which is why the second network silently loses traffic to your default gateway.

Get-NetRoute -AddressFamily IPv4 | Sort-Object DestinationPrefix,RouteMetric |
  Select-Object DestinationPrefix,NextHop,InterfaceIndex,RouteMetric,InterfaceMetric | Format-Table -AutoSize
02

Identify the interfaces by index, not by name

Routes bind to an interface index. Names change with language and driver reinstall, indices change when adapters come and go — read both, then use the index in every command.

Get-NetIPConfiguration | Select-Object InterfaceIndex,InterfaceAlias,@{n='IP';e={$_.IPv4Address.IPAddress}},@{n='GW';e={$_.IPv4DefaultGateway.NextHop}}
03

Add the route into the persistent store

**PersistentStore** survives reboots; the active store does not. Writing into both at once is what the ActiveStore and PersistentStore parameters are for.

New-NetRoute -DestinationPrefix '10.20.0.0/16' -NextHop 192.168.50.1 -InterfaceIndex 12 -PolicyStore PersistentStore
Get-NetRoute -DestinationPrefix '10.20.0.0/16' -PolicyStore PersistentStore
tipThe classic form still works and is easier to copy into a script: **route -p add 10.20.0.0 mask 255.255.0.0 192.168.50.1**.
04

Fix the metric that overrides the route

A route with a worse metric loses to the default gateway even when its prefix is more specific. Setting the interface metric makes the intended path win deterministically.

Set-NetIPInterface -InterfaceIndex 12 -InterfaceMetric 5
Get-NetIPInterface -InterfaceIndex 12 | Select-Object InterfaceAlias,InterfaceMetric,Dhcp
⚠ warningA lower metric on the wrong interface pulls all traffic there, including internet access. Change one interface metric, then test, then the next.
05

Verify the decision, not just reachability

**Find-NetRoute** shows which source address and interface Windows chose for a destination. That answers the real question before a single packet leaves.

Find-NetRoute -RemoteIPAddress 10.20.5.5 | Select-Object IPAddress,InterfaceIndex,DestinationPrefix,NextHop
tracert -d -h 5 10.20.5.5
06

Remove a route you no longer need

Removing from the persistent store is the step people forget, and the route returns at the next boot. Check both stores afterwards.

Remove-NetRoute -DestinationPrefix '10.20.0.0/16' -NextHop 192.168.50.1 -Confirm:$false -PolicyStore PersistentStore
route print -4 | Select-String '10.20.'
Troubleshooting

Common issues

The route exists but traffic still leaves elsewhere

The metric order or a more specific route wins. Compare Find-NetRoute output with Get-NetRoute for the same destination.

The route disappears after a reboot

It was written to the active store only. Re-add it with -PolicyStore PersistentStore and confirm with the same parameter.

The next hop is unreachable

The gateway must be on the same subnet as the interface you bound the route to. Check the interface address and prefix length.

A VPN client wipes the routes

Many clients rewrite the table on connect. Add the route in the client's own configuration or reapply it with a scheduled task.

FAQ

Frequently asked

Route or second default gateway?

A specific route for one subnet. Two default gateways produce a fight over metrics and intermittent behaviour.

Do persistent routes survive a network reset?

A stack reset can clear the active store but the persistent entries usually return. Keep the command in a script so you can reapply it in seconds.

How to undo this

Delete the entry with Remove-NetRoute -PolicyStore PersistentStore or route delete, and set the interface metric back to Automatic with Set-NetIPInterface -InterfaceMetric 0.

Changelog · 1 entry
  1. 2026-10-31
    First version
Interactive version: checklist, feedback, related guides →

Free · no account needed · tracks your progress