How does Windows 7 decide which route to take if 2 connections to an internet source exist? (e.g. a Wireless and an Ethernet one to a router)

43

9

How does Windows 7 decide which route to take if 2 connections to the Internet exist? (e.g. wireless versus wired)

j riv

Posted 2010-10-12T07:47:19.963

Reputation: 2 162

Answers

26

If there are more than 1 path, Windows will refer to the metric from the routing table. Use route print to show it. Basically, it will prefer the path with the lowest metric.

In the past, the metric is derived from the speed of the link; however, the rules for Win7 are still unknown according to this.

fseto

Posted 2010-10-12T07:47:19.963

Reputation: 1 311

Actually, it's more complicated than that. For details, see answers by Daniele and Traveling Tech Guy. – Alexandr Zarubkin – 2017-06-05T11:31:29.517

24

There's the routing table. You could use the route command to check out the metrics. In the command line (Run: cmd):

> route PRINT

But, you could also change the internet connection order:

  1. Go to: Control Panel -> Network and Sharing Center -> Change adapter settings

  2. Hit Alt so the top menus show and go to Advanced -> Advanced Settings...

  3. Finally, in the Adapters and Bindings tab, modify Connections order as desired

Belmin Fernandez

Posted 2010-10-12T07:47:19.963

Reputation: 2 691

7adapters and binding tab is removed in windows 10 – BozoJoe – 2017-10-18T20:02:44.330

s/list/print ..... – j riv – 2010-10-13T10:18:58.270

12

if there are 2 default routes (gateway) it preferes the one with lower metric

the route metric in windows 7 is the sum of the adapter metric and the gateway metric

if you manually set identical metric (for example 24 on the adapter1 and 2 on the gateway1; 25 on the adapter2 and 1 on the gateway2 in the TCP/IP advanced settings) it seems that windows 7 does a kind of load balancing for apps opening multiple tcp/ip connections and does automatic failover too.

I am testing this on my Windows 7 x64 Ultimate edition with a 54Mbps wireless adapter + 100 Mbps ethernet adapter and 2 ISP

no Microsoft docs found about this till now

Daniele

Posted 2010-10-12T07:47:19.963

Reputation: 121

6

In my experience, it will always prefer the more "permanent" connection method. I.e. Ethernet preferred to Wireless, Wireless preferred to Bluetooth etc. (all the way down to modem). But failover exists as well, so if Ethernet gets disconnected, Windows will attempt to connect over Wireless.

Case in point: I have a 300Mbps Wireless-N network. If I connect my laptop to the router directly (100Mbps Ethernet), Windows switches to that connection (without disconnecting the wireless network).

Traveling Tech Guy

Posted 2010-10-12T07:47:19.963

Reputation: 8 743

1I get exactly the reverse on my laptop - with wireless n and 100Mbps Ethernet, Win 7 will prefer wifi. This is despite the ethernet adapter being set as higher priority in the adapter settings (as far as I can tell, this setting is ignored in favour of the metric). – aucuparia – 2015-04-23T15:25:37.350

3

While part of the answer is relating to the metric of the route, it is not the only detail that dictates the path. In part of the route table, you can see where the destination network is (with a subnet mask), and which interface to talk to it on.

You can specify more "specific" routes to take, and the most specific rules will prevail. For example, if you had a home network at 192.168.0.0/24, your default route table knows to use Ethernet. If you add a direct route to 192.168.0.0/25 to be routed through your Wi-Fi adapter, then any hits to 192.168.0.0 through to 192.168.0.127 will go through your Wi-Fi, and the remainder of your network through Ethernet. If you Default Gateway (next hop) is 192.168.0.1, then your default gateway will connect over Wi-Fi, as that is where the "most specific route" exists. Likewise, if your gateway is 192.168.0.254, it would go through your Ethernet.

OpenVPN uses this method as well. Instead of replacing the 0.0.0.0/0 route (default route), it creates two routes - 0.0.0.0/1 and 128.0.0.0/1 - that route through the VPN interface. This way, if the VPN interface has issues, it can fall back to your standard Default Gateway.

Canadian Luke

Posted 2010-10-12T07:47:19.963

Reputation: 22 162

This is the bit I was looking for - 0.0.0.0 route has a low metric, but it still favours a more specific route (e.g. 10.100.0.0 for a VPN) – MrPurpleStreak – 2020-02-28T15:51:03.687

-4

Windows will automatically use the one with higher rated speed. Not sure though which one it will choose in case they both have the same speed.

Artem Pakk

Posted 2010-10-12T07:47:19.963

Reputation: 364