Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Explain the instance properties of System.Net.IPAddress

I'm having a little trouble understanding the System.Net.IPAddress class, because I don't know where to look for a definition of what some of the properties are referring to. Specifically, what are:

 IPAddress.IsIPv6LinkLocal
 IPAddress.IsIPv6Multicast
 IPAddress.IsIPv6SiteLocal
 IPAddress.IsIPv6Teredo

I will also happily accept an answer that points to a resource that explains these concepts. The MSDN site has proved insufficient.

like image 415
smartcaveman Avatar asked Jun 23 '11 20:06

smartcaveman


People also ask

What is System Net IP address?

The IPAddress class contains the address of a computer on an IP network. Example. The following example creates an IPAddress instance and then uses that instance to perform a DNS query for host information: IPAddress myIP = IPAddress. Parse("192.168.

How do I find my .NET IP address?

Firstly include System.Net. We need to find the name of host to get the IP Address of host. So, the name of host can be retrieved by using the GetHostName() method from the Dns class. By passing the hostname to GetHostByName() method we will get the IP Address.

What is IP address format?

The IP address is a 32-bit number that uniquely identifies a network interface on a machine. An IP address is typically written in decimal digits, formatted as four 8-bit fields separated by periods. Each 8-bit field represents a byte of the IP address.

How many versions of IP address are there?

'IP' stands for 'Internet Protocol'. There are two versions of IP that currently coexist in the global Internet: IP version 4 (IPv4) and IP version 6 (IPv6). IP addresses are made up of binary values and drive the routing of all data over the Internet. IPv4 addresses are 32 bits long, and IPv6 addresses 128 bits long.


2 Answers

IPAddress.IsIPv6LinkLocal

A link-local address is an IP address that is intended only for communications within the local subnetwork. Routers do not forward packets with link-local addresses.

IPAddress.IsIPv6Multicast

A multicast address is a logical identifier for a group of hosts in a computer network, that are available to process datagrams or frames intended to be multicast for a designated network service. Multicast addressing can be used in the Link Layer (Layer 2 in the OSI model), such as Ethernet multicast, and at the Internet Layer (Layer 3 for OSI) for Internet Protocol Version 4 (IPv4) or Version 6 (IPv6) multicast.

IPAddress.IsIPv6SiteLocal

A unique local address (ULA) is an IPv6 address in the block fc00::/7, defined in RFC 4193. It is the IPv6 counterpart of the IPv4 private address. Unique local addresses are available for use in private networks, e.g. inside a single site or organisation, or spanning a limited number of sites or organisations. They are not routable in the global IPv6 Internet.

IPAddress.IsIPv6Teredo

In computer networking, Teredo is a transition technology that gives full IPv6 connectivity for IPv6-capable hosts which are on the IPv4 Internet but which have no direct native connection to an IPv6 network. Compared to other similar protocols its distinguishing feature is that it is able to perform its function even from behind network address translation (NAT) devices such as home routers.

like image 73
CodeNaked Avatar answered Oct 07 '22 16:10

CodeNaked


The answer of CodeNaked is almost correct, but please watch out with IPAddress.IsIPv6SiteLocal. The original IPv6 Site Local addresses (fec0::/10) are deprecated.

These days Unique Local Addresses (ULA) are used in place of Site Local. ULA has two variants: fc00::/8 is not defined yet, but might be used in the future for internal-use addresses that are registered in a central place (ULA Central). fd00::/8 is in use and does not have to registered anywhere. Prefixes from this range are generated randomly.

Unfortunately IsIPv6SiteLocal only checks for the original deprecated version:

PS C:\Users\Administrator> [System.Net.IPAddress]'fec0::'

Address           :
AddressFamily     : InterNetworkV6
ScopeId           : 0
IsIPv6Multicast   : False
IsIPv6LinkLocal   : False
IsIPv6SiteLocal   : True
IPAddressToString : fec0::

It does not recognize ULA Central:

PS C:\Users\Administrator> [System.Net.IPAddress]'fc00::'

Address           :
AddressFamily     : InterNetworkV6
ScopeId           : 0
IsIPv6Multicast   : False
IsIPv6LinkLocal   : False
IsIPv6SiteLocal   : False
IPAddressToString : fc00::

Or locally assigned ULA:

PS C:\Users\Administrator> [System.Net.IPAddress]'fd00::'

Address           :
AddressFamily     : InterNetworkV6
ScopeId           : 0
IsIPv6Multicast   : False
IsIPv6LinkLocal   : False
IsIPv6SiteLocal   : False
IPAddressToString : fd00::

Please see http://tools.ietf.org/search/rfc4193 for further details.

like image 40
Sander Steffann Avatar answered Oct 07 '22 18:10

Sander Steffann