Windows route command
Adding a routing
Section titled “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
Section titled “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.22Any network connection to 123.123.123.123 will go via the VPN.
Routing a subnet
Section titled “Routing a subnet”route add 192.168.1.0 mask 255.255.255.0 192.168.2.22Any network connection to 192.168.1.* will go via the VPN.
Making a route permanent
Section titled “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.22Next time the computer is rebooted the route will reappear.
Checking active routes
Section titled “Checking active routes”Use route print. The command will show you the active route table.