How to Add, Delete and Modify Static Route Windows 10 and Servers

Sometimes you need to create a static route to make communication with a different network that is connected via different gateway than the default gateway. A gateway is simply a network router which routes the network traffic between different networks. When you have more than one gateway (router) on your network, then you may need to implement static route technique on Windows 10, or Windows servers or even any Operating System. A static route will tell the Operating System to send network packets to the appropriate router instead of sending to the default router. This simple guide shows how to add, delete and modify a static route to the routing table on Windows 10 and Server Operating Systems.

There are a few useful commands you must know. Route delete, add and print. These commands will be handy to any user who has administrative access and know which router/gateway should be used for which network.

Why Add Static Route?

It mostly depends on the network setup. Usually, you can add these static routes on your default router (if it can support) or core switch. When you have this setup, you do not need to add a static route to each computer separately on the network. But in a few exceptional cases, you may need to implement static routes on individual computers. Here are a few examples.

  1. You have more than one internet router on the network and you need to send traffic to certain websites (based on their IP addresses) via different router than the default gateway. Let’s say, for example, all traffic to Netflix can be sent via the 2nd internet router where other website traffic can go through the 1st internet router.
  2. There are several VLANs or subnets available on the network. Before building the proper routing table on the router or core switch, adding a static route on your Windows computer will help you to test the connectivity see the traffic flow.
  3. For network security or isolation purpose, certain routes can’t be added to the default gateway device. In this case, as a network administrator, you can add the static route on a local computer to make network communication.

Route Add on Windows 10 and Windows Servers

Make sure you run below commands on command prompt (or PowerShell) which is opened as Administrator.

run as cmd

This is to add a static route to the routing table.

route ADD destination_network MASK subnet_mask  gateway_ip metric_cost
route add mask

It indicates that any packets to (in class C – network should be forwarded to router (gateway).

Obviously the PC/server which we run this command is in network because it should communicate to gateway from the same network.

The issue with the above command is when you shut down or restart the computer, these route entries will be removed. To make it permanent and add to the Windows OS routing table, we should use –p key with the route add command. So, adding a persistent (or permanent) static route on Windows 10 command will be like this;

route add –p mask

Read Also: How to find the IP address of a network printer on Windows OS

Route Print

Route print command is another useful command to view the routes on the Windows routing table and which routes are active at the moment.  If you need to modify a route entry which is already in the routing table on Windows OS, better to confirm it before modifying. To do it, use route print command.

Route print

route print Windows 10

Also, we can view the persistent routes in a Windows OS by checking the following registry path. Look for the entries in this area before or after modifying any routing table entries.

HKEY_LOCAL_MACHINE->SYSTEM->CurrentControlSet-> Services->Tcpip->Parameters->PersistentRoutes

Route Delete on Windows 10/ Windows 2016/2019 Servers

The below command is to delete an existing persistent route from a computer. Even though we added a route entry with the network, network mask and gateway, but to delete, we need to mention the network only. So, it goes like this;

route delete

That will delete the route entry from the computer. You do not need to restart the computer to take effect, route add and delete commands work almost instantly.

How to Modify a Static Route Entry on Windows 10

Let’s say that after the recent network change, now the network should be routed through gateway. Obviously you have to modify the existing route for this network and change the gateway to, how to modify it?

You can’t modify an existing route entry. The simple method is to delete it and add the new route entry. So, in this case, you would perform below commands.

Route delete

Route add –p mask

We hope this simple guide will be helpful in understanding the route add, delete and print commands in Windows 10 client PC and other server Operating Systems. Make sure you open the command prompt or PowerShell as Administrator to perform these commands. If you want to use cosmetic variables to identify the fast hops to reach a network, you can use the metric key as described at Microsoft site here.

Dinesh is the founder of Sysprobs and written more than 400 articles. Enthusiast in Microsoft and cloud technologies with more than 15 years of IT experience.

Pin It on Pinterest