Using router metric to specify primary gateway

If you are able to connect to several gateways/routers to other networks, it is possible to prioritize in which order the gateways should be searched for a certain address.

This is done by the Metric setting which is assigned to each gateway. The gateway with lowest Metric is the first to be searched(Default Gateway). Metric is the cost of using that gateway, and it will always use the one with the lowest cost first.

The metric can also be applied when having more than one network adapter, which connects to the same Network(Subnet). Example if using a wireless NIC and a standard NIC, then one can decide if it should use go through the Wireless NIC before using the Standard NIC. This is done by lowering the interface metric of the Wireless NIC.

The metric can also be used for manual load balancing between multiple network adapters:
  • Install TCP/IP for all adapters and assign them a different IP-address on the same subnet (Becomes Multihoming)
  • If a certain adapter should be dedicated for outgoing traffic then it should be given a lower interface metric
  • If a certain adapter should be used for certain incoming traffic then make sure the clients connects to its IP-Address
    • Note Netbios traffic (outgoing/incoming) can only be handled by a single adapter or else a name conflict will arise (Though it doesn't have to be the one dedicated for outgoing IP traffic)
    • Note it is possible for clients to connect to a service (FTP/HTTP,etc.) through all network adapters (To force clients to use a certain adapter one can use DNS or port blocking)
To configure the metric in Win2k/WinXP (WinNT4/Win9x can use the command "route"):
  1. Open Control Panel
  2. Double click Network and Dial-up Connections(Win2k) or Network Connections(WinXP)
  3. Righ click Local Area Connection and select Properties
  4. Double click Internet Protocol (TCP/IP)
  5. Press Advanced-button and it is possible to configure gateways and interface metric
Note Automatic Metric is a new feature in WinXP, which automatically assign a metric value according to interface bandwidth (Not latency), the higher bandwidth the lower the metric. More Info MS KB299540

Note if two network interfaces have the same metric value, then their priority is based on the network binding order. To configure the network binding order in Win2k/WinXP:
  1. Open Control Panel
  2. Double click Network and Dial-Up Connections
  3. In the menu select Advanced and select Advanced Settings...
    • Vista/Win7 will only display the Advanced menu-item when pressing the ALT-key. More Info MS KB2526067.
  4. Select the Adapter and Bindings-tab and change the priority of the network Connections.
More Info MS KB140859
More Info MS KB164214
More Info MS KB894564
More Info Cable Guy - Default Gateway Behavior for TCP/IP

Credits www.jsifaq.com

Updated: 31 March 2015

Comments:

  1. mark w says:

    YES and it works i set the Metric on the wifi to 1 and on the Ethernet to 2 then go to (run > cmd > netstat -r) shown at the bottom the default gate way is 192.168.0.1 (wifi) and before I did this it was 192.168.2.1 (Ethernet). The internet is on the wifi card and the Ethernet is connetid two a router and two Network printer and a computer. The computer is the same deal wifi for internet Ethernet for network. The router dos not connect to the internet. Shared office.

  2. Ali H. NoureEddine says:

    Yes Yes Yes

    Thanks alllllllllllt

    it works greeeeeeeat

  3. Abdul Haseeb says:

    What if two gateways have same metric and both are connected to same LAN?

  4. Zangune says:

    Old post, still useful. Thanks Snakefoot for this.
    To use Microsoft Knowledge base links remove last Q from the URL.
    Abdul Haseeb please use the forum for computer help, you can find the forum here http://smallvoid.com/forum/
    Anyway, if I read well, I believe the answer to your question is in this statement: "Note if two network interfaces have the same metric value, then their priority is based on the network binding order".

    1. Snakefoot says:

      I have now updated the links to the Microsoft Knowledge Base (KB), so they are working again. Thank you for the notice.

  5. Zangune says:

    And thank you very much to keep a 13 years old article up to date and to keep reading comments.

Leave a Reply

Your email address will not be published. Required fields are marked *