Why does Windows 7 try to resolve DNS against IPv6 DNS Servers?

Solution 1:

Your computer has tried to create a Teredo connection. Teredo is one of several IPv6 transition technologies, all of which have various drawbacks. Teredo's is that it just doesn't work in a variety of scenarios for which it was explicitly designed, such as being behind an IPv4 NAT device.

Thus, since Teredo is enabled, your computer thinks it has IPv6 connectivity, when that connectivity is actually broken. (The network status icon uses a completely different check for connectivity that is more accurate.)

To resolve the issue, disable Teredo (and while you're at it, the other two problematic ones, 6to4 and ISATAP). Right-click on Command Prompt and click Run as Administrator, then run the following:

netsh int ipv6 isatap set state disabled
netsh int ipv6 6to4 set state disabled
netsh int teredo set state disabled

Then restart your computer.

Solution 2:

Windows is not handling this differently per se, but rather nslookup is broken on Windows.

Resolvers always return both IPv4 addresses and IPv6 addresses if they are available and an address type is not specified. All default configurations on modern network stacks have a preference for IPv6 addresses over IPv4 addresses. This means that the IPv6 addresses are always returned before IPv4 addresses. This normally is not an issue since the client applications usually loop through the addresses returned by the resolver if the first address fails. In the case of IPv6 vs IPv4 addresses, the failure of IPv6 is nearly instant if a default IPv6 route is not configured.

The DNS server is dual stacked, meaning that it has both IPv4 and IPv6 addresses. When performing the lookup by specifying the default DNS server as a command line option, nslookup properly loops through the IP addresses starting with IPv6 and ending on IPv4. However when using nslookup interactively, nslookup only tries the first address which is returned by the resolver, which will always be the IPv6 address.

The fix for this is to specify the DNS servers by IP address when using nslookup interactively or use nslookup non-interactively by specifying the default DNS server on the command line.

Note this only affects nslookup on Windows, modern versions of Linux and OS X use a fixed version of nslookup.