IPv6 networking

Support for IPv6

DataSource 7 applications support IPv6 and IPv4.

DataSource 6 applications support IPv4 only.

Hostname resolution in dual-stack networks

Hosts in a dual-stack network have at least two IP addresses: an IPv4 address and an IPv6 address. A name resolution query for a hostname in a dual-stack network returns a mixture of IPv4 and IPv6 addresses, ordered in accordance with RFC 3484. When choosing between an IPv4 address and an IPv6 address of equal validity, RFC 3484 favours the IPv6 address.

There are two exceptions to this rule:

  • Java, by default, gives IPv4 addresses higher precedence than IPv6 addresses. To force Java to give IPv6 addresses higher precedence, see Changing a JVM’s preference for IPv4 addresses.

  • macOS gives consideration to round-trip time when ordering IP addresses. When IPv6 routing is slow, this can result in an IPv4 address being given greater precedence than an IPv6 address of equal validity.

Hostname resolution in a DataSource application occurs on two occasions:

  • Binding a DataSource socket (to a hostname)

  • Connecting to a peer’s DataSource socket (at a hostname)

Binding a DataSource socket

The datasrc-interface configuration item is used to bind a DataSource application’s DataSource socket to an IP address. It accepts an IP address, an IP address wildcard, or a hostname. If a hostname is supplied, the socket is bound to the IP address the hostname resolves to. Prior to DataSource 7, a name resolution query returned a single IPv4 address. From DataSource 7, a name resolution query returns a list of IP addresses ordered according to RFC 3484, and the DataSource socket is bound to the first IP address in the list. In a dual-stack network, the first IP address in the list will be an IPv6 address.

As an example, consider how a Liberator 6 server and a Liberator 7 server would respond to the following Deployment Framework configuration macro:

LIBERATOR${THIS_LEG}_DATASRC_INTERFACE  "liberator1.example.com"

The host liberator1.example.com is on a dual-stack network and has the following two IP addresses: 192.168.0.10 and 2001:0DB8::::::0001.

Liberator 6, based on DataSource 6, resolves the hostname liberator1.example.com to a single IPv4 address: 192.168.0.10

Liberator 7, based on DataSource 7, resolves the hostname liberator1.example.com to an ordered list of two addresses, with greater precedence given to IPv6 addresses: 2001:0DB8::::::0001 , 192.168.0.10

As a result:

  • Liberator 6 binds to 192.168.0.1

  • Liberator 7 binds to 2001:0DB8::::::0001

Binding Liberator 7 or Transformer 7 to an IPv6 address breaks compatibility with integration adapters built on DataSource 6. See Compatibility with DataSource 6 components below.

Connecting to a DataSource socket

The addr option of the add-peer configuration item is used to specify the location of a DataSource application’s peer. It accepts a space-separated list of IP addresses and hostnames, which the DataSource will try sequentially until a successful connection is achieved.

Prior to DataSource 7, a name resolution query returned a single IPv4 address. From DataSource 7, a name resolution query returns a list of IP addresses ordered according to RFC 3484, which the DataSource will try sequentially until a successful connection is achieved.

As an example, consider how a DataSource 6 adapter and an DataSource 7 adapter would respond to the following configuration:

add-peer
   remote-label     liberator1
   addr             liberator1.example.com
add-peer

The host liberator1.example.com is on a dual-stack network and has the following two IP addresses: 192.168.0.10 and 2001:0DB8::::::0001.

The liberator1 server is bound to the IP address 192.168.0.10

The DataSource 6 adapter resolves the hostname liberator1.example.com to a single IPv4 address: 192.168.0.10

The DataSource 7 adapter resolves the hostname liberator1.example.com to an ordered list of two addresses, with greater precedence given to IPv6 addresses: 2001:0DB8::::::0001 , 192.168.0.10

As a result:

  • The DataSource 6 adapter tries to connect to liberator1 at 192.168.0.10 and succeeds

  • The DataSource 7 adapter tries to connect to liberator1 at 2001:0DB8::::::0001 and fails. It tries the next IP address returned from the name resolution query, 192.168.0.10, and succeeds.

Compatibility with DataSource 6 components

Liberator 7 and Transformer 7 support connections from DataSource 6.2 adapters over IPv4. To achieve a successful connection in a dual-stack network, follow the guidance below:

  • assign an IPv4 address to datasrc-interface for Liberator 7 and Transformer 7

  • assign an empty value to datasrc-interface for Liberator 7 and Transformer 7.

    This creates an IPv6 socket that accepts IPv4-mapped connections. This option is only available if IPv4-mapping has not been disabled at the operating system level.

Be aware that assigning a hostname to datasrc-interface for Liberator 7 or Transformer 7 can block DataSource 6.2 adapters from connecting. Modern operating systems give IPv6 addresses higher precedence, so assigning a hostname to datasrc-interface usually binds the DataSource socket to an IPv6 address. This applies to the special hostname 'localhost' too, which usually binds a DataSource 7 socket to the IPv6 loopback address (::1).

Changing a JVM’s preference for IPv4 addresses

By default, the Java virtual machine (JVM) gives IPv4 addresses higher precedence than IPv6 addresses when resolving hostnames. In most scenarios, this does not affect the operation of a Caplin Platform deployment; however, if you need to change this preference, set the Java system property java.net.preferIPv6Addresses to true.

To configure a DataSource for Java adapter to give IPv6 addresses higher precedence, add the following configuration to the adapter’s java.conf file:

jvm-options  -Djava.net.preferIPv6Addresses=true

For more information on Java and IPv6 networking, see Oracle’s Networking IPv6 User Guide.


See also: