Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm not sure how to do this..

I've got a Windows 2003 server which I've created an "Incoming Connections" VPN network connection, then on my Windows 7 client, I've connected to this VPN, but as soon as I do so, I can't connect to the internet on the Windows 7 pc.

The Windows 7 pc is in a separate location, but has the same network range (192.168.1.0/255).

I'm guessing that when the VPN connection is made, it tries to become the default gateway.

How can I do this without the routing getting confused?

share|improve this question
    
To clarify, the issue you're talking about is the VPN subnet (192.168.1.0/24) is the same as your LAN subnet (192.168.1.0/24)? Connecting the VPN causes all 192.168.1.0/24 traffic to route over the VPN, including it's own traffic? –  Darth Android Jul 25 '11 at 21:30

2 Answers 2

up vote 2 down vote accepted

If the VPN is using the same subnet range as your local LAN, then the easiest fix would probably be to either change the VPN subnet or the LAN subnet (I use 192.168.0.0/24 and 192.168.1.0/24, for example).

If you only need to use say one or two devices on the remote network, you can just set up static routes for those devices and remove the VPN's subnet route:

If the VPN supports it (I'm not familiar with Window's built-in VPN), configure the VPN to not create a route for the VPN subnet, and instead create individual routes for each device you want to access. You can specify these by having the VPN create a route for the exact IP and a subnet of 255.255.255.255.

OR

  1. Open an elevated (administrator) command prompt
  2. Run route print and make a note of the interface list at the top. The first number for each interface is the interface number, you want the interface number for your VPN interface. We'll call it VPN-IF for the sake of this guide.
  3. Remove the subnet route to the VPN: route delete 192.168.1.0 MASK 255.255.255.0 IF VPN-IF You should lose all connectivity with devices on VPN at this point, but it should still be connected.
  4. Add routes for each device on the VPN that you want to access: route -p add <DEVICEIP> MASK 255.255.255.255 IF VPN-IF where <DEVICEIP> is the IP of the device you want to access.

You will need to repeat step #3 after each time you connect to the VPN, though the routes in step #4 will persist across reboots. Note, any IPs that you add a static route for in step #4 will not be accessible on the local network.

share|improve this answer
    
I don't really want to change the IP range of either of the networks as there's a fair few devices on them with static IP's. Is there a way I can change the IP range of the VPN network then set up routes for just a few of the IP's I want to access on the remote network? - I'm doing this so one shop can print to another's printer via the internet. –  Samuurai Jul 25 '11 at 21:53
    
Made some edits to my post-- this will allow you to control which IPs appear over the VPN and which appear to be local. –  Darth Android Jul 26 '11 at 14:19
    
In step 4, don't you have to specify the default gateway after the mask? I wasn't able to add a route without it. –  Tom Mar 7 '13 at 11:29
    
This answer helped me solve a similar issue where I wasn't able to access the work servers because of conflicting with my LAN IPs. I was able to add a route to direct the traffic appropriately using the commands above. –  Tom Mar 7 '13 at 11:34
    
@Tom You shouldn't have to, because the packets aren't routing through a gateway; with a VPN, they go directly to the recipient across the virtualized subnet. If Windows is being weird and explicitly requiring one, then either you're using 0.0.0.0/0 as the destination and you need a gateway, or you can probably just put the interface's IP. It should list as "On-Link" in the second scenario in route print. –  Darth Android Mar 8 '13 at 16:43

You are correct, when you attach to a VPN, by default it attempts to use the remote gateway for all Internet traffic, which often doesn't work. :)

You need to tell the VPN connection to NOT use the remote gateway:

  1. Get into the VPN connection's properties.

  2. Left click on "Networking (page tab)"

  3. Double click on "Internet Protocol Version 4 (TCP/IPv4) (check box)"

  4. Left click on "Advanced... (push button)" in "Internet Protocol Version 4 (TCP/IPv4) Properties"

  5. Left click on "Use default gateway on remote network (check box)" in "Advanced TCP/IP Settings" (to deselect it)

  6. OK, OK, OK.

This should cause Windows to use your local gateway for traffic not found on the VPN. You may also need to start using FQDN's to access VPN resources.

Edit to clarify:

This would be done in the VPN client's network settings (the Windows 7 machine). :)

share|improve this answer
    
Excellent.. thanks, I'll try this tomorrow when I go to the shop! –  Samuurai Jul 25 '11 at 21:54
    
+1 a great solution! –  stigok Dec 28 '12 at 20:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.