Dela via


Connecting Using IPv6

SQL Server and SQL Server Native Client fully support both Internet Protocol version 4 (IPv4) and Internet Protocol version 6 (IPv6). When Windows is configured with IPv6 SQL Server, components automatically recognize the existence of IPv6. No special SQL Server configuration is necessary.

Support includes but is not limited to the following:

  • The SQL Server Database Engine and the other server components can listen on both IPv4 and IPv6 addresses at the same time. When both IPv4 and IPv6 are present, you can use SQL Server Configuration Manager to configure the Database Engine to listen only on IPv4 addresses or only on IPv6 addresses.

  • When the SQL Server Browser service running on a machine that supports both IPv4 and IPv6 is queried on an IPv4 address, it responds with an IPv4 address and the first IPv4 TCP port in its list. When queried on an IPv6 address, it responds with an IPv6 address and the first IPv6 TCP port in its list. To avoid inconsistency, we recommend that the IPv4 and IPv6 listeners be configured to listen to the same port.

  • Tools such as SQL Server Management Studio and SQL Server Configuration Manager accept both IPv4 and IPv6 formats for IP addresses. In most cases, the connection string does not need to be modified if the <computer_name>\<instance_name> is specified using server hostname or fully qualified domain name (FQDN). If the server computer has both IPv4 and IPv6, its hostname or FQDN will be resolved into multiple IP addresses, including at least one IPv4 address and multiple IPv6 addresses. SQL Server Native Client attempts to establish connections using these IP addresses in the order received from TCP/IP and uses the first connection that succeeds. Because the order cannot be predicted by SQL Server Native Client, this should be regarded as random order. IPv4 addresses are attempted first if both IPv4 and IPv6 addresses are present. This logic is transparent to the users of ODBC, OLE DB, or ADO.NET.

    Note

    If the Database Engine is not listening on IPv4, the attempted IPv4 connection must wait for the time-out period before the IPv6 address is attempted. To avoid this, connect directly to the IPv6 IP address or configure an alias on the client with the IPv6 address.