Enabling and Disabling IPv6

To use the IPv6 protocol, ensure that you are running a version of the operating system that supports IPv6 and ensure that the operating system and the networking classes are configured properly.

Configuration Steps

The following table lists various configurations

Operating system IPv6-enabled? Networking classes IPv6-enabled? Description
No No Can parse IPv6 addresses.
No Yes Can parse IPv6 addresses.
Yes No Can parse IPv6 addresses and resolve IPv6 addresses using name resolution methods not marked obsolete.
Yes Yes Can parse and resolve IPv6 addresses using all methods including those marked obsolete.

Be aware that to enable the IPv6 support for all classes in the System.Net namespace, you must modify the computer configuration file or the configuration file for the application. The configuration file for an application has precedence over the computer configuration file.

For an example of how to modify the computer configuration file, machine.config, to enable Ipv6 support see, How to: Modify the Computer Configuration File to Enable Ipv6 Support. Also, ensure that the IPv6 support is enabled for the operating system.

The .NET Framework has a configuration switch set in a configuration file as follows

<system.net>…  
    <settings>…  
        <ipv6 enabled="true"/>…  
    </settings>…  
</system.net>  

For .NET Framework version 1.1 and earlier, the value of the ipv6 enabled configuration switch specifies whether members of the System.Net.Dns class return IPv6 addresses.

For .NET Framework version 2.0 and later, if Windows supports IPv6, then members of the System.Net.Dns class, (for example, the Dns.GetHostEntry method), will return IPv6 addresses with one limitation. Obsolete members of the DNS System.Net.Dns (for example, the Dns.Resolve method) will read and recognize the value in the configuration file for the ipv6 enabled setting.

See Also

Internet Protocol Version 6
Sockets
Network Settings Schema
<ipv6> Element (Network Settings)