Page 2 of 3

Re: Virtualbox DNS issue (how to resolve dns name)

Posted: 28. Apr 2009, 09:09
by Debianuser
Hi,

I don't know if it's with the VirtualBox 2.2 but DNS on the /etc/resolv.conf 's guest are the same than host for me. Guest is on Nat (ip 10.0.2.15)

I just drive a test because when I read this post, I wonder if dns was like host's or a virtualbox thing (like 10.0.2.2).

First, I need to launch dhcpclient (sometimes, the automatic way don't work and apparently using card2 resolve this if you want to know. Search the post in this forum to know more). So before complaint about network problem, test ifconfig and check the interface ethx (x can be 0 to 8) have something like "inet adr 10.0.2.y" (y is probably 15 along is n't 0, 2 or 255, it's fine).

I check /etc/resolv.conf, and see the same dns than my host.

I test with ping www.google.fr the resolv work (you will not have the ping response because of nat).

I test with aptitude update/upgrade all go well (testing with a browser is not a reliable test, it can fail for another reason).

Don't forget your firewall rule, for example mine need a user/pwd to accept connexion http (as aptitude do) so if not provided, test will fail but dropped by firewall's rule.

As say before, the resolv on the host must work before hoping the guest to do the same. In fact, you should be able to make the same test on host if not the problem is before virtual box is doing.

I hope this can help you to see what go wrong at home and if someone can tell us if resolv.conf should have host'dns or virtualbox's ip ?

Debianuser

Re: Virtualbox DNS issue (how to resolve dns name)

Posted: 28. Apr 2009, 10:33
by Sasquatch
es1 wrote:Hi All,
I understand that the NAT DHCP server takes the primary host dns-server IP and provide it to the guest.
How to solve the following case:
laptop (linux host) is changing networks (wired or wireless) and changes the DNS server.
first network-A dns-server is internal 192.168.21.253 (cached by VirtualBox)
than changing to net-B where the dns-server is external (and the cached one is not available any more)

Is there a way to tell the VirtualBox to update the DNS server address ?

Any help will be appreciated.
btw: using VirtualBox-2.2.0OSE
Thanks 8)
Renew the IP address configuration. That is, run dhclient again. That will force VB to recheck the DNS server and give you a working one again.

Re: Virtualbox DNS issue (how to resolve dns name)

Posted: 28. Apr 2009, 19:56
by es1
Hi Sasquatch,
The host is linux, using NetworkManager and the guest is Windows (Win7b, WinXP).
I run ipconfig/renew in the guest and it does not help.
Applications on the host, Firefox for example, can browse the internet and get DNS answers with no problem.
The guest does not get correct DNS server.
I understand there is a way to tell the NAT to act as proxy DNS, is it true ? How can I activate it for NAT configuration? for all the Eth guest interfaces?
I would like things to work without user intervention and without any "renew" from the guest.

Thank you for your help.
8)

Re: Virtualbox DNS issue (how to resolve dns name)

Posted: 28. Apr 2009, 20:29
by Sasquatch
I have no idea, I actually never moved network enviroment while a VM was running and failed for it's DNS. I was always able to get it working with a refresh.

Re: Virtualbox DNS issue (how to resolve dns name)

Posted: 28. Apr 2009, 21:06
by Perryg
es1,
I bet if you wait for say 20 to 30 minutes your Widows guest will pick up the address by itself. The TTL (time to live) for the dhcpclient in windows is set to that number. Do some searching to see how to change this in your version. Also remember that this will produce a slight overhead due to polling. Another reason to not change things in the host while guest is running. I have tried the ipconfig/renew and it does not always work for DNS. You can while in Windows open a CMD window do a nslookup. Then type server xxx.xxx.xxx where the x's are the ip address of the dns server and force windows to resolve it but all of this is not friendly to a client.

Re: Virtualbox DNS issue (how to resolve dns name)

Posted: 29. Apr 2009, 07:38
by es1
Perryg and Sasquatch , thank you.
I'm trying to build a setup for end users - so long timeout is not an options, and failing with name resolution is also bad.
So I tried the new documented feature in the user manual (section 9.14) that should provide proxy DNS server by the NAT engine,
unfortunately It did not work for me. In theory it should provide the best of all worlds, as it access the current host network setting, and does provide fixed configuration to the guest.
I'll be happy to see more information about it.
Thank you 8)

Re: Virtualbox DNS issue (how to resolve dns name)

Posted: 29. Apr 2009, 11:38
by Sasquatch
Are you moving while the VM is still running, or do you put it to Save State? If it's the prior, maybe putting it to Saved helps.

Re: Virtualbox DNS issue (how to resolve dns name)

Posted: 29. Apr 2009, 15:01
by sej7278
why do you guys use dhcp on the guest and nat on the host?

just use static ip on the guest and bridged on the host - that way no having to worry about what random ip you're going to get and you can run servers on the guest and access them from the host.

Re: Virtualbox DNS issue (how to resolve dns name)

Posted: 29. Apr 2009, 16:32
by es1
Hi Sej7278, Thanks for the static IP and bridge.
If you need dynamic IP, for example in mobile laptops, that are connected once to the wire (Ethernet) and once to the wireless WiFi, than the bridge is not an option and you need DHCP on the different interfaces using the NetworkManager. The guest need something fixed as it should be isolated from the physical changes of the host network environment. In some cases I don't have control on the guest operating system, only on the linux host and VirtualBox software.

Any information on the Proxy DNS will be appriciated.
Thanks 8)

Re: Virtualbox DNS issue (how to resolve dns name)

Posted: 29. Apr 2009, 16:46
by sej7278
es1 wrote:Hi Sej7278, Thanks for the static IP and bridge.
If you need dynamic IP, for example in mobile laptops, that are connected once to the wire (Ethernet) and once to the wireless WiFi, than the bridge is not an option and you need DHCP on the different interfaces using the NetworkManager. The guest need something fixed as it should be isolated from the physical changes of the host network environment. In some cases I don't have control on the guest operating system, only on the linux host and VirtualBox software.
urgh i never use networkmanager anyway, but couldn't you use virtualbox on the ethernet with fixed ip and wifi/dhcp for whatever else - i don't think bridging even works on wifi, so i assume you're not using virtualbox when connected via wifi?

Re: Virtualbox DNS issue (how to resolve dns name)

Posted: 29. Apr 2009, 19:38
by Sasquatch
sej7278 wrote:urgh i never use networkmanager anyway, but couldn't you use virtualbox on the ethernet with fixed ip and wifi/dhcp for whatever else - i don't think bridging even works on wifi, so i assume you're not using virtualbox when connected via wifi?
When you're roaming through different networks, it isn't a solution to set a static IP. Bridging works with wifi since the change in 2.1.0.
Not all network devices accept multiple MAC addresses on the same link and will block the link for a certain amount of time when that is detected. This is configurable on the switch itself, but a lot of companies already use this technique for things like this. Using a wired bridge will not work with this and will cause your host to loose network connectivity too.

Re: Virtualbox DNS issue (how to resolve dns name)

Posted: 11. May 2009, 15:51
by Debianuser
Hi,

Sasquatch can you explain this :
Not all network devices accept multiple MAC addresses on the same link and will block the link for a certain amount of time when that is detected.
, please.

What type of device ? And what you call multiple Mac on same link ?

A switch with this block system will not support do be connect to a hub ? I think hub have not Mac address so all machine attach to it are directly see by the switch. That is multiple Mac on the same link (the one between hub and switch).

I don't understand why a product like this ?

Thanks for you help.

Debianuser

Re: Virtualbox DNS issue (how to resolve dns name)

Posted: 12. May 2009, 20:22
by Sasquatch
Debianuser wrote:Hi,

Sasquatch can you explain this :
Not all network devices accept multiple MAC addresses on the same link and will block the link for a certain amount of time when that is detected.
, please.

What type of device ? And what you call multiple Mac on same link ?

A switch with this block system will not support do be connect to a hub ? I think hub have not Mac address so all machine attach to it are directly see by the switch. That is multiple Mac on the same link (the one between hub and switch).

I don't understand why a product like this ?

Thanks for you help.

Debianuser
Managed switches have the option to check which MAC address is on which port, so it can forward data faster. Normal switches just keep track of the MAC address and port number, and don't do much with it. Managed switches can be configured to shutdown the port when it detects more than one MAC address on one link.
So if you run a VM and bridged it to your wired NIC, you will have two MAC addresses on the same link: your Host machine, and the VM one. Because the switch is configured to shut down a port when this is detected, you will loose all network connectivity until the switch probes again for a link and attached MAC addresses. Your Host will be the first to respond to the ARP request of the switch, and you will regain network connectivity. Until you use the VM again for network. Then you're back to step 1.

This configuration is often used in companies to avoid malicious behaviour on the network and at school networks (like a college or university) to avoid shortage of IP addresses.

Re: Virtualbox DNS issue (how to resolve dns name)

Posted: 13. May 2009, 13:25
by Debianuser
Hi,

Thanks for the report.

Yes, managed switch/router can be enforced to serve unique MAC address by port. It's a security function.

I was affraid that some product could block multiple MAC with not telling anyone (admin include).

Again thanks, you have saved my sake :)

Debianuser

Re: Virtualbox DNS issue (how to resolve dns name)

Posted: 17. May 2009, 05:10
by patelbhavesh
es1 wrote:Hi All,
I understand that the NAT DHCP server takes the primary host dns-server IP and provide it to the guest.
How to solve the following case:
laptop (linux host) is changing networks (wired or wireless) and changes the DNS server.
first network-A dns-server is internal 192.168.21.253 (cached by VirtualBox)
than changing to net-B where the dns-server is external (and the cached one is not available any more)

Is there a way to tell the VirtualBox to update the DNS server address ?

Any help will be appreciated.
btw: using VirtualBox-2.2.0OSE
Thanks 8)
I don't know of any way of doing this.I know it doesnt help but for me i found a manual way of copying the nameserver in the resolv.conf.You can read more about it on the post which i made http://forums.virtualbox.org/viewtopic.php?f=1&t=17302