18

KB299540 explains how Windows XP automatically assign metrics to IP routes:

The following table outlines the criteria that is used to assign metrics for routes that are bound to network interfaces of various speeds.

Greater than 200 Mb: 10
Greater than 20 Mb, and less than or equal to 200 Mb: 20
Greater than 4 Mb, and less than or equal to 20 Mb: 30
Greater than 500 kilobits (Kb), and less than or equal to 4 Mb: 40
Less than or equal to 500 Kb: 50

However, they seem to have changed their algorithm in Windows 7, as my routing table looks like this:

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.0.1      192.168.0.3     10
          0.0.0.0          0.0.0.0   10.202.254.254       10.202.1.2    286
       10.202.0.0      255.255.0.0         On-link        10.202.1.2    286
       10.202.1.2  255.255.255.255         On-link        10.202.1.2    286
   10.202.255.255  255.255.255.255         On-link        10.202.1.2    286
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
      192.168.0.0    255.255.255.0         On-link       192.168.0.3    266
      192.168.0.3  255.255.255.255         On-link       192.168.0.3    266
    192.168.0.255  255.255.255.255         On-link       192.168.0.3    266
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link       192.168.0.3    266
        224.0.0.0        240.0.0.0         On-link        10.202.1.2    286
  255.255.255.255  255.255.255.255         On-link        10.202.1.2     40
===========================================================================

The only "correct" metric is the first one (Gigabit connection = 10). However, other routes using the Gigabit connection have metric = 266, my VPN has metric = 286, and loopback is 306 (?!).

Any idea what's going on?

1
  • Any luck figuring this out? In XP when my VPN connects, all the routes to the remote network have a metric of 1 and local connections are 10. In Windows 7 even if you use the 'METRIC' parameter in the 'route add' command it still shows up with some arbitrary metric. Further, in XP all the interfaces are set to automatic metric. In Windows 7 even by specifying metrics on every interface they still come up arbitrarily! What gives? Nov 6, 2009 at 16:20

4 Answers 4

2

I don't think it's new to Windows 7, I think it's there in Vista too.

However, I don't believe there's been a published set of rules that the algorithm follows, just that it's now on a scale of 1-9999.

1

I don't know the algorithm as well, but you can force a specific metric by changing it on the TCP/IP properties of your network card. On the General tab, click Advanced, uncheck Automatic Metric and set whatever value you like.

I tried this with somewhat a moderated sucess:

  • - On a restart this setting gets overwritten;
  • - When I connect my 3G modem it sets every other network adapter to a Metric value of +3k (while it retains a 30 value on its metric... :( )
  • - If I try to add a route rule the metric I defined is added to the interface's base metric, instead of being an absolute value. ([ref][1])

Does anyone know hoe to cincurvent any of these problems?

1

I know this is an old question, but it's one I recently needed the answer to.

I believe the metric you're seeing is actually the interface metric + gateway metric, as noted in one of the answers at https://social.technet.microsoft.com/Forums/windows/en-US/b1fb3e43-300d-49fe-b7a9-be95c7454a82/metric-for-the-default-route?forum=w7itpronetworking . Thus, the calculated metric can be altered by changing which gateway is default or disabling automatic metrics.

Automatic metrics can be disabled in the connection's IPv4 properties. Click Advanced on the General tab, uncheck the Automatic metric box, and add your own value - such as 1.

0

Myabe the metric has a meaning when the OS is comparing routes from the same protocol? And in that case there should be another metric which is not shown in this table in order to compare the importance of protocols (I mean direct connected, vpn, or other protocols etc)

In general in routing this metric has importance when comparing same protocols. FOr example if OSPF is used metric is taken into account for comparing routes coming from OSPF, but when comparing OSPF route and a directly configured interface, metric has no importance because by default the directly connected will be always preferred.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .