Route Add Windows Command to Add Persistent Static Route in Windows 10/Server

add static route windows

Adding a static route in Microsoft Windows 10 or Server is done by using the route add command.

The following is the general syntax of the route add command we need to follow to add a permanent static route in Windows:

route add -p <destination> mask <subnet-mask> <gateway>

For example, the following route command tells the windows to add a new persistent route to the network, using as the gateway to reach the network.

route add -p mask

When you want to add a static route to a single host, use the netmask

For example, the following command adds a static route to the destination host with the gateway address

route add -p mask

The most important part of the route add command is the -p option. Without the -p switch, our new route would not be persistent. It will disappear the next time you reboot your Windows PC/Server.

We can print the windows routing table using the route print command. Under the Persistent Routes header, you will see the list of permanent static routes.

Windows routing table
Routing Table

Following is another static route example with a metric value:

route add -p mask metric 5

In case if you have more than one network interface, you could also specify the interface ID using the if command option.

route add -p mask if 1

When specifying the network interface, you have to provide the interface ID which you can find using the route print command.

Route Add Windows Command to Add Persistent Static Route in Windows

Windows hold permanent static routes in the following registry
location: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servi