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 am using the .NET Framework classes to get the IP addresses for my machine.

Dns.GetHostAddresses(Dns.GetHostName())

I have a VirtualBox adapter which has both an IPv4 and IPv6 address. Using the .NET code I am getting the IPv6 address as fe80::71a3:2b00:ddd3:753f%16

Notice the %16 at the end?

However, if I query the same using WMI, I am getting the address as 'fe80::71a3:2b00:ddd3:753f'

So, does the %16 have any special significance?

Edit:

I just had some more observations about this. And they match pretty well with what Stephen Jennings said in his answer.

I installed Vmware to see what IPv6 address it issued. The addresses were : fe80::3dd0:7f8e:57b7:34d5%19

fe80::b059:65f4:e877:c40%20

Clearly, the numbers after % are not some hex representation. I checked all the properties available for a network adapter using Wmi and found that the numbers are exactly same as the InterfaceIndex property of each network adapter. As per MSDN, it uniquely identifies each network adapter and this property was introduced in Vista.

What still confused me was why would the IPAddress class allow you to create an ip address in that format unless it was valid. The answer was provided by Stephen. The number is the scope id. IPAddress has a constructor that accepts the address AND a scope id.

Oh, and all these three network adapters were link local. Confirmed it via ipconfig

Cool. That was interesting!!

share|improve this question
1  
I had no idea what it was either before you asked. I learned something neat about IPv6 today too (what nerds we are). –  Stephen Jennings Jan 23 '10 at 23:12
    
@Stephen, so have you worked with ipv6 before? I was surpised at quickly you nailed it. I had googled for quite some time before posting the question here. Nice work! –  Amith George Jan 23 '10 at 23:24
    
Searching "ipv6 address percent" got me the name I needed, and from there searching around and trying to make sense of the confusing technical documentation took the most time. I get what IPv6 is trying to accomplish, but there are a lot of new concepts it has that I haven't gotten around to researching and understanding. This was one, and nothing gives you a better understanding than trying to explain to someone else. –  Stephen Jennings Jan 23 '10 at 23:43
    
An alternative notation might be fe80:10 (the 0x0010 being 16). I use that in my browser when working with link-local IPv6 addresses, but I am not 100% sure this is according to the standards. (Using the percent in URLs is messy in browsers; in fact I could not get that to work at all.) –  Arjan Feb 6 '11 at 17:49

2 Answers 2

up vote 48 down vote accepted

The number after the '%' is the scope ID.

IPv6 defines at least three reachability scopes for addresses:

  1. Globally addressable. This is an IPv6 address given to you by your ISP. It is available to use on the public Internet.

  2. Link-local. This is similar to the 169.254.X.X range. It is an address that a computer assigns itself in order to facilitate local communications. These addresses don't get routed around on the public Internet because they're not globally unique.

  3. Node-local. This is an address that identifies the local interface, similar to 127.0.0.1. Basically, this is the address ::1.

Microsoft has published this article describing IPv6 addressing, which is the least-confusing article I found. The article indicates that the presence of a scope ID in your address means it is a link-local address. You can also tell it is link-local because the address begins with fe80.

Clear, simply-understood information on this topic seems to be rare, so I'm putting the rest of this together based on my best understanding of RFC 4007 and the other information out there.

A computer can have multiple link-local addresses, each with a different scope. The scope ID indicates which scope the address is for. For example, imagine the scenario of a computer with two NICs, each with a link-local address on different networks. If you try to send something to another address beginning with fe80, how will the computer know which NIC to send out on? The scope ID appears to be the solution for this.

share|improve this answer
    
Thanks! Edited my question to add the extra stuff I happened to observe while waiting for an answer. And when I came to post them, I was surprised to see your answer confirming the observations :) –  Amith George Jan 23 '10 at 23:10
3  
+1 Perfect answer –  whitequark Jan 23 '10 at 23:15
    
Nice answer. Let me see if I fully understood that. So a device with two NICs may connect to two different routers, and get assigned the very same DHCP address fe80::42. Also, the routers have the same address fe80::1. Now the fe80::1%X may be used to differentiate between the routers, but fe80::42%X is of minor use to the client, right? –  Pumbaa80 Nov 27 '12 at 8:27
    
@Pumbaa80 The client would send messages to fe80::1%1 to reach the router connected to NIC #1, and it would send messages to fe80::1%2 to reach the router connected to NIC #2. As an aside, Link-local addresses are configured automatically by the host computer, not via DHCP, so it probably wouldn't assign its two NICs the same IP. Also keep in mind that link-local addresses are not routable, so usually you won't be sending messages to a router, you'll be sending messages between two hosts. –  Stephen Jennings Nov 28 '12 at 6:33
    
by experimentation, it seems the trailing %nn can be omitted for at least some commands, e.g. ping, tracert. –  matt wilkie Dec 30 '12 at 5:23

IPv6 addresses with the prefix fe80::/64 are link-local addresses that are constructed by combining that prefix with the hardware address of the network device, 71a3:2b00:ddd3:753f in your example. (The analog in IPv4 is 169.254.0.0/16.) Since the prefix is the same for all link-local addresses on a machine, routing might sometimes need to know which interface you are referring to. And that is what the number after the percent, called the zone index, specifies. Specifics depend on the operating system: On Windows, %16 is interface number 16; on Linux for example you might see something like %eth0.

Some tools or APIs will consider this zone index unimportant or implicit for their purposes. For example, on Linux the ifconfig tool doesn't show it because it is obvious which interface an address belongs to. But in general it should be taken into account.

share|improve this answer

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.