How to add static routes in Windows

Let’s say we have a network with the following data:

– IP address of the gateway (default gateway) –
– subnet mask
– VPN server address
then to add a static route, open the command line (cmd) by clicking on the menu “Start” – “Run” – “cmd” or using the Win+R key combination and type the command:

route ADD -p MASK METRIC 1

Or suppose we have:
– Network:
– IP of the first computer with VPN connection
– IP of the second computer
– IP address of the gateway
It is necessary that the first computer can see the second computer when the VPN connection is enabled:

route –p add mask

You can view the entire routing table with the command:

route print

Commands and keys:
route.exe routing routine;
add – add route command;
change – changes the route in the routing table;
delete – removes a route from the routing table;
gateway – parameter for specifying a gateway;
metric – a parameter that determines the priority from 1 to 9999, which is the cost metric for the route, 1 – the highest;
-f removes all routes from the routing table;
-p save key, without which the added route will disappear after rebooting the computer;
mask – subnet mask.

See also my article:
Configuring Network in Linux

Leave a comment

Leave a Reply