Networking HowTos
Networking HowTos

Adding a Static Route in Windows

July 23, 2012 Microsoft, Windows

There may be times when you need to set up a static route in Windows to allow your PC to access a network that is not accessible via the default gateway route. An example of this would be if you had a inter office VPN. You would want your main internet traffic to go via a default gateway (your main cable/adsl router), and traffic destined for the subnet of the other office would go via the device managing the VPN connection, assuming its not the same device that is managing the main internet connection.
Setting up a static route in Windows:
Open the command prompt
(If using windows Vista/Windows 7/Windows 2008/or higher, you will need to run the command prompt using the “run as administrator” option).
Adding the static route:

route add <destination> mask <netmask> <gateway>

Destination = The destination network address.
Netmask = The netmask for the destination network.
Gateway = The gateway/router ip address to route the traffic through.

route add mask

This adds a route for the network, so that traffic destined for this network gets routed through The gateway address must be on on the same network subnet that you are on.
To make a route persistent across reboots, make sure to add the “-p” parameter to the route command.

route -p add mask

Test connectivity using the ping and tracert (trace route) commands to make sure the destination network is accessible and going via the correct route.

You Might Also Like