How do I add a static route in Windows?

When I VPN into my corporate office I can access all of the resources just fine, as if I were in the office, with the exception of one server. While on the VPN I ping the server by name and get the outside public facing ip address of the server. They way I use the server, I have to use it by name as opposed to ip address.

How can I add a route in my Windows machine to temporarily resolve this issue? Lets say the outside address that is returned from the server when I am on the VPN is 48.48.48.48 and the gateway inside the office network is 192.168.1.1 and the inside address of the server I need to connect to is 192.168.1.200. How would I add the route? I have tried this route on every interface with no luck:

route add 48.0.0.0 MASK 255.0.0.0 192.168.1.200 IF 1

I have a co-worker who is on vacation that did make a static route in the Windows routing table work when he was having the same issue so I know it's possible. Suggestions?


Solution 1:

You should run the command as administrator, I use my route commands as:

route add [HOST] MASK 255.255.255.255 [GATEWAYIP]
route add [NET] MASK [NETMASK] [GATEWAYIP]

Could you try to run it as:

route add 48.0.0.0 MASK 255.0.0.0 192.168.1.200

Please, if it doesn't work try to share

route print and ipconfig output, it is posible that you have a routing overlaping between both interfaces.

Solution 2:

Use powershell cmdlets. Get-NetRoute is to look ifIndex and then e. g.:

New-NetRoute -ifIndex 1 -DestinationPrefix 48.0.0.0/24 -NextHop 192.168.1.200