1

have machine with two network interfaces: Ethernet and WiFi. Primary connection to internet is via Ethernet and this utilize static IPv4 settings. When connect wifi (utilizing DHCP) to wifi router with another internet connectivity, have (as expected) two default routes with different metric in system. INternet goes via wifi (because of lower metric), this is fine.

When perform wifi disconnect, internet goes back to ethernet and work OK, but when perform command netsh in ip sh ro got two default routes in listing. One is from ethernet adapter metric 256 and second is remaining default route from (now disconnected) wifi adapter with metric 0. This route is unpingable (as expected).

Publish  Type      Met  Prefix                    Idx  Gateway/Interface Name
-------  --------  ---  ------------------------  ---  ------------------------
No       Manual    256  0.0.0.0/0                  22  10.12.70.65
No       Manual    0    0.0.0.0/0                   7  192.168.148.251

When perform netstat -rn got only one default route with metric 281

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      10.12.70.65      10.12.70.66    281

Why is there this discrepancies between both listings? Its a bug or it have some hidden meaning? (number 281 seems to be substraction of route metric and interface metric)

UPDATE:

command netsh in ip sh config Wifi look also like this

Configuration for interface "WiFi"
    DHCP enabled:                         Yes
    Default Gateway:                      192.168.148.251
    Gateway Metric:                       0
    InterfaceMetric:                      55
    DNS servers configured through DHCP:  192.168.148.251
    Register with which suffix:           Primary only
    WINS servers configured through DHCP: None

command netsh in ip sh addresses WiFI

Configuration for interface "WiFi"
    DHCP enabled:                         Yes
    Default Gateway:                      192.168.148.251
    Gateway Metric:                       0
    InterfaceMetric:                      55

command powershell "Get-NetRoute -DestinationPrefix "0.0.0.0/0" | format-list -property *"

Publish               : No
Protocol              : NetMgmt
Store                 : ActiveStore
AddressFamily         : IPv4
State                 : Alive
ifIndex               : 7
Caption               :
Description           :
ElementName           :
InstanceID            : :8:8:8:9:55A55;C<8;@B8;>B8<?;55;
AdminDistance         :
DestinationAddress    :
IsStatic              :
RouteMetric           : 0
TypeOfRoute           : 3
CompartmentId         : 1
DestinationPrefix     : 0.0.0.0/0
InterfaceAlias        : WiFi
InterfaceIndex        : 7
InterfaceMetric       : 55
NextHop               : 192.168.148.251
PreferredLifetime     : 00:59:59
ValidLifetime         : 00:59:59
PSComputerName        :
CimClass              : ROOT/StandardCimv2:MSFT_NetRoute
CimInstanceProperties : {Caption, Description, ElementName, InstanceID...}
CimSystemProperties   : Microsoft.Management.Infrastructure.CimSystemProperties

Publish               : No
Protocol              : NetMgmt
Store                 : ActiveStore
AddressFamily         : IPv4
State                 : Alive
ifIndex               : 22
Caption               :
Description           :
ElementName           :
InstanceID            : :8:8:8:9:55<<55;:8;<8A:8@?55;
AdminDistance         :
DestinationAddress    :
IsStatic              :
RouteMetric           : 256
TypeOfRoute           : 3
CompartmentId         : 1
DestinationPrefix     : 0.0.0.0/0
InterfaceAlias        : ETH0
InterfaceIndex        : 22
InterfaceMetric       : 25
NextHop               : 10.12.70.65
PreferredLifetime     : 10675199.02:48:05.4775807
ValidLifetime         : 10675199.02:48:05.4775807
PSComputerName        :
CimClass              : ROOT/StandardCimv2:MSFT_NetRoute
CimInstanceProperties : {Caption, Description, ElementName, InstanceID...}
CimSystemProperties   : Microsoft.Management.Infrastructure.CimSystemProperties

UPDATE2:

When unplug wifi adapter from USB slot, than replug it back again, default route related to this adapter disappear from all lists.

1 Answer 1

0

You are seeing here the behavior of the driver for the WiFi router. When not connected, it sets the metric to zero, as long as the device is powered on.

I have searched the meaning of a zero metric, and it seems to depend on the manufacturer. For example, for some Cisco devices it means a direct cable connection (so zero overhead). For other devices, this only means an invalid parameter.

Perhaps the reference that conforms the most to your experience, I found strangely enough in the Contiki Operating System:

/* These specifiy the sink's routing metric (0) and the maximum
   routing metric. If a node has routing metric zero, it is the
   sink.

The word "sink" seems to mean the edge of the network, meaning that there is nothing to be connected further on.

Apparently, the driver to your device sets the metric to zero to signal that the device exists, but there is no further connection possible beyond it. Windows seems to understand it in a similar way.

7
  • this is no answer for my question. My question is why netstat report single default route, but netshand other tools report two DRs. Have doubts the two system tools i am atlking about communicate directly to wifi driver, this is done via networking subsystem API rather. So behaviour I am referring should be issue windows netwoking layer rather than wifi driver.. Nov 23, 2022 at 15:35
  • I mean to show that each application and even each driver interprets a zero metric in its own way. Your post shows that route displays it, netstat ignores it etc.
    – harrymc
    Nov 23, 2022 at 15:41
  • there is no problem with metrics, there is problem the netshdisplay default route which no longer exist (as wifi adapter is in media disconnected state). Default route which was get via DHCP AFAIK should be released by media disconnect. Windows networking subystem (routing table) contain one OR two default routes at one time. Its not a Schrodingers cat to be "not in any of both states in time". Nov 23, 2022 at 16:25
  • Not only netshdisplay - also Get-NetRoute shows it, so it likely exists in the routing table but is understood to be in a state of disconnected/unusable/sink/whatever. If a bug, it's rather in the WiFi driver when setting the metric to zero, when the entire route should have been deleted instead. But it seems that this is not a problem that prevents Windows from functioning correctly.
    – harrymc
    Nov 23, 2022 at 16:32
  • 1
    It might intelligently ignore routes with metric zero.
    – harrymc
    Nov 23, 2022 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.