I am using the
.NET Framework classes to get the IP addresses for my machine.
I have a VirtualBox adapter which has both an IPv4 and IPv6 address. Using the .NET code I am getting the IPv6 address as
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?
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
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!!