Windows route command
Adding a routing
In this example I have connected to a VPN and only certain servers are meant to be accessed via the VPN.
Routing a single IP
The IP I have been given by the VPN is 192.168.2.22
route add 123.123.123.123 mask 255.255.255.255 192.168.2.22
Routing a subnet
Any network connection to 123.123.123.123 will go via the VPN.
route add 192.168.1.0 mask 255.255.255.0 192.168.2.22
Any network connection to 192.168.1.* will go via the VPN.
Making a route permanent
To make it permanent you must add the -p switch
route -p add 123.123.123.123 mask 255.255.255.255 192.168.2.22
Next time the computer is reboot the route will reappear.
Checking active routes
Use "route print" the command will show you the active route table.
Published: Monday, 14 February 2011

