Tom.K



Fixing broken network connection on VirtualBox caused by DNS

While working on video recording of DungCoi worm, there was a random loss of network connection on VirtualBox virtual machine running Windows XP. I was quite pissed off as I couldn't work on new content any further.


Issue

I had 3 network adapters involved in this. First adapter is for NAT belonging to VMware Workstation, second is for host-only (also belonging to VMWare Workstation) and third one is my Wi-Fi network adapter. For unknown reason, VMware Workstation adapters kept changing its own DNS configuration. Using both VMware Workstation and VirtualBox could easily break the connection on VirtualBox guest. However, this keeps occurring even when there are no guest machines running on VMware Workstation. When it comes to my Wi-Fi network adapter, it keeps getting different DNS servers, but they don't change that often.

Investigation

To figure out what was causing the issue, I had to mess around with adapters. I thought initially that I can at least disable one adapter, and it would be fine, but later it seems that it would still randomly break. That is, until I've noticed the difference in DNS configurations between adapters.

DNS configuration to automatic

Configuring wireless adapter to use automatic DNS. This will break the connection on VirtualBox network adapter.

To simplify this, I've got rid of VMWare's network adapter from this scenario and left only wireless network adapter and VirtualBox network adapter.

By changing DNS configuration of my wireless adapter, it seems that VirtualBox needs to reset its own adapter to get it updated. Though, this might break the network connection so repair might be needed.

Broken network connection

After applying DNS configuration, virtual network adapter breaks.

Reason

VirtualBox keeps updating DNS configuration on guest virtual machines. When a host network adapter changes its DNS configuration, the guest network connection drops. This is pretty much what I've figured out, but it doesn't mean it's an accurate reason.

Working network connection

Virtual network adapter works again, with DNS configuration from wireless adapter.

Basically, if your DNS gets changed for whichever reason, network connection on virtual machine will break.

Solution

To fix this issue, check all listed DNS servers in network adapter on VirtualBox guest machine. Find all host adapters that have those DNS server addresses and either apply static DNS server addresses, or temporarily disable.

Applying Google DNS configuration

Applying another DNS configuration (Google DNS in this case) on wireless adapter will once again break the network connection on virtual machine.

Demo

You can check the video about fixing this problem here.