Select the product you need help with
How to change the binding order of network adapters in Windows XP and in Windows 2000Article ID: 894564 - View products that this article applies to. On This PageSUMMARYYou may have several network connections that are connected to different networks. Or, you may have a program that uses the first connection in the network connections list. You may want to make sure that a certain network connection is at the top of the list. When you install Microsoft Windows XP or Microsoft Windows 2000, the order of the connections may vary depending on how the network adapters are enumerated. You can use the methods that are described in this article to reorder adapters and bindings and to change the interface metric on the network adapters. This article describes how to perform the following tasks:
INTRODUCTIONThis article describes how to modify the network adapters
and the binding order in Microsoft Windows XP and in Microsoft Windows 2000.
This article also describes how to change the interface metric on network
adapters. MORE INFORMATIONThe following situations are situations in which you may
want to change the order of the connections in the list of network adapters and
bindings. These situations are also situations in which you might want to
change the interface metric on a network adapter. Note Changing the interface metric on the network adapter gives similar results:
How to change the binding order of network adapters
How to change the interface metric on a network adapterImportant This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:322756 You can change the interface metric on a network adapter if
you are using TCP/IP as a transport protocol because TCP/IP uses the interface
metric to determine the order. You can change the interface metric to make one
network adapter more favorable for all TCP/IP connections. The interface metric
(IPConnectionMetric) for a network connection indicates the cost of using the
routes in the IP routing table. The routes are derived from the interface
configuration. The cost becomes the value in the Metric column
for those routes in the IP routing table. If there are multiple routes that are
a close match for the route to a destination in the IP routing table, the route
that has the lowest metric is used. The range of valid values is 1 through
9999.
(http://support.microsoft.com/kb/322756/
)
How to back up and restore the registry in WindowsTo view the IP routing table, type route print at the command prompt. For more information about the Automatic Metric feature that is used in Windows XP for IP routes, click the following article number to view the article in the Microsoft Knowledge Base: 299540 To change the interface metric, follow these steps:
(http://support.microsoft.com/kb/299540/
)
An
explanation of the Automatic Metric feature for Internet Protocol
routes
How to create a fixed metric by changing the InterfaceMetric registry valueImportant This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:322756 You can create a fixed metric in Windows XP or in Windows
2000 without using the route commands. You can create the fixed metric by
changing the following registry key and then restarting the computer. When you
create the fixed metric, you can configure a specific network adapter to have
the lowest metric so that network adapter is used first.
(http://support.microsoft.com/kb/322756/
)
How to back up and restore the registry in WindowsNote The InterfaceMetric registry value is different for each network adapter. The InterfaceMetric registry value is located in the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\<GUID> Name: InterfaceMetric Type: REG_DWORD Value Data: A number from 1 to 9999 Determining the NetCfgInstanceId valueIn this registry key, GUID is the NetCfgInstanceId value of the network adapter. To determine the NetCfgInstanceId value of the first network adapter, view the following registry subkey:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001\NetCfgInstanceId HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0002\NetCfgInstanceId HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318} In Windows 2000, the InterfaceMetric registry value does not determine the network adapter that is used first. The network adapter that is selected first also depends on the interface initialization order. The interface initialization order frequently is the same from one startup to the next startup. However, the interface initialization order is not guaranteed to be the same for every startup. In Windows XP and in Windows 2000, set the metric of the preferred network adapter to be lower than the metrics of the other adapters. Setting the metric lower means that the network adapter has a higher priority. The metric takes precedence in the network adapter order. You can set the metric in the TCP/IP properties. The following information indicates the settings that you must use to set the metric of the preferred network adapter: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001\ Name: DriverDesc Value Data: 3Com 3C920 Integrated Fast Ethernet Controller (3C905C-TX Compatible) Name: NetCfgInstanceId Type: REG_SZ Value Data: {93396AAE-BCC4-49B4-BCDA-27CC97E9D97F} HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{93396AAE-BCC4-49B4-BCDA-27CC97E9D97F}\ Name:
InterfaceMetric Type: REG_DWORD Sample route metrics and link speedsWindows XP automatically sets relative route metrics based on link speeds such as the following.Collapse this table
299540 Windows 2000 does not automatically set relative
route metrics. Use the following netsh command to verify the current settings of each active interface.
To do this, type the following at the command prompt:
(http://support.microsoft.com/kb/299540/
)
An explanation of the Automatic
Metric feature for Internet Protocol routes
netsh
interface ip show address This command creates output that is similar to the following:Configuration for interface "Local Area Connection" DHCP enabled: Yes InterfaceMetric: 0 Configuration for interface "Wireless Connection" DHCP enabled: Yes InterfaceMetric: 35 For more information about how to modify the IP connection metric for a network adapter, visit the following Microsoft Web site: http://www.microsoft.com/technet/scriptcenter/scripts/network/client/modify/nwmovb25.mspx For more information about Microsoft Windows Management
Instrumentation (WMI) tasks for networking, visit the following Microsoft Web
site:
(http://www.microsoft.com/technet/scriptcenter/scripts/network/client/modify/nwmovb25.mspx)
http://msdn2.microsoft.com/en-us/library/aa394595.aspx For more information about the Win32_NetworkAdapterConfiguration WMI class, visit the following Microsoft Web site:
(http://msdn2.microsoft.com/en-us/library/aa394595.aspx)
http://msdn2.microsoft.com/en-us/library/aa394217.aspx
(http://msdn2.microsoft.com/en-us/library/aa394217.aspx)
How to set the interface metric by using a scriptMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.The following script uses the Win32_NetworkAdapterConfiguration WMI class. This class represents the attributes and the behavior
of a network adapter. This class uses the SetIPConnectionMetric method to set the routing metric that is associated with this
IP-bound network adapter for a wireless network connection. This method is a
new method for Windows XP. To use the script, copy the following code to a text file, save the file as "Set_Wireless_NIC_IPMetric.vbs," and then run the script. How to influence the binding order in Windows XP during unattended setupYou cannot change the connection order during an unattended setup. There also is no programmatic way to change the binding order of network adapters for a computer that is running. This inability to make a change is a problem if you want to programmatically move one local area connection ahead of another local area connection. However, no documented programmatic method exists for changing the order of the adapters.The sysprep command removes any networking configuration, and the networking configuration is reconfigured when you run the command. Because the sysprep command writes data to many registry settings and files, the sysprep command is difficult to use to force a change in the binding order. However, if you want to influence the binding order during unattended setup, you can try to specify one network adapter in the Sysprep.inf file. If you specify the local area network (LAN) adapter and then leave the other adapters to be detected after setup by the Plug and Play feature, Windows may put the LAN adapter at the top of the bindings list. For more information about how to disable network bindings, click the following article number to view the article in the Microsoft Knowledge Base: 263241
(http://support.microsoft.com/kb/263241/
)
How to disable network bindings
using the [Netbindings] section
The Bindview sample in the Microsoft Windows Driver Development KitThe Bindview sample in the Microsoft Windows Driver Development Kit (DDK) demonstrates how to use the INetCfg APIs to bind and to unbind a network adapter. These APIs are documented in the Windows DDK. The Bindview sample is located in the following location:\WINDDK\build\Src\Network\Config\Bindview Although binding and unbinding a network adapter is not difficult,
moving the network adapter binding is a complex task. No API exists that you
can use to move a network adapter binding. However, you can write a stand-alone
application to move a network adapter binding by using the INetCfg APIs. To do
this, you have to enumerate all the bindings for all the components that are
installed on the adapters. Then, you have to move the binding path for each
binding so that each binding appears before another binding.For more information about the INetCfg interface, visit the following Microsoft Web site: http://msdn2.microsoft.com/en-us/library/ms805265.aspx You can enumerate all the adapters, and you can enumerate anything
that is bound to each network adapter. Finally, you can use the
INetCfgComponentBindings API to unbind the component.
(http://msdn2.microsoft.com/en-us/library/ms805265.aspx)
Note Older DDKs such as the Microsoft Windows 2000 DDK and the Windows XP Gold DDK contained the SNetCfg sample that demonstrated these APIs. Change the network provider orderYou can also change the network provider order so that a specific redirector is picked first. These redirectors include server message block (SMB), Web Distributed Authoring and Versioning (WebDAV), and Novell NetWare Client for Windows. The following are the registry subkeys that are related to the redirector.Collapse this table
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order Name:
ProviderOrder Type: REG_SZ Value data: LanmanWorkstation,WebClient,RDPNP The MoveBefore method and the MoveAfter methodYou can write a tool in C++ to change the order of the network adapters and the bindings on Windows XP-based client computers. In the tool, use the following:
The Bindview sample in the Windows DDK demonstrates how to use the INetCfgComponent API and the INetCfgComponentBindings API. The sample provides code that you can use to change the protocol binding order on a network adapter. The following pseudo code sorts the bindings correctly. The INetCfg API is the Win32 call that the control program is using. For more information, see the Windows DDK. Note The INetCfg API is located in the following location: C:\Winnt\Syste32\Netcfgx.dll To use the MoveBefore method, follow these steps:
Pseudo codeREFERENCES For more information, click the following article numbers
to view the articles in the Microsoft Knowledge Base: 263241
(http://support.microsoft.com/kb/263241/
)
How to disable network bindings using the [Netbindings] section
299540
(http://support.microsoft.com/kb/299540/
)
An
explanation of the Automatic Metric feature for Internet Protocol
routes
311272
(http://support.microsoft.com/kb/311272/
)
DevCon command line utility alternative to Device Manager
260937
(http://support.microsoft.com/kb/260937/
)
Some WMI properties and methods are not published in the directory service schema
827536
(http://support.microsoft.com/kb/827536/
)
An IP multicast may not be sent correctly from Windows 2000, Windows XP, or Windows Server 2003
171320
(http://support.microsoft.com/kb/171320/
)
How to change the IP address list order returned
164023
(http://support.microsoft.com/kb/164023/
)
Applications calling gethostbyname() for the local host name may see the list of IP addresses in an order that does not match the binding order
229762
(http://support.microsoft.com/kb/229762/
)
Specifying multiple network adapters in unattended setup
268781
(http://support.microsoft.com/kb/268781/
)
Description of the Netset.exe tool from the Windows 2000 Resource
Kit
242468
(http://support.microsoft.com/kb/242468/
)
How to use the Netsh.exe tool and command-line switches
271369
(http://support.microsoft.com/kb/271369/
)
Statically-entered TCP/IP settings are not present after Sysprep
216937 For more information about Microsoft Windows Server
2003 TCP/IP implementation details, visit the following Microsoft Web site:
(http://support.microsoft.com/kb/216937/
)
System Preparation tool and Answer File usage
http://technet2.microsoft.com/WindowsServer/en/library/823ca085-8b46-4870-a83e-8032637a87c81033.mspx?mfr=true For more information about network configuration interfaces, visit
the following Microsoft Web site:
(http://technet2.microsoft.com/WindowsServer/en/library/823ca085-8b46-4870-a83e-8032637a87c81033.mspx?mfr=true)
http://msdn2.microsoft.com/en-us/library/ms805249.aspx
For more information about the INetCfgComponentBindings interface,
visit the following Microsoft Web site:
(http://msdn2.microsoft.com/en-us/library/ms805249.aspx)
http://msdn2.microsoft.com/en-us/library/ms805207.aspx For more information about the INetCfgComponentBindings::MoveBefore method, visit the following Microsoft Web site:
(http://msdn2.microsoft.com/en-us/library/ms805207.aspx)
http://msdn2.microsoft.com/en-us/library/ms805260.aspx
(http://msdn2.microsoft.com/en-us/library/ms805260.aspx)
PropertiesArticle ID: 894564 - Last Review: February 16, 2007 - Revision: 3.6 APPLIES TO
| Article Translations |


Back to the top








