How to prevent Windows 7 using VPN gateway by default?
Solution 1:
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.