0

I am experiencing a very weird issue with VirtualBox.

Most of the time, my laptop is hardwired to an Ethernet connection. Occasionally, when I'm away from my desk, I have no options besides Wi-Fi. When connecting to Wi-Fi, my host computer (Windows 10) gets network access in a few seconds without any issues. However, the guest (Windows XP SP3), will act as if it is still offline.

My network configuration in VirtualBox is NAT.

The strange thing is this only happens on wireless. Whenever I hardwire the computer, the host OS never has any issues obtaining a network connection. I set it up as NAT because I need the guest OS to have Internet access, but I don't want clients outside of the host connecting to it. I also didn't want to tie the guest machine to either the wired network card or the wireless network card because then it would only work on one or the other.

On the flipside, whenever I connect to Wi-Fi, there are always issues getting an Internet connection from the guest.

One time I was having issues, I typed ipconfig /flushdns and suddenly things were working. Since then, that has not been enough. Flushing my DNS is not enough to make things work on Wi-Fi.

The only way I've found to force it to work is to go into my VirtualBox settings for the guest and change the Network adapter from NAT to Bridged. At this point, it still won't work. However, now if I type ipconfig /flushdns (on the guest), everything suddenly works: I have network access. The more bizarre thing is I can now change it back to NAT. Suddenly, it'll stop working, but then, if I do ipconfig /flushdns again, it will work.

In other words, I have come full circle, back to a NAT connection that finally works. The start and end states are the exact same, so am I confused why the guest is unable to get a network connection on its own. If I only had to type ipconfig /flushdns whenever connecting to Wi-Fi, that would be one thing, but it is a real pain to have to exit the guest and change the adapter from NAT to Bridged and then back to NAT and then type the command.

Why is this happening, and more importantly, how can I fix this so it works as seamlessly as when it is hardwired? (I never need to type ipconfig /flushdns when going from Wi-Fi back to Ethernet, for instance, or mess with any adapter settings).

Here is the Command Prompt output from a recent troubleshooting session:

Just connected to Wi-Fi, no network access:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\InterLinked>ping google.com
Ping request could not find host google.com. Please check the name and try again
.

C:\Documents and Settings\InterLinked>ping google.com
^C
C:\Documents and Settings\InterLinked>ipconfig /flushdns

Windows IP Configuration

Successfully flushed the DNS Resolver Cache.

C:\Documents and Settings\InterLinked>ping google.com
Ping request could not find host google.com. Please check the name and try again
.

Change NAT to Bridged and try again:

C:\Documents and Settings\InterLinked>

C:\Documents and Settings\InterLinked>ping google.com

I terminated it early so output is missing, but the ping fails until I flush DNS:

^C
C:\Documents and Settings\InterLinked>ipconfig /flushdns

Windows IP Configuration

Successfully flushed the DNS Resolver Cache.

C:\Documents and Settings\InterLinked>ping google.com

Pinging google.com [172.217.7.14] with 32 bytes of data:

Reply from 172.217.7.14: bytes=32 time=15ms TTL=48
Reply from 172.217.7.14: bytes=32 time=13ms TTL=48
Reply from 172.217.7.14: bytes=32 time=15ms TTL=48
Reply from 172.217.7.14: bytes=32 time=20ms TTL=48

Ping statistics for 172.217.7.14:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 13ms, Maximum = 20ms, Average = 15ms

C:\Documents and Settings\InterLinked>

I change Bridged back to NAT:

C:\Documents and Settings\InterLinked>ping google.com

Pinging google.com [172.217.7.14] with 32 bytes of data:

Reply from 172.217.7.14: bytes=32 time=15ms TTL=47
Destination host unreachable.
Destination host unreachable.
Destination host unreachable.

Ping statistics for 172.217.7.14:
    Packets: Sent = 4, Received = 1, Lost = 3 (75% loss),
Approximate round trip times in milli-seconds:
    Minimum = 15ms, Maximum = 15ms, Average = 15ms

C:\Documents and Settings\InterLinked>ipconfig /flushdns

Windows IP Configuration

Successfully flushed the DNS Resolver Cache.

C:\Documents and Settings\InterLinked>ping google.com

Pinging google.com [172.217.7.14] with 32 bytes of data:

Reply from 172.217.7.14: bytes=32 time=12ms TTL=47
Reply from 172.217.7.14: bytes=32 time=6ms TTL=47
Reply from 172.217.7.14: bytes=32 time=188ms TTL=47
Reply from 172.217.7.14: bytes=32 time=14ms TTL=47

Ping statistics for 172.217.7.14:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 6ms, Maximum = 188ms, Average = 55ms

C:\Documents and Settings\InterLinked>
1
  • 1
    Sounds like some kind of DNS problem. Maybe try enabling the VirtualBox DNS resolver.
    – Daniel B
    Commented Oct 21, 2019 at 14:03

1 Answer 1

0

As was hinted at, enabling the VirtualBox DNS resolver is the solution.

Here are the exact steps:

  1. Shut down the VM. Turning the DNS resolver cannot be done when the machine is on.
  2. Navigate to the VirtualBox directory on the host from a command prompt: cd C:\Program Files\Oracle\VirtualBox
  3. Run the following command: VBoxManage modifyvm "<VM name>" --natdnshostresolver1 on

<VM name> is just the name of the VM, which can be found by running VBoxManage list runningvms as well.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .