Applies to: Windows Server 2019, Windows Server 2022 and Windows Server 2025, subject to the workload and edition requirements below.
Use a static route for a specific forwarding decision
A static route tells Windows which next hop and interface to use for a destination prefix. It is useful when a server needs a path to a management, storage or remote-site network that differs from its default gateway. It does not create the remote network, authorize traffic through a firewall or supply a return route on another router. Those pieces must agree for a connection to work.
This guide adds one IPv4 route to 10.90.0.0/24 through a verified local gateway and removes only that exact route during rollback. The addresses are illustrative. Do not copy them onto a network where they overlap existing destinations. The same principles apply to IPv6, but its next-hop addressing and interface-scoped details need their own reviewed configuration rather than a mechanical substitution of address strings.
Read the current route table and preserve management access
Use elevated Windows PowerShell on the intended server. Record the complaint or requirement, local addresses, adapter indexes and existing routes before making a change. An interface index is a local identifier, not a portable value across servers. Identify the adapter through its name, address, MAC and network purpose rather than assuming interface 12 is always the management NIC.
Get-NetAdapter | Select-Object Name,ifIndex,MacAddress,Status
Get-NetIPConfiguration
Get-NetRoute -AddressFamily IPv4 | Sort-Object DestinationPrefix,RouteMetric
Get-NetIPInterface -AddressFamily IPv4 | Select-Object InterfaceAlias,InterfaceIndex,InterfaceMetric,ConnectionStateKeep console or alternate access available if changing the path used by your administration session. A route to the subnet containing your own workstation can immediately redirect replies and disconnect you. Save the baseline outside the current session. If a VPN, RRAS, clustering or another management system owns the route, change the owning configuration instead of fighting its periodically reapplied state.
Confirm prefix, next hop and effective preference
Specify the intended destination as a network prefix, such as 10.90.0.0/24, rather than a host address with a misleading mask. A /32 route addresses one IPv4 host. A default route, 0.0.0.0/0, is far broader than a departmental subnet route and should not be added just to solve one reachability failure. The next hop must be reachable through the chosen local interface under the network design.
Windows first prefers the most specific matching prefix. Where matching routes have the same specificity, route and interface metrics influence preference. Therefore a lower metric on a broad default route does not override a more specific /24. Review both metrics and the actual selected source/interface before concluding that the new route is being ignored.
Ask the destination-side owner to confirm the return path to this server’s source subnet. A one-way route can deliver requests while replies go elsewhere. Check firewalls and any intermediate network-address translation as part of the same path. A static route is a forwarding instruction, not a bidirectional connectivity contract.
Add the exact route with an explicit interface
The following example selects the adapter by its reviewed alias and verifies that exactly one match exists. It adds a persistent route through an illustrative on-link gateway. Confirm no equivalent destination, interface and next-hop entry already exists before running the creation command.
$nic = @(Get-NetAdapter -Name 'LAN-Private' -ErrorAction Stop)
if ($nic.Count -ne 1) { throw 'Select exactly one intended interface.' }
Get-NetRoute -DestinationPrefix '10.90.0.0/24' -ErrorAction SilentlyContinue
New-NetRoute -DestinationPrefix '10.90.0.0/24' `
-InterfaceIndex $nic[0].ifIndex -NextHop '10.40.0.254' `
-RouteMetric 25 -PolicyStore PersistentStore
Get-NetRoute -DestinationPrefix '10.90.0.0/24'PersistentStore records the route for persistence; verify both persistent and active state after creation on the target release. If you deliberately need a temporary diagnostic route, use the active policy store and document that it will not survive a restart. Do not create duplicate routes in both stores by habit. A failed creation should prompt inspection of the existing object and gateway reachability rather than repeated additions with different metrics.
Verify the selected path and application connection
Check the route in the intended stores and ask Windows which route it selects for a representative destination. The selected source address should belong to the planned interface. On multihomed servers this is important because a firewall or remote router may permit only one source subnet.
Get-NetRoute -DestinationPrefix '10.90.0.0/24' -PolicyStore PersistentStore
Get-NetRoute -DestinationPrefix '10.90.0.0/24' -PolicyStore ActiveStore
Find-NetRoute -RemoteIPAddress '10.90.0.20'
Test-NetConnection -ComputerName '10.90.0.20' -Port 443 -InformationLevel DetailedThe TCP test should succeed only if port 443 is the actual approved service; substitute the real application port. Verify the application itself after transport works. A failed ping does not prove routing failure because ICMP may be blocked. Conversely, a successful ping does not establish that the application port or authentication path is usable. Test from the actual server that needs the route rather than a nearby workstation with a different route table.
Distinguish routing from DNS, firewall and remote faults
If the service works by IP but not by name, inspect DNS results and whether they point to an unexpected subnet or IPv6 destination. Your new IPv4 route has no effect on a connection using an IPv6 address. If Windows selects the right next hop but the TCP connection fails, check local firewall, gateway forwarding, downstream ACLs and the remote host’s listener and return route.
Use tracert or Test-NetConnection route diagnostics as supporting evidence, recognizing that routers may suppress or rate-limit probes. Asterisks do not automatically identify the failing hop. Correlate an actual application connection with network captures or firewall logs when the path remains ambiguous. Do not disable all firewall profiles or add another default gateway simply because a diagnostic probe is incomplete.
If a route disappears, identify whether it was active-only, removed by an adapter recreation or managed by another service. A changed interface index after hardware or virtual-switch changes can make a saved script target the wrong adapter. Prefer resolving the current intended interface by verified identity whenever applying a configuration.
Change and remove only the intended object
When adjusting an existing route, retain its destination, interface and next-hop identity and modify only the reviewed property. For removal, filter all three values so another route to the same prefix remains untouched. Preview the result before confirming the actual removal.
$route = Get-NetRoute -DestinationPrefix '10.90.0.0/24' `
-InterfaceIndex $nic[0].ifIndex -NextHop '10.40.0.254' `
-PolicyStore PersistentStore
$route | Format-List DestinationPrefix,InterfaceAlias,NextHop,RouteMetric
$route | Remove-NetRoute -WhatIf
# After reviewing the exact object:
# $route | Remove-NetRouteVerify whether the active route remains and remove a corresponding active-only object only if it belongs to this change and is not required by another service. Do not run Get-NetRoute piped unfiltered into Remove-NetRoute. That can remove default, connected or service-managed paths and disconnect the server. Keep confirmation prompts meaningful rather than suppressing them to make a cleanup script shorter.
Rollback and document the complete path
Rollback restores the prior route selection, not merely the absence of one command’s output. If an old route was replaced, recreate its recorded next hop, interface, store and metric. Recheck management access and the original application path. A persistent configuration that looks correct now should also be checked after a planned restart or interface renewal when persistence is part of the requirement.
Record the route owner, purpose, destination, next hop, interface identity, metric, policy store and remote return-path dependency. Review it when networks migrate or VPN topology changes. Remove obsolete routes through the same controlled process so a later application does not unexpectedly send traffic into a retired network. Clear ownership and a verified bidirectional path make a static route maintainable rather than an unexplained exception hidden in the server.
Related guidance and official references
Configure a site-to-site VPN; Troubleshoot network connectivity; Scope a firewall rule.