How to Change the IP Address List Order Returned

Last reviewed: December 9, 1997
Article ID: Q171320
The information in this article applies to:
  • Microsoft Windows NT Workstation version 4.0
  • Microsoft Windows NT Server version 4.0

SUMMARY

The Windows Sockets gethostbyname() API can be used to retrieve IP addresses assigned to a computer. If the host name sent in the query is NULL, or the local host name of the computer, gethostbyname() will return a list of IP addresses assigned to all network cards installed in the computer.

Some third-party device drivers are sensitive about the IP address order in the list returned by gethostbyname(); the device drivers require that the IP address to which they are bound do not show up at the top of the list.

MORE INFORMATION

Under Windows NT 3.51, the IP address list is in the same order as the TCP/IP network card binding order; therefore, altering the TCP/IP network card binding order will indirectly change the IP address order returned by gethostbyname().

Under Windows NT 4.0, that binding order does not influence the IP address order. Alternatively, a registry value, DependOnService, can be used to indirectly control the IP address order.

To influence the order of the IP address list, follow the steps below. These steps assume that you have two network adapter cards installed in a Windows NT 4.0 server computer. The driver names for the network adapters are Netcard1 and Netcard2. The steps below will cause the IP address order to list Netcard2's IP addresses first.

WARNING: Using Registry Editor incorrectly can cause serious, system-wide problems that may require you to reinstall Windows NT to correct them. Microsoft cannot guarantee that any problems resulting from the use of Registry Editor can be solved. Use this tool at your own risk.

  1. Start Registry Editor (regedt32.exe) and select the following subkey:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netcard1

  2. From the Edit menu, click Add Value, and type the following information:

    Value Name: DependOnService Value Type: REG_MULTI_SZ

       Data:       Netcard2
    
    
NOTE: This workaround only applies to Windows NT 4.0 computers that have multiple network adapters installed and only when it is querying the local host name. It has no effect when querying other computers on the network.


Additional query words: change returned multihomed multi-homed
Keywords : NTSrvWkst nttcp kbnetwork
Version : WinNT:4.0
Platform : winnt
Issue type : kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: December 9, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.