Intermittently, WiFi internet stops working when connected to VirtualBox host-only adapter with no internet connection

1

I have a virtual network set up between an Ubuntu VM and my Windows 8.1 laptop, hooked into the Host-Only network adapter. This provides an Apache server and DNS for this specific connection. This will direct all DNS inquiries for .local to itself, instead of manually maintaining my Windows Hosts file. Note that the VM also has an internet connection through the VirtualBox NAT Interface

When connected to WiFi, nslookup always works. However, actual connections intermittently do not. How I assume accessing google works normally is this (but nslookup only requests the "default" DNS server unless a server is specified, and doesn't show attempts to all DNS servers)

DNS Request:
Server: my.router
Address: 192.168.1.1

Name: google.com
Address: 74.125.226.14
         etc...

If not found:
Server: johnrom.local
Address: 192.168.56.1

Then, when I try to access something like apache.local:

DNS Request:
Server: my.router
Address: 192.168.1.1

Not Found

Server: johnrom.local
Address: 192.168.56.1

Name: apache.local
Address: 192.168.56.1

However, every once in a while, the internet will not work. Disabling the host-only interface fixes this, and enabling it again breaks it. I've tried changing the order that I enable them, etc. It seems like the only thing that works is to keep host-only disabled for a while, then at some later time turn it back on.

The curious thing is that nslookup returns the same thing as the first code sample above. It knows where google.com is (or any random address aka DNS works). But when I connect to google.com, I can only assume it is sending an already-resolved (on the other interface!) request to 74.125.226.14 through the host-only virtual adapter.

My question is two-fold:

  • Is there any way to see the entire DNS lookup process experienced by, for example, Google Chrome? That way I can verify that it requests my.router first, then johnrom.local
  • Is there any way to set the gateway of johnrom.local or its interface to be last in the process, making sure that any WiFi connection takes priority at all times, but will fallback to host-only if the request fails?

This is a pretty stressful situation while in the middle of coding, when all of a sudden the internet stops working for 20 minutes. Here's an ipconfig, minus some physical addresses

> ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : johnrom
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : johnrom.local

Wireless LAN adapter Local Area Connection* 3:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter
   Physical Address. . . . . . . . . : 00-00-00-00-00-00
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Wireless LAN adapter Wi-Fi:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Intel(R) Wireless-N 7260
   Physical Address. . . . . . . . . : 00-00-00-00-00-00
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::3db4:f10f:63b7:2449%4(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.1.10(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Monday, June 30, 2014 1:13:26 PM
   Lease Expires . . . . . . . . . . : Monday, June 30, 2014 1:20:55 PM
   Default Gateway . . . . . . . . . : 192.168.1.1
   DHCP Server . . . . . . . . . . . : 192.168.1.1
   DHCPv6 IAID . . . . . . . . . . . : 123423093
   DHCPv6 Client DUID. . . . . . . . : 00-00-00-00-00-00-00-00-00-00-00-00-00-00

   DNS Servers . . . . . . . . . . . : 75.75.75.75
                                       75.75.76.76
   NetBIOS over Tcpip. . . . . . . . : Enabled

Ethernet adapter VirtualBox Host-Only Network:

   Connection-specific DNS Suffix  . : johnrom.local
   Description . . . . . . . . . . . : VirtualBox Host-Only Ethernet Adapter
   Physical Address. . . . . . . . . : 00-00-00-00-00-00
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::61b9:8e41:2688:4882%9(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.56.2(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Monday, June 30, 2014 1:16:08 PM
   Lease Expires . . . . . . . . . . : Tuesday, July 1, 2014 1:16:07 PM
   Default Gateway . . . . . . . . . : 192.168.56.1
   DHCP Server . . . . . . . . . . . : 192.168.56.1
   DHCPv6 IAID . . . . . . . . . . . : 234509822
   DHCPv6 Client DUID. . . . . . . . : 00-00-00-00-00-00-00-00-00-00-00-00-00-00

   DNS Servers . . . . . . . . . . . : 192.168.56.1
   Primary WINS Server . . . . . . . : 192.168.56.1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Tunnel adapter isatap.johnrom.local:

   Connection-specific DNS Suffix  . : johnrom.local
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter #2
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-00
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::5efe:192.168.56.2%7(Preferred)
   Default Gateway . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : 123423092
   DHCPv6 Client DUID. . . . . . . . : 00-00-00-00-00-00-00-00-00-00-00-00-00-00

   DNS Servers . . . . . . . . . . . : 192.168.56.1
   NetBIOS over Tcpip. . . . . . . . : Disabled

Tunnel adapter Teredo Tunneling Pseudo-Interface:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-00
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter isatap.{7C8B695E-E17C-4699-88A9-362BC3AC3B5C}:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-00
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::5efe:192.168.1.10%14(Preferred)
   Default Gateway . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : 369098752
   DHCPv6 Client DUID. . . . . . . . : 00-00-00-00-00-00-00-00-00-00-00-00-00-00

   DNS Servers . . . . . . . . . . . : 75.75.75.75
                                       75.75.76.76
   NetBIOS over Tcpip. . . . . . . . : Disabled

johnrom

Posted 2014-06-29T20:03:30.733

Reputation: 111

Do you have any bridging of any kind enabled? This is a common result from trying to bridge incorrectly to a wireless interface. – David Schwartz – 2014-06-30T02:29:23.527

I just realized my reply didn't answer your question. I don't specifically have any bridging enabled, but is it possible that VirtualBox's NAT system uses bridging somehow? I don't see anything that points to that fact. Either way, the best answer I could find is below. – johnrom – 2014-07-01T19:03:02.300

No. VB's NAT is a form of routing, not bridging. – David Schwartz – 2014-07-01T19:28:09.003

Answers

0

I figured it out, thanks to an answer to this question. It is exactly what I was looking for, as it requires no adjustment to routing tables, only the priority of specific interfaces (persistent across wi-fi connections!). These are automatically configured by the network speed of the connection, as defined here. I still don't understand why when it tried a connection to VBox and received nothing back, it didn't try the next adapter. However, when I rearrange them and it doesn't receive anything from my router, it falls back to the VBox connection to connect to .local addresses. Any clarification in the comments would be appreciated.

An alternative way to do this is to change the 'Metric' value of each adapter in question. [...] To change the Metric go into Network & Sharing Center --> Change Adapter Settings. Choose the adapter to change and go into its properties. In the advanced section of the protocol you want to change (normally IPv4) you untick the 'Automatic Metric' check box and specify your own value. The lower the value the higher priority the adapter will have when searching for a host.

johnrom

Posted 2014-06-29T20:03:30.733

Reputation: 111

It's probably easier to just remove the default gateway from the host-only connection. Clearly, it's not a default gateway. – David Schwartz – 2014-07-01T19:28:56.860

I assumed that it was a gateway, as it routes traffic to its own Apache server, that my other default gateway knows nothing about. I also assumed that the gateway setting says "Go ahead, ask me for resources and I'll see if I know where they are." Without stating the gateway, would Windows add the necessary IP routes and DNS servers? – johnrom – 2014-07-01T23:30:33.940

A "default gateway" is the machine you send packets to if you don't know how to reach the destination. It should be a router that knows how to reach all non-local destinations. Local destinations are handled by interface routes which are added automatically. A machine that is not your path to the Internet should not be your default gateway if you expect Internet connectivity to work. – David Schwartz – 2014-07-01T23:41:43.307

That makes sense. Since I'm using DHCP on the VM, though, it's rather hard for me to figure out where Ubuntu is setting the default gateway, or if the DHCP server is automatically using its own IP in lieu of specifying one. Thanks for your help David. If I could trace down where the gateway is being set, I'd tell you to post that as an answer, but for now I won't be able to / have time to find it and the problem has been resolved. I'll leave the question open in the event that I have time to look in the next few days. – johnrom – 2014-07-02T00:09:21.477