# [SOLVED] Switching between company and local DNS on VPN

## Raniz

At work I've got a stationary computer that I use as a server, development is performed on a laptop which I take home at the end of the day.

I've set up a private VPN that works via an SSH tunnel (since our firewall won't let me connect to my stationary computer on any ports) and then uses NAT to allow me to connect to the rest of the computers in the network. It's not a pretty solution, but it does the trick.

My only problem right now is that I can't access my laptop via it's hostname when I'm connected to the VPN (our company's DNS picks it up via DHCP when I'm at work). Right now I have a definition of [laptop's hostname]0 in my /etc/hosts that I use when I'm connected via the VPN, but that adds a layer of inconvenience (changing/having duplicate scripts etc).

So, I'm looking for a way to use the company DNS when requesting the IP address for my laptop's hostname, but fallback to a static binding if the company's DNS can't resolve it (which means I'm connected to the VPN). I guess an alternate solution would be to run a script when my laptop connects to the VPN and then insert it into /etc/hosts, but I don't know how to do that either.

Any help is much appreciated!

----------

## Bones McCracker

I think you could use openresolv, provided that your vpn connection is identifiable as a logical network interface of some kind.

http://roy.marples.name/projects/openresolv

----------

## Raniz

I solved it with a rather ugly trick involving a few scripts that edit /etc/hosts on the VPN server when I connect

----------

## grimm26

 *BoneKracker wrote:*   

> I think you could use openresolv, provided that your vpn connection is identifiable as a logical network interface of some kind.
> 
> http://roy.marples.name/projects/openresolv

 

I'm interested in using openresolv, but I can't figure out how to set it up.  The documentation for it is very spartan and there is no HOWTO.  Any help?

----------

## Bones McCracker

 *grimm26 wrote:*   

>  *BoneKracker wrote:*   I think you could use openresolv, provided that your vpn connection is identifiable as a logical network interface of some kind.
> 
> http://roy.marples.name/projects/openresolv 
> 
> I'm interested in using openresolv, but I can't figure out how to set it up.  The documentation for it is very spartan and there is no HOWTO.  Any help?

 

Nope.  If you can't figure it out, you don't get to use it.  Just kidding.   :Razz: 

Maybe you could visit the openresolv web site.

Or, you could start a thread in this forum by describing your problem (showing error messages, etc.), and asking a specific question.

----------

