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.