Signal guest to refresh nameserver info when guest via vpn

This is for discussing general topics about how to use VirtualBox.
Post Reply
patelbhavesh
Posts: 17
Joined: 10. Apr 2009, 05:23
Primary OS: Debian Lenny
VBox Version: OSE Debian
Guest OSses: Linux
Location: Sunnyvale,CA,USA
Contact:

Signal guest to refresh nameserver info when guest via vpn

Post by patelbhavesh »

Every now and then I use my guest operating system to a vpn/
So obviousy my nameserver/dns information changes.
Im using NAT'ed host.
Is there an automatic way in VBox to signal the guest OS that it needs to refresh the nameserver/dns information ?
For the time being i have to manually change the resolv.conf but was hoping to see some automatic way of doing it ?
Im on vbox 2.2.0
Any ideas ?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Signal guest to refresh nameserver info when guest via vpn

Post by Perryg »

The guest needs to refresh the dns pool not VBox.
You should be able to put something in a cron job for that though.
patelbhavesh
Posts: 17
Joined: 10. Apr 2009, 05:23
Primary OS: Debian Lenny
VBox Version: OSE Debian
Guest OSses: Linux
Location: Sunnyvale,CA,USA
Contact:

Re: Signal guest to refresh nameserver info when guest via vpn

Post by patelbhavesh »

Im not an expert on networking, but this is what i have observed.

When a vpn is created a new network interface is used on the guest os like say juniper netwroks which uses the guest OS's.
But as vbox is associated to the NIC of the guest os it does not know that a new network interface like juniper netwroks is created and all traffic is tunneled thru it.

so say for example guest os has ip address as 192.168.1.4 and dns is 67.88.88.xx and then when the vpn connection is made with say juniper network the ip address for junipers interface is 172.xx.xx.xx and the dns and nameserver is 172.134.xx.xx etc so Vbox does not come to know that a new tunnel is created and hence the host os still tries DNS with 67.88.88.xx

So im curious whether is this something Vbox needs to handle or the host os ?
baf
Volunteer
Posts: 829
Joined: 27. Sep 2008, 06:18
Primary OS: Mac OS X Leopard
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: linux,xp,win7
Location: Luleå or Skellefteå, Sweden

Re: Signal guest to refresh nameserver info when guest via vpn

Post by baf »

One way is to let your host handle it.
If you are on nat you can set your resolv.conf like this:

Code: Select all

nameserver 10.0.2.3
I'm not sure if it's VirtualBox or your host that handles it but it works fine for me on Mac OSx at least.
Some say: "You learn as long as you live".
My way: "You live as long as you learn".
patelbhavesh
Posts: 17
Joined: 10. Apr 2009, 05:23
Primary OS: Debian Lenny
VBox Version: OSE Debian
Guest OSses: Linux
Location: Sunnyvale,CA,USA
Contact:

Re: Signal guest to refresh nameserver info when guest via vpn

Post by patelbhavesh »

baf wrote:One way is to let your host handle it.
If you are on nat you can set your resolv.conf like this:

Code: Select all

nameserver 10.0.2.3
I'm not sure if it's VirtualBox or your host that handles it but it works fine for me on Mac OSx at least.
Thnx i will try it out resolv.conf is handled by the guest os.So im assuming that we are saying that we need to set the DNS and nameserver as the ip address of the host ?
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: Signal guest to refresh nameserver info when guest via vpn

Post by vbox4me2 »

When a VPN is created the new adapter should get all relevant info from the VPN server, plus the default gateway should be adjusted conform the VPN values, if this doesn't happen the VPN server is at fault here.
patelbhavesh
Posts: 17
Joined: 10. Apr 2009, 05:23
Primary OS: Debian Lenny
VBox Version: OSE Debian
Guest OSses: Linux
Location: Sunnyvale,CA,USA
Contact:

Re: Signal guest to refresh nameserver info when guest via vpn

Post by patelbhavesh »

vbox4me2 wrote:When a VPN is created the new adapter should get all relevant info from the VPN server, plus the default gateway should be adjusted conform the VPN values, if this doesn't happen the VPN server is at fault here.
The VPN adapter is created in the Host OS because thats where im connecting with VPN.All the information for the Host OS is correctly set by the VPN server and Im able to use it without any issues.
However the issue is with the Guest OS because the Guest OS continues to have the information of nameservers/dns etc before the vpn connection was made including the ip address which was obtained by the guest os from Vbox.

After the VPN is connected there does not seem to be any automatic way to signal the guest os that something in the layer below VBox , has changed that is a new adapter is being used.

Also note that only name server is a problem becuse i can ping all the machines behind the VPN with their ip address.

Anyways looks like currently the best way is to manually set the value thru a script of the nameserver/dhcp after a vpn connection is established and then restoring it to the previous value after the vpn connection is disconnected.
patelbhavesh
Posts: 17
Joined: 10. Apr 2009, 05:23
Primary OS: Debian Lenny
VBox Version: OSE Debian
Guest OSses: Linux
Location: Sunnyvale,CA,USA
Contact:

Re: Signal guest to refresh nameserver info when guest via vpn

Post by patelbhavesh »

I think i found the answer to this thread.Looks like it is a Windows issue

http://forums.virtualbox.org/viewtopic.php?f=6&t=17383
Post Reply