Thursday, June 30, 2011

How to change the Gateway Metric on Windows 7

If there are multiple physical adapters present in the network, Windows 7 will always look at and compare the indices of gateway metric among the physical adapters and then pick the one with the lowest index to use. In order to override the default settings, you need to adjust the index of gateway metric for each physical adapter. The adapter assigned with the lowest index will always take precedence and used by Windows 7 automatically. For instance, if you want to use the wired connection when both wired and wireless are available in your network. You need to assign the lower gateway metric index to your LAN card so that you can ensure that your favorite adapter will be used by Windows 7 whenever it is available. In my previous post, I mentioned how to use route change command to adjust gateway metric index. In this post, I will present you an easy way to do it without going to the command prompt.

  • Open Network Connection from Network and Sharing Center. Or type ncpa.cpl in the search box at your Windows Explorer or Start menu.
  • Select your favorite connection, e.g., Local Area Connection and then right click to select Properties.
  • In the Networking tab, select the Internet protocol version, e.g., Internet Protocol Version 4 (TCP/IPv4).
  • And then click Properties button.
  • In protocol Properties dialog box, click Advanced....
  • Inside the Advanced TCP/IP Settings, at the IP Settings tab, click Add... of the Default gateways.
  • Uncheck the Automatic metic checkbox, and then enter your router IP (e.g. 192.168.1.1) and assign your metric index. Click Add to insert the entry.

    Default Gateway Settings
  • Click all OK's to exit.

The changes will immediately take effect. If you check your route table after changes (using route print command), you'll find a new entry in the Persistent Routes.

===========================================================================
Persistent Routes:
  Network Address          Netmask  Gateway Address  Metric
          0.0.0.0          0.0.0.0      192.168.1.1      20
===========================================================================

Regardless of the IP address obtained automatically or statically, changing gateway metric can be done via either route change command or network connection GUI (ncpa.cpl).

When you use route print to verify your settings, the metric indices usually will double the number you enter.

Use netsh int ip show config will show the exact settings you will find in the network connection properties.

I hope you'll find this information useful to you.