Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
share|improve this question
    
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 Jun 30 at 2:29
    
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 Jul 1 at 19:03
    
No. VB's NAT is a form of routing, not bridging. –  David Schwartz Jul 1 at 19:28
add comment

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
It's probably easier to just remove the default gateway from the host-only connection. Clearly, it's not a default gateway. –  David Schwartz Jul 1 at 19:28
    
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 Jul 1 at 23:30
    
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 Jul 1 at 23:41
    
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 Jul 2 at 0:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.