Page 3 of 3
Re: Virtualbox DNS issue (how to resolve dns name)
Posted: 18. May 2009, 04:14
by es1
The discussion here lead me to think about using VBoxManage modifyvm MyVmName --cableconnected1 off ; sleep .4 ; and VBoxManage ... on
The guest VM will see disconnect/connect for the eth0 NIC (or whatever its name in Windows) and should re-generate the DHCP request.
If VBox will provide the latest dns server to the guest, we are done.
On the Linux host there should be a minimal script to do the above after any change to the network layer (dns, routing, or IPs).
Did anyone tried it before?
Re: Virtualbox DNS issue (how to resolve dns name)
Posted: 13. Aug 2009, 21:42
by bkornman
Excuse me for being really confused on this.
Since VBox 3 it appears that there is some DNS memory within NAT that doesn't change even though the underlying network changes. When I switch the (Linux) host from wired static IP to wired DHCP, at the host I get a different set of DNS servers. Within my XP guest running, I get the same DNS server: 10.0.2.15, even when I renew the interface, or even when I completely shut down the network device and bring it back up. Within the guest when I nslookup something, I continue to get results marked from the old DNS servers, not the new ones. Seemingly VBox is not getting the update that DNS servers have changed somewhere deep in the NAT software.
This really wouldn't be a big problem, except when I bring my laptop home and power it up, and power up VBox, often the wireless hasn't had a chance to connect yet by the time the XP guest is starting to come up, so when my XP guest comes up, it still seems to be trying to get to the old DNS servers at my work, not the ones made available by my wireless at home. There seems to be nothing I can do to get VBox to recognize the new DNS servers.
It seems that this is true since I loaded VBox 3 (3.0.4 does not correct the problem), though it may have been a problem with one of the later version 2 releases.
So, am I doing something wrong, or is this a legitimate bug?
Re: Virtualbox DNS issue (how to resolve dns name)
Posted: 13. Aug 2009, 23:34
by Sasquatch
bkornman, I've said it before in other threads, and I will repeat myself here again:
The IP configuration you get when using NAT is ALWAYS the same. 10.0.2.15 as IP, 10.0.2.2 as gateway and 10.0.2.3 for DNS. The DNS is translated when the VM is booting. If you do NOT have an active network connection, there won't be a DNS server to translate to. I suggest you wait for your wifi to come online before starting the VM. Pausing it the moment you start the VM (while the boot splash is visible) will not help, the translation is done just before the display is shown. You can see that in the log, a session is spawned, things happen (settings loaded, network initialized, etc.), and then the VM is created, which will result in a window with the VM in it.
Currently, there is no feature to re-initialize the network when a change is made (change IP range). Just test it yourself at home. Look at the DNS your Host gets by default, which will probably your router. Before you boot the VM, change it to an IP that is inaccessible (like your company DNS server), boot the VM and change it back to your own DNS. The VM won't have internet because of the wrong DNS translated IP.
Re: Virtualbox DNS issue (how to resolve dns name)
Posted: 10. Nov 2009, 07:53
by belainex
How do i find my dns server and ip address for my area connection? My router doesnt work and i think it is something to do with the ip address and dns server i am using. I have tried running cmd but it doesnt work. Help!
____________________
Re: Virtualbox DNS issue (how to resolve dns name)
Posted: 10. Nov 2009, 10:49
by Sasquatch
belainex wrote:How do i find my dns server and ip address for my area connection? My router doesnt work and i think it is something to do with the ip address and dns server i am using. I have tried running cmd but it doesnt work. Help!
For what reason is it needed? You don't state VB anywhere here. Even your profile is wrong, check the
VirtualBox FAQ for it.
The usual information you want can be found with either
ipconfig /all from a command prompt (start > run > cmd), or the status details of the connected NIC.
Re: Virtualbox DNS issue (how to resolve dns name)
Posted: 21. Mar 2010, 20:40
by whit
Sasquatch wrote:The DNS is translated when the VM is booting. If you do NOT have an active network connection, there won't be a DNS server to translate to.
Running "dhclient" on a Linux guest (Win7 host) sets up a resolv.conf based on the response of the available DHCP server. So it provides not the translated DNS, but the actual local DNS address, which generally works. This is useful when you want to be able to hibernate Win7 with the Linux guest still running, for a fast startup. The stock Ubuntu dhclient config (in /etc/dhcp3/dhclient.conf) works fine for me in this context, with NAT as the VB network adapter setting.
Update: In playing with this more, I've found an odd dependency. To have dhclient work here, for a NAT adapter on a wireless interface, the box next to "Cable connected" in VB's Network Adapters screen needs to be checked. If left unchecked - that is, telling there's _not_ a cable - then dhclient will not connect with the external dhcpd successfully (just empties the settings from resolv.conf and then retries unsuccessfully to get new ones). With "Cable connected" checked it works reliably, on the first try.
Doubtless there are settings elsewhere which could resolve this, or make it make more sense.