Skip to content

Windows route command

In this example I have connected to a VPN and only certain servers are meant to be accessed via the VPN.

The IP I have been given by the VPN is 192.168.2.22

Terminal window
route add 123.123.123.123 mask 255.255.255.255 192.168.2.22

Any network connection to 123.123.123.123 will go via the VPN.

Terminal window
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.

To make it permanent you must add the -p switch

Terminal window
route -p add 123.123.123.123 mask 255.255.255.255 192.168.2.22

Next time the computer is rebooted the route will reappear.

Use route print. The command will show you the active route table.