Monday, September 20, 2010


Interesting hacks: IPv6 addreses in UNC names

Microsoft’s Raymond Chen tells us about an interesting hack that Microsoft uses. When you’re using a disk drive over the network from Windows, you normally refer to it with what’s called a UNC name (for Uniform Naming Convention). Normally, what goes into the UNC name is the name of the computer the drive is on, so if you want to use a share called Banana on a computer called HomeSrv, you write it as \\HomeSrv\Banana. So, for example, you might copy MyFile.html into the WebFiles subdirectory this way:

copy MyFile.html \\HomeSrv\Banana\WebFiles

That uses a NetBIOS name for the computer, but it’s common to use an Internet address instead, often written as a domain name. So, maybe:

copy MyFile.html \\\Banana\WebFiles

Sometimes, you have to use a computer that doesn’t have a resolvable name, perhaps because it’s on a private network that doesn’t have name-resolution service (DNS). In that case, you have to use the numeric Internet address (IP address):

copy MyFile.html \\\Banana\WebFiles

Now, is an IPv4 address — the form of address most of us are using today. But as we switch to IPv6, we’ll be using addresses in a different form. They’re 128-bit addresses, and they’re written as eight sixteen-bit chunks, separated by colons (not dots). Like this:

copy MyFile.html \\2001:DB8:0:0:8:800:200C:417A\Banana\WebFiles

The trouble is that the colon character has a special meaning in Windows identifiers, from way back before anyone had thought of IPv6, and many programs can’t deal with something that looks like that. To help out, Microsoft registered the domain name, and you can do this with it:

copy MyFile.html \\\Banana\WebFiles

That special name,, will resolve to the IPv6 address 2001:DB8:0:0:8:800:200C:417A... and it might look long and ugly, but it will work in any program that supports domain names in UNC names.

The amusing part of the hack is that it doesn’t actually go out to DNS and resolve that name. Indeed, if you try it from nslookup, it will resolve to the same address that does. If you put it in a web browser, it will do a Bing search on the address string and ipv6-literal. No, what’s interesting is that the name is specially handled by Windows, and resolved in the Windows internal name resolution scheme, without its ever going out to the Internet.

It’s the true definition of a hack, put in to make old resource-name parsers happy. And it only has to work on Windows, because Windows systems are the only ones that have that issue with the colon character.

No comments: