How to configure IPv6 address in Windows

This tutorial explains how to configure IPv6 address in Windows system from command prompt as well as from GUI interface including Stateful and Stateless Autoconfiguration process and states (Tentative, Valid, Preferred, Deprecated and Invalid) in detail with examples.

Autoconfiguration is an incredibly useful solution because it allows devices on a network to address themselves with a link-local unicast address

Types of Autoconfiguration

There are three types of autoconfiguration:

  • Stateless Configuration of addresses and other settings is based on the receipt of Router Advertisement messages. These messages have the Managed Address Configuration and Other Stateful Configuration flags set to 0, and they include one or more Prefix Information options, each with its Autonomous flag set to 1.
  • Stateful Configuration is based on the use of an address configuration protocol, such as DHCPv6, to obtain addresses and other configuration settings. A host uses stateful autoconfiguration when it receives a Router Advertisement message with no Prefix Information options and either the Managed Address Configuration flag or the Other Stateful Configuration flag is set to 1. A host can also use stateful autoconfiguration when there are no routers present on the local link.
  • Both Configurations is based on the receipt of Router Advertisement messages that include Prefix Information options, each with its Autonomous flag set to 1, and have the Managed Address Configuration or Other Stateful Configuration flags set to 1. For all types of autoconfiguration, a link-local address is always configured automatically.

Stateful Configuration

The client detects a router; the client examines the router advertisement messages to determine whether DHCPv6 has been set up. If the router specifies that DHCPv6 is supported, or no router advertisement messages are seen, the client will begin to find a DHCPv6 server by generating a DHCP solicit message. This message is sent to the ALL-DHCP-Agents multicast address, using the link-local scope to ensure the message isn’t forwarded, by default, beyond the local link. An agent is either a DHCPv6 server or a relay, such as a router.

Stateless Autoconfiguration

Stateless autoconfiguration is an extension of DHCPv6. the client uses information in router advertisement messages to configure an IPv6 address for the interface. This is accomplished by taking the first 64 bits in the router advertisement source address (the prefix of the router’s address) and using the EUI-64 process to create the 64-bit interface ID. Stateless autoconfiguration was designed primarily for cell phones, PDAs, and home network and appliance equipment to assign addresses automatically without having to manage a DHCP server infrastructure. Normally, routers generate periodic router advertisement (RA) messages the client can listen to and then use to generate its link address automatically; however, when the client is booting up, waiting for the RA might take awhile. In this situation, the client will generate a router solicitation message, asking the router to reply with an RA so the client can generate its interface address.

Two steps to IPv6 autoconfiguration

Autoconfigured Address States

Autoconfigured addresses are in one or more of the following states:

  • Tentative The address is in the process of being verified as unique. Verification occurs through duplicate address detection. A node cannot receive unicast traffic to a tentative address. It can, however, receive and process multicast Neighbor Advertisement messages sent in response to the Neighbor Solicitation message that has been sent during duplicate address detection.
  • Valid The address can be used for sending and receiving unicast traffic. The valid state includes both the preferred and deprecated states. The sum of the times that an address remains in the tentative, preferred, and deprecated states is determined by the Valid Lifetime field in the Prefix Information option of a Router Advertisement message or the Valid-Lifetime field of a DHCPv6 IA (Identity Association) Address option.
  • Preferred The address is valid, its uniqueness has been verified, and it can be used for unlimited communications. A node can send and receive unicast traffic to and from a preferred address. The period of time that an address can remain in the tentative and preferred states is determined by the Preferred Lifetime field in the Prefix Information option of a Router Advertisement message or the Preferred-Lifetime field of a DHCPv6 IA Address option.
  • Deprecated The address is valid and its uniqueness has been verified, but its use is discouraged for new communication. Existing communication sessions can still use a deprecated address. A node can send and receive unicast traffic to and from a deprecated address.
  • Invalid The address can no longer be used to send or receive unicast traffic. An address enters the invalid state after the valid lifetime expires.

Autoconfiguration Process

The address autoconfiguration process defined in RFC 4862 for the physical interface of an IPv6 node is the following:

  • A tentative link-local address is derived based on the link-local prefix of FE80::/64 and a EUI-64–derived interface identifier.
  • Using duplicate address detection to verify the uniqueness of the tentative link-local address, a Neighbor Solicitation message is sent with the Target Address field that is set to the tentative link-local address.
  • If a Neighbor Advertisement message (sent in response to the Neighbor Solicitation message) is received, this indicates that another node on the local link is using the tentative link-local address and address autoconfiguration stops. At this point, manual configuration must be performed on the node.
  • If no Neighbor Advertisement message (sent in response to the Neighbor Solicitation message) is received, the tentative link-local address is assumed to be unique and valid. The link-local address is initialized for the interface. The link-layer multicast address of the solicited-node address corresponding to the link-local address is registered with the network adapter.

For an IPv6 host, the address autoconfiguration continues as follows:

  • The host sends a Router Solicitation message. While routers periodically send router advertisements, the host sends a Router Solicitation message to request an immediate router advertisement, rather than waiting until the next router advertisement. By default, up to three Router Solicitation messages are sent.
  • If no Router Advertisement messages are received, the host uses an address configuration protocol to obtain addresses and other configuration parameters.
  • If a Router Advertisement message is received, the hop limit, reachable time, retransmission timer, and maximum transmission unit (if that option is present) are set.
  • For each Prefix Information option present, the following actions occur:
  • If the On-Link flag is set to 1, the prefix is added to the prefix list.
  • If the Autonomous flag is set to 1, the prefix and an appropriate interface identifier are used to derive a tentative address.
  • Duplicate address detection is used to verify the uniqueness of the tentative address.
  • If the tentative address is in use, the use of the address is not initialized for the interface.
  • If the tentative address is not in use, the address is initialized. This includes setting the valid and preferred lifetimes based on the Valid Lifetime and Preferred Lifetime fields in the Prefix Information option. If needed, it also includes registering the link-layer multicast address of the solicited-node address corresponding to the new address with the network adapter.
  • If the Managed Address Configuration flag in the Router Advertisement message is set to 1, an address configuration protocol is used to obtain additional addresses.
  • If the Other Stateful Configuration flag in the Router Advertisement message is set to 1, an address configuration protocol is used to obtain additional configuration parameters.

The following are the specific autoconfiguration behaviors of IPv6 in Windows Server 2008 and Windows Vista:

  • Computers running Windows Server 2008 or Windows Vista by default generate random interface IDs for non-temporary autoconfigured IPv6 addresses, including public and link-local addresses, rather than using EUI-64–based interface IDs.
    A public IPv6 address is a global address that is registered in DNS and is typically used by server applications for incoming connections, such as a Web server.
    You can disable this default behavior with the
    netsh interface ipv6 set global randomizeidentifiers=disabled
    command. You can enable the default behavior with the
    netsh interface ipv6 set global randomizeidentifiers=enabled command.
  • With a randomly derived interface ID, the chance of duplicating the link-local address is very small. Therefore, computers running Windows Server 2008 or Windows Vista do not wait for duplicate address detection (DAD) to complete before sending router solicitations or multicast listener discovery reports using their derived link-local addresses. This is known as optimistic DAD.
  • Computers running Windows Server 2008 or Windows Vista do not attempt stateful address autoconfiguration with DHCPv6 if no router advertisements are received.
  • RFC 4862 does not require a specific order for sending the initial router solicitation and performing duplicate address detection for the derived link-local address. The IPv6 protocol for Windows Server 2008 and Windows Vista sends the Router Solicitation message before performing duplicate address detection on the link-local address. In this way, duplicate address detection and router discovery are done in parallel to save time during the interface initialization process.
  • If the derived link-local address is a duplicate, stateless address autoconfiguration for the IPv6 protocol for Windows Server 2008 and Windows Vista can continue with the receipt of a multicast Router Advertisement message containing site-local, unique local, or global prefixes. The attempted link-local address is shown with a “Duplicate” state in the display of the
    netsh interface ipv6 show address
    command and a site-local, unique local, or global address—rather than the duplicate link-local address—is used for neighbor discovery processes.

Autoconfigured Addresses for the IPv6 Protocol for Windows Server 2008 and Windows Vista

By default, the following IPv6 addresses are automatically configured for the IPv6 protocol for Windows Server 2008 and Windows Vista:

  • Link-local addresses using randomly derived interface identifiers are assigned to all local area network (LAN) interfaces.
  • If included as a site-local prefix in a Prefix Information option of a router advertisement with the Autonomous flag set to 1, a site-local address using a randomly derived interface identifier is assigned to the LAN interface that received the router advertisement.
  • If included as a global or unique local prefix in a Prefix Information option of a router advertisement with the Autonomous flag set to 1, a global or unique local address using a randomly derived permanent interface identifier is assigned to the LAN interface that received the router advertisement.
  • If included as a global or unique local prefix in a Prefix Information option of a router advertisement with the Autonomous flag set to 1, a temporary global or unique local address using a randomly derived temporary interface identifier is assigned to the LAN interface that received the router advertisement. This is the default behavior for Windows Vista. Window Server 2008 does not create temporary addresses by default. You can enable temporary addresses with the netsh interface ipv6 set privacy enabled command.
  • If the M flag is set to 1 in a received Router Advertisement message, a stateful IPv6 address based on DHCPv6 scope for the subnet is assigned to the LAN interface that received the DHCPv6 Reply message.
  • If public IPv4 addresses are assigned to interfaces of the computer and there are no global or unique local autoconfiguration prefixes received in Router Advertisement messages, corresponding 6to4 addresses using 6to4-derived interface identifiers are assigned to the 6to4 tunneling interface. 6to4 is described in RFC 3056.
  • For computers running Windows Vista, for all IPv4 addresses that are assigned to interfaces of the computer, corresponding link-local addresses using Intra-Site Automatic Tunnel Addressing Protocol (ISATAP)–derived interface identifiers (::0:5EFE:w.x.y.z or ::200:5EFE:w.x.y.z) are assigned to the ISATAP tunneling interface. ISATAP is described in RFC 4214.
  • If included as a global, unique local, or site-local prefix in a Prefix Information option of a router advertisement received on the ISATAP interface, a global, unique local, or site local address using the ISATAP-derived interface identifier corresponding to the IPv4 address that is the best source to use to reach the ISATAP router is assigned to the ISATAP interface.
  • The loopback address (::1) is assigned to the Loopback Pseudo-Interface 1.

Manually IPv6 Configuration in Windows

One option you have is to statically assign a unicast address to a device’s interface using either of these two approaches:
Specify all 128-bits manually
Use EUI-64

You can manually specify the entire 128-bit address, or you can specify the subnet ID and have the device use the EUI-64 method to create the interface ID part of the address

Manually Configuring the IPv6 Protocol

Unlike IPv6 in Windows XP and Windows Server 2003, the IPv6 protocol in Windows Server 2008 and Windows Vista is installed and enabled by default. The IPv6 protocol for Windows Server 2008 and Windows Vista is designed to be auto configuring. For example, it automatically configures link-local addresses for communication between nodes on a link. If there is an IPv6 router on the host’s subnet or an ISATAP router, the host uses received router advertisements to automatically configure additional addresses, a default router, and other configuration parameters. You can manually configure IPv6 addresses and other parameters in Windows Vista using the following:

  • Form lan card properties
  • From command prompt

The properties of Internet Protocol Version 6 (TCP/IPv6) component

Just as you can configure IPv4 settings through the properties of the Internet Protocol Version 4 (TCP/IPv4) component in the Network Connections folder, you can now configure IPv6 settings through the properties of the Internet Protocol Version 6 (TCP/IPv6) component. The set of dialog boxes for IPv6 configuration is very similar to the corresponding dialog boxes for IPv4. However, the properties of the Internet Protocol Version 6 (TCP/IPv6) component provide only basic configuration of IPv6.

Commands in the netsh interface ipv6 context

Just as you can in Windows XP and Windows Server 2003, you can configure IPv6 settings for Windows Server 2008 or Windows Vista from the interface ipv6 context of the Netsh.exe tool. Although typical IPv6 hosts do not need to be manually configured, IPv6 routers must be manually configured.

Configuring IPv6 Through the Properties of Internet Protocol Version 6 (TCP/IPv6)
To manually configure IPv6 settings through the Network Connections folder, do the following:

  • From the Network Connections folder, right-click the connection or adapter on which you want to manually configure IPv6, and then click Properties.
  • On the Networking tab for the properties of the connection or adapter, under This Connection Uses The Following Items, double-click Internet Protocol Version 6 (TCP/IPv6) in the list.

Windows Vista displays the Internet Protocol Version 6 (TCP/IPv6) Properties dialog box.

The Internet Protocol Version 6 (TCP/IPv6) Properties dialog box

How to configure IPv6 address in Windows

General Tab

On the General tab of the Internet Protocol Version 6 (TCP/IPv6) Properties dialog box, you can configure the following:

  • Obtain an IPv6 address automatically Specifies that IPv6 addresses for this connection or adapter are automatically determined by stateful or stateless address autoconfiguration.
  • Use the following IPv6 address< Specifies that an IPv6 address and default gateway for this connection or adapter are manually configured.
  • IPv6 address Provides a space for you to type an IPv6 unicast address. You can specify additional IPv6 addresses from the Advanced TCP/IP Settings dialog box.
  • Subnet prefix length Provides a space for you to type the subnet prefix length for the IPv6 address. For typical IPv6 unicast addresses, this value should be set to 64, its default value.
  • Default gateway Provides a space for you to type the IPv6 unicast address of the default gateway.
  • Obtain DNS server address automatically Specifies that the IPv6 addresses for DNS servers are automatically determined by stateful address autoconfiguration (DHCPv6).
  • Use the following DNS server addresses Specifies that the IPv6 addresses of the preferred and alternate DNS servers for this connection or adapter are manually configured.
  • Preferred DNS server Provides a space for you to type the IPv6 unicast address of the preferred DNS server.
  • Alternate DNS server Provides a space for you to type the IPv6 unicast address of the alternate DNS server. You can specify additional DNS servers from the Advanced TCP/IP Settings dialog box.

Advanced TCP/IP Settings

From the General tab, you can click Advanced to access the Advanced TCP/IP Settings dialog box. This dialog box is very similar to the Advanced TCP/IP Settings dialog box for the Internet Protocol Version 4 (TCP/IPv4) component except there is no WINS tab (IPv6 does not use NetBIOS and the Windows Internet Name Service [WINS]) or Options tab (TCP/IP filtering is defined only for IPv4 traffic). For IPv6, the Advanced TCP/IP Settings dialog box has IP Settings and DNS tabs.

configure IPv6 address in Windows advance tab

The IP Settings tab

From the IP Settings tab, you can configure the following:

  • Multiple IPv6 addresses (by clicking Add under IP Addresses) For each unicast IPv6 address, you must specify an IPv6 address and a subnet prefix length. The Add button is available only if Use The Following Ipv6 Address has been selected on the General tab of the Internet Protocol Version 6 (TCP/IPv6) Properties dialog box.
  • Multiple default gateways (by clicking Add under Default Gateways) For each default gateway, you must specify the IPv6 address of the gateway and whether you want the metric for the default route associated with this default gateway to be manually specified or based on the speed of the connection or adapter.
  • Route metrics You can also specify whether to use a specific metric for the routes associated with the configuration of IPv6 addresses or default gateways or a metric determined by the speed of the connection or adapter.

The DNS tab

From the DNS tab, you can configure the following:

  • The IPv6 addresses of DNS servers, in order of use (by clicking Add under DNS Server Addresses, In Order Of Use).
  • Primary and connection-specific DNS suffix and name registration and devolution behavior. These settings are the same as for IPv4.

Configuring IPv6 with the Netsh.exe Tool

You can also configure IPv6 addresses, default gateways, and DNS servers at the command line using commands in the netsh interface ipv6 context.

Configuring Addresses

To configure IPv6 addresses, you can use the netsh interface ipv6 add addresscommand with the following syntax:

netsh interface ipv6 add address [interface=]InterfaceNameorIndex [address=]IPv6Address
[/PrefixLength] [[type=]unicast|anycast] [[validlifetime=]Time|infinite] [[preferredlifetime=]
Time|infinite] [[store=]active|persistent]
  • interface The connection or adapter’s name or interface index.
  • address The IPv6 address to add, optionally followed by the subnet prefix length (default of 64).
  • type The type of IPv6 address, either unicast (default) or anycast.
  • validlifetime The lifetime over which the address is valid. Time values can be expressed in days, hours, minutes, and seconds (for example, 1d2h3m4s). The default value is infinite.
  • preferredlifetime The lifetime over which the address is preferred. Time values can be expressed in days, hours, minutes, and seconds. The default value is infinite.
  • store How to store the IPv6 address—either active (the address is removed upon system restart) or persistent (address remains after system restart), which is the default.

For example, to configure the IPv6 unicast address 2001:db8:290c:1291::1 on the interface named “Local Area Connection” with infinite valid and preferred lifetimes and make the address persistent, you use the following command:

netsh interface ipv6 add address "Local Area Connection" 2001:db8:290c:1291::1

Adding Default Gateways

To configure a default gateway, you can use the netsh interface ipv6 add route command and add a default route (::/0) with the following syntax:

netsh interface ipv6 add route [prefix=]::/0 [interface=]InterfaceNameorIndex
[[nexthop=]IPv6Address] [[siteprefixlength=]Length] [[metric=]MetricValue] [[publish=]
no|yes|immortal] [[validlifetime=]Time|infinite] [[preferredlifetime=]Time|infinite]
[[store=]active|persistent]
  • prefix The IPv6 address prefix and prefix length for the default route. For other routes, you can substitute ::/0 with AddressPrefix/PrefixLength.
  • interface The connection or adapter’s name or interface index.
  • nexthop If the prefix is for destinations that are not on the local link, the next-hop IPv6 address of a neighboring router.
  • siteprefixlength If the prefix is for destinations on the local link, you can optionally specify the prefix length for the address prefix assigned to the site to which this IPv6 node belongs.
  • metric A value that specifies the preference for using the route. Lower values are preferred.
  • publish As an IPv6 router, this option specifies whether the subnet prefix corresponding to the route will be included in router advertisements and whether the lifetimes for the prefixes are infinite (the immortal option).
  • validlifetime The lifetime over which the route is valid. Time values can be expressed in days, hours, minutes, and seconds (for example, 1d2h3m4s). The default value is infinite.
  • preferredlifetime The lifetime over which the route is preferred. Time values can be expressed in days, hours, minutes, and seconds. The default value is infinite.
  • store How to store the route, either active (route is removed upon system restart) or persistent (route remains after restart), which is the default.

For example, to add a default route that uses the interface named “Local Area Connection” with a next-hop address of fe80::2aa:ff:fe9a:21b8 you use the following command:

netsh interface ipv6 add route ::/0 "Local Area Connection" fe80::2aa:ff:fe9a:21b8

Adding DNS Servers

To configure the IPv6 addresses of DNS servers, you can use the netsh interface ipv6 add dnsserver command with the following syntax:

netsh interface ipv6 add dnsserver [name=]InterfaceName [[address=]IPv6Address]
[[index=]PreferenceValue]
  • name The connection or adapter’s name.
  • address The IPv6 address of the DNS server.
  • index The preference for the DNS server address.

By default, the DNS server is added to the end of the list of DNS servers. If an index is specified, the DNS server is placed in that position in the list and the other DNS servers are moved down the list.

For example, to add a DNS server with the IPv6 address 2001:db8:99:4acd::8 that uses the interface named “Local Area Connection,” you use the following command:

 netsh interface ipv6 add dnsserver "Local Area Connection" 2001:db8:99:4acd::8
 

ComputerNetworkingNotes Networking Tutorials How to configure IPv6 address in Windows