VirtualBox

Ticket #6670 (closed defect: duplicate)

Opened 4 years ago

Last modified 4 years ago

DNS breaks when moving a laptop from network to network

Reported by: ij Owned by:
Priority: minor Component: network/NAT
Version: VirtualBox 3.1.6 Keywords:
Cc: Guest type: Linux
Host type: Windows

Description

My use case: I have a Windows laptop running virtualbox. Periodically I suspend the laptop and move it from one office to another. I have an Ubuntu virtual machine in saved state when this happens.

What happens: the virtual machine, when I use it, can't resolve addresses. Investigation reveals that it has the previous network's DNS server set.

I presume that the VM is never notified of the change of DNS server. I don't know if the machine would receive a DNS server update if it is running. I can see that it doesn't when it's saved.

A proposed solution:

Instead of giving NATted VMs the address of the remote DNS server, have a local DNS proxy running on the NAT gateway. The local DNS proxy - running under the host OS - can forward the DNS requests to the laptop's currently set DNS server. The VMs are isolated from host machine configuration changes.

Change History

comment:1 follow-up: ↓ 3 Changed 4 years ago by ij

Someone's given me an answer to this. You can set this but it's not the default and it's not in the UI. It is in the manual under 'advanced topics':

VBoxManage setextradata "Ubuntu server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/DNSProxy" 1 VBoxManage setextradata "Ubuntu server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/UseHostResolver" 1

comment:2 follow-up: ↓ 4 Changed 4 years ago by klaus

Suggesting to introduce a DNS proxy sounds very much like the DNS setup we had up to VirtualBox 3.0 IIRC, and it was changed to the current style because so many people complained that the DNS config didn't look like they expected.

I read something totally different out of your use case: VirtualBox needs to detect the suspend state and/or network change, and disconnect the virtual network cable temporarily to convince the guest OS to renew its DHCP lease.

comment:3 in reply to: ↑ 1 Changed 4 years ago by Hachiman

Replying to ij: Actually, only is required:

VBoxManage setextradata "Ubuntu server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/UseHostResolver" 1

that's switch NAT's internal module into mode forwarding dns requests to host's resolver API.

VBoxManage setextradata "Ubuntu server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/DNSProxy" 1

This mode was introduced for more efective emulation of DNS proxy of VBox prior 2.2.

comment:4 in reply to: ↑ 2 Changed 4 years ago by dimitris

Replying to klaus:

Suggesting to introduce a DNS proxy sounds very much like the DNS setup we had up to VirtualBox 3.0 IIRC, and it was changed to the current style because so many people complained that the DNS config didn't look like they expected.

I read something totally different out of your use case: VirtualBox needs to detect the suspend state and/or network change, and disconnect the virtual network cable temporarily to convince the guest OS to renew its DHCP lease.

"Manually" disconnecting then reconnecting the virtual network cable doesn't help. Ubuntu Lucid host on x86_64, WinXP 32 guest:

After disconnecting the virtual cable:

C:\>ipconfig /all

Windows IP Configuration

        Host Name . . . . . . . . . . . . : winvm
        Primary Dns Suffix  . . . . . . . :
        Node Type . . . . . . . . . . . . : Unknown
        IP Routing Enabled. . . . . . . . : No
        WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Local Area Connection:

        Media State . . . . . . . . . . . : Media disconnected
        Description . . . . . . . . . . . : AMD PCNET Family PCI Ethernet Ada
r
        Physical Address. . . . . . . . . : 08-00-27-6D-24-A8

Then, after reconnecting and after the XP guest has renewed its DHCP lease:

C:\>ipconfig /all

Windows IP Configuration

        Host Name . . . . . . . . . . . . : winvm
        Primary Dns Suffix  . . . . . . . :
        Node Type . . . . . . . . . . . . : Unknown
        IP Routing Enabled. . . . . . . . : No
        WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Local Area Connection:

        Connection-specific DNS Suffix  . :
        Description . . . . . . . . . . . : AMD PCNET Family PCI Ethernet Adapte
r
        Physical Address. . . . . . . . . : 08-00-27-6D-24-A8
        Dhcp Enabled. . . . . . . . . . . : Yes
        Autoconfiguration Enabled . . . . : Yes
        IP Address. . . . . . . . . . . . : 10.0.2.15
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 10.0.2.2
        DHCP Server . . . . . . . . . . . : 10.0.2.2
        Lease Obtained. . . . . . . . . . : Thursday, May 13, 2010 12:35:53 PM
        Lease Expires . . . . . . . . . . : Friday, May 14, 2010 12:35:53 PM

C:\>nslookup www.google.com
*** Default servers are not available
Server:  UnKnown
Address:  127.0.0.1

*** UnKnown can't find www.google.com: No response from server

comment:5 Changed 4 years ago by tjd2002

This is a duplicate of issue 3847 (which had incorrectly been marked closed)

comment:6 Changed 4 years ago by Hachiman

  • Status changed from new to closed
  • Resolution set to duplicate

duplicate #3847

Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use