0

The common knowledge seems to be that the lower metric value determines the precedence of one route over the other. While it does seem to make the system eventually pick the right route (metric 2), there is still noticeable lag that goes completely away after manual deletion of the offending route (metric 1000). For the record, the metric 1000 device is an Ethernet adapter, while the other is an NDIS sharing device (an android phone with usb tethering).

Edit: both routes are dest 0.0.0.0 mask 0.0.0.0

Edit2: "interface metric" as per this also seems to be lower for my preferred route that isn't working properly

Edit3: pasting in my routing table for reference

    ===========================================================================
Interface List
  3...02 50 01 0a 36 63 ......Remote NDIS based Internet Sharing Device
 18...f0 79 59 68 07 d9 ......Intel(R) Ethernet Connection (2) I218-V
 23...0a 00 27 00 00 17 ......VirtualBox NDIS 6.0 Miniport Driver
 17...0a 00 27 00 00 11 ......VirtualBox Host-Only Ethernet Adapter
  1...........................Software Loopback Interface 1
 13...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter
  8...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2
 21...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #3
  5...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo-Interface
  9...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #4
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0    192.168.1.254    192.168.1.105   1000
          0.0.0.0          0.0.0.0   192.168.42.129   192.168.42.140      2
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    331
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    331
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    331
      192.168.1.0    255.255.255.0         On-link     192.168.1.105    756
    192.168.1.105  255.255.255.255         On-link     192.168.1.105    756
    192.168.1.255  255.255.255.255         On-link     192.168.1.105    756
     192.168.42.0    255.255.255.0         On-link    192.168.42.140    257
   192.168.42.140  255.255.255.255         On-link    192.168.42.140    257
   192.168.42.255  255.255.255.255         On-link    192.168.42.140    257
     192.168.56.0    255.255.255.0         On-link      192.168.56.1    281
     192.168.56.1  255.255.255.255         On-link      192.168.56.1    281
   192.168.56.255  255.255.255.255         On-link      192.168.56.1    281
    192.168.128.0    255.255.255.0         On-link     192.168.128.2    281
    192.168.128.2  255.255.255.255         On-link     192.168.128.2    281
  192.168.128.255  255.255.255.255         On-link     192.168.128.2    281
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    331
        224.0.0.0        240.0.0.0         On-link      192.168.56.1    281
        224.0.0.0        240.0.0.0         On-link     192.168.128.2    281
        224.0.0.0        240.0.0.0         On-link     192.168.1.105    756
        224.0.0.0        240.0.0.0         On-link    192.168.42.140    257
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    331
  255.255.255.255  255.255.255.255         On-link      192.168.56.1    281
  255.255.255.255  255.255.255.255         On-link     192.168.128.2    281
  255.255.255.255  255.255.255.255         On-link     192.168.1.105    756
  255.255.255.255  255.255.255.255         On-link    192.168.42.140    257
===========================================================================
kotelcat
  • 11
  • 2
  • 4

1 Answers1

0

Route selection on windows, involves:

  1. Finding the most specific routes to the destination
  2. Selecting the most specific route with the lowest metric.

The first step involves evaluating each route table entry to see how many of the route's network bits match that of the destination addresses' bits (strictly left to right or high-order to low-order). The value(s) with the most matching bits proceeds to step 2. generally speaking, the route with largest number of subnet mask bits will win (addresses that devote more of their space to network bits).

for example: 10.0.0.0/8 is a less specific route to 10.1.2.132 than 10.1.0.0/16 which is less specific than 10.1.2.0/24 which is less specific than 10.1.2.128/25, which is less specific than 10.1.2.132/32

When there is a tie in number of matched network bits, the path metric is used to determine the winner.

Of these steps, the selection of a final route by metric is trivial in comparison to the evaluation of the entries in the routing table, so having fewer routes to choose from will always reduce the complexity of the operation more than rigging metrics. In most cases metric will not even be evaluated, unless there are multiple paths to the same destination.

A note on default gateways however; they will always be used when there is no other matching route. Any route to a destination, no matter how unspecific, will be used before the default gateway route is used.

Frank Thomas
  • 37,476