How to Change the IP Address List Order ReturnedID: Q171320
|
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.
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.
NOTE: There is a fix that, when applied, will list the first IP address of
each NIC in the system, then the remainder of the IP addresses from all
NICs. For additional information, please see the following article in the
Microsoft Knowledge base:
Q164023 Fix for GetHostByName() IP address Order on Local Multihomed MachinesTo 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.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<Netcard1>
where <Netcard1> is the name of the first bound network adapter in the
computer, as it appears in the registry.
Value Name: DependOnService
Value Type: REG_MULTI_SZ
Data: Netcard2
Additional query words: change returned multihomed multi-homed
Keywords : kbnetwork nttcp NTSrvWkst
Version : WinNT:4.0
Platform : winnt
Issue type : kbinfo
Last Reviewed: February 23, 1999