How to prevent Windows 7 using VPN gateway by default?

0

4

Yes, I am aware of this question. However, I have tried following the answers to the question, and they don't work for me. If I uncheck "Use default gateway on remote network", RDP simply refuses to connect to my work machine, whereas when it is checked, RDP connects fine. The suggested route -p... command didn't help either.

I have set up a VPN connection via Windows 7 to my work network. I wish to RDP to my work machine, but for every other IP address I want to continue using my regular internet connection; ie. continue using my normal default gateway. How can I configure Windows 7 to do this?

Jez

Posted 2015-01-06T19:47:09.907

Reputation: 2 612

Answers

8

I finally figured out how to solve my problem!

Yes, you first need to go into your VPN settings | Networking tab, then for both IPv4 and IPv6 properties, after clicking the Advanced button, make sure "Use default gateway on remote network" is unchecked.

Then, however, you need to setup routing to the IPs that you wish to access through that VPN, or you won't be able to access anything through that VPN. In my case, I had to run this command from a cmd window run as Administrator:

C:\>route -p ADD 192.168.232.117 mask 255.255.255.255 77.86.21.34 if 21

Finally, this let me connect through my VPN to the internal IP I wanted to access, which was 192.168.232.117. The key was specifying the interface! If you don't do that, Windows may default to trying to route through the wrong interface and things won't work. I'll just explain that above command:

route -p

This sets up a persistent route; even after a reboot, the routing should still be in place.

ADD 192.168.232.117

This says that this routing should apply when you try to access the IP 192.168.232.117.

mask 255.255.255.255

This says that the route's netmask is such that the route applies to just the one IP I specified above.

77.86.21.34

* This specifies the IP address of the gateway to use when connecting to this IP.

if 21

* This specifies the number of the interface to use when connecting to this IP. In my case, interface 21 was the VPN's interface, rather than my network card's.

Note that the values for the items with an asterisk (*) can be found out by getting the route command to display routing information to you, such as currently-available interfaces and their associated number, using the command:

route PRINT

More info on the route command, and examples, can be found here and here.

Jez

Posted 2015-01-06T19:47:09.907

Reputation: 2 612

0

You need to make this change on each connection, not just the VPN connection. See my answer to another question here: https://superuser.com/a/547663/127642 for more info.

Jerry W Jackson

Posted 2015-01-06T19:47:09.907

Reputation: 120

But I only have one VPN setup. – Jez – 2015-01-08T18:06:14.337

Not every VPN, every network connection. – Jerry W Jackson – 2015-01-08T18:07:31.130

What are you talking about? The 'Use default gateway on remote network' option only appears for my VPN connection's settings, not my LAN connection's. – Jez – 2015-01-08T21:01:33.470