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.

This bugs me immensly.

I need to connect to client's network through VPN. But I definitely do not want to send all the traffic through client's network so this option is out of question. What I need basically is for the OS to know that all client's network subdomains (*.example.com) need to go through the VPN connection.

I tried a couple of options:

  1. Changing order of services and setting the VPN on top, but this works the same as "Send all traffic over VPN connection".
  2. Using "VPN on Demand" option from network advanced options, but this feature is quite rubbish to be honest. Seems to work only in Safari (?!) and it doesn't route the connection, but it basically triggers the OS to connect to the selected VPN.

The reason I need it to work based on hostnames rather than IP range is simple - my client has a lot of servers inside his network and it's impossible for me to remember all IPs. They are all within a range, but this doesn't help me remembering.

Another option would be to put the VPN connection on the bottom of network services and untick "Send all traffic..." and then put all known hostnames in hosts file, but considering there could be hundreds of servers (therefore hostnames and ips too) it ridiculous job. And if new server appears on the network I'd need to edit the hosts file again. Sisyphean labours.

However this works on Windows very simply. If a hostname is not available through default network interface, then it seems to try VPN connection and this works brilliantly.

So, how can I achieve that on Mac, then?

I know client's internal DNS addresses if that is of any help (like directing a certain domains through a different DNS)?

PS. Using latest version 10.6.6.
PS2. I am using VPN to access intranet, version control servers (svn://), samba shares and for SSH access to servers.

share|improve this question
    
What kind of VPN is it? Have you tried disabling "Send all traffic"? –  bahamat Jan 25 '11 at 17:04
    
It's PPTP with user/pass authentication. Disabling "Send all traffic" makes all traffic go through the default gateway. None of the required hostnames work then. Accessing client's network works only by IP addresses then. –  Michal M Jan 25 '11 at 17:13
    
good question! it bugs me also, although i'm using openvpn on linux and i have control over the server. –  attila lendvai Jul 31 '12 at 7:32
    
Can you use another service to access your client's network? –  SuB Sep 14 '13 at 9:28

4 Answers 4

The standard way to do this is to only route the clients IP ranges over the VPN. Route other traffic over your default network.

For security reasons, many VPN connections will force all traffic over the VPN to control information leakage. I would discuss doing otherwise with your client. Disconnect from the VPN when doing your own work.

share|improve this answer
    
I can see how it is advised security-wise, but there's more to it than that. Consider that the client pays for his Internet traffic and he doesn't appreciate me downloading my emails and new Linux distribution .iso's. I require VPN connection for most of the day so you should see now why I want another solution. –  Michal M Jan 25 '11 at 15:09
    
Disconnect from the VPN when you do so. For security reasons you shouldn't be doing so while connected to the VPN. You may consider setting up a virtual server as client to use for work with the client. Use it for all client work, and only route the virtual servers traffic over the VPN. –  BillThor Jan 25 '11 at 15:21
    
Seems like the only way and best way, although not necessarily safe as you say. Could you elaborate on the security matter in doing what I'm asking for - just an example will do. –  Michal M Jan 25 '11 at 15:33
    
@Michal A program on your system could copy information from the clients servers onto the Internet. It would look like you were accessing the file not someone on the Internet. –  BillThor Jan 26 '11 at 3:29
    
@BillThor How's sending all traffic through VPN helps that? If there is a malicious application on my system it will still be able to access client's data as me. –  Michal M Jan 26 '11 at 15:27

If you can run RIP or some other routing prototcol on the VPN server (e.g. Windows Server 2008) you can also run RIP on your Mac too, which would automatically add routes that were advertised by the server. That way you would only need to specify the list of routes once and get it configured automatically for VPN clients.

In practice you probably want the VPN server to only advertise routes and not listen to anything any clients happen to advertise otherwise malicious or broken clients could divert all/some traffic.

share|improve this answer
    
Thanks for the input Alan. Unfortunately I have no control over VPN Server so looks like I need to have a look at running RIP on my mac then. –  Michal M Jan 25 '11 at 17:09
    
running a routing daemon on just one end of the link defeats the point - ideally daemons at both ends would negotiate sensible routes over the tunnel, if only one end is doing it the adverts "fall on deaf ears". –  Flexo Jan 25 '11 at 17:29
    
Ah, I misread the first sentence. I see your point now. –  Michal M Jan 25 '11 at 17:38

What you are suggesting is known as Split-Tunneling, and most of the time network administrators do not allow it for security reasons. Depending on the VPN client you are using, the VPN client creates a virtual network adapter and the default route for traffic becomes the tunnel. With few exceptions, the VPN user cannot modify this behavior.

So unfortunately, you will have to disconnect from the VPN in order to direct traffic outside the tunnel.

share|improve this answer

Do netstat -r before and after VPN connection. Note the change in default route from your default gateway to the VPN link. remove the default link to the VPN connection's IP address add the client's subnet and VPN subnet to your route using the destination subnet so traffic to your client will go through VPN. Your original default route via your Gateway should be intact and your regular traffic should go through your own gateway.

share|improve this answer

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.