1

I have two network interfaces on my machine which provide Internet. At the moment, one of them is limited in bandwidth by provider because I'm over my month traffic limit. I want to make another network interface (Android phone tethering) default for routing Internet traffic.

Currently, I've increased metric on the 1st network interface. The routing table looks as follows (only relevant part is shown). As you can see, the metric for 192.168.0.1 gateway is higher:

route print

IPv4 Route Table
===========================================================================
Active routes:
  Network address     Network mask      Gateway        Interface         Metric
          0.0.0.0          0.0.0.0      192.168.0.1    192.168.0.118     40
          0.0.0.0          0.0.0.0   192.168.42.129    192.168.42.89     10

I'm on Russian version of Windows 7, and I've translated command output into English, so the captions may look not exactly as they should on English version of Windows 7, but it doesn't matter here.

But Internet traffic still seems to go through the 1st interface, even though its metric is higher:

tracert -d google.com

Tracing route to google.com [216.239.38.120]
with maximum number of hops 30:

  1    <1 ms    <1 ms    <1 ms  192.168.0.1
etc...

I cannot unplug the cable from the 1st network interface because I need access to LAN. I know that I can temporarily delete one of default routes, but I need to do it every time I want to use alternative interface for Internet.

Are there any other options to make Internet traffic flow through the 2nd interface?

  • Does this: support.microsoft.com/en-us/help/2526067 - change the Metric, or do you want to try it and see if it works? – Kinnectus Jun 5 '17 at 10:37
  • A higher metric means a higher 'cost' to using that interface - windows will try and use the one with the lowest cost. 40 to 10 means a 4:1 ratio of which will be used - try setting it to a far higher amount, 400+ for example, and see if this changes the routing enough? – djsmiley2k Jun 5 '17 at 11:07
  • @BigChris No, it doesn't change the metric. Moreover, the 2nd interface in that window is higher than the 1st one, so it should be preferred. – Alexandr Zarubkin Jun 5 '17 at 11:08
1

As per this answer windows is stupid and needs a hint on which interface it should use, evne when you've correctly set the metrics!

As per the linked answer:

To do this, open the Network and Sharing Center and click on Change adapter settings in the left pane. you should see a list of network adapters. Press the Alt button (if the menu bar is not already visible) and click on the Advanced menu, and then choose Advanced settings.

A new control panel will pop up, and you should see it open to the Adapters and Bindings tab. In the top list should be a list of your network adapters, with an up and down arrow button to the right. This is the priority order of what adapter it will use when connecting to the Internet. Choose your Ethernet adapter and click the up arrow button until it shows at the top. Then click OK.

  • See my comment to BigChris. The adapters are already ordered correctly. – Alexandr Zarubkin Jun 5 '17 at 11:16
1

Okay, I've solved my question. At the time of asking, it seems I've already somehow messed up routing settings. So, as the first step, I've reset routing to default:

netsh interface ip set interface 19 metric=auto
netsh interface ip set interface 29 metric=auto
route delete 0.0.0.0 mask 0.0.0.0

The interfaces' indices can be determined from netsh interface ip show interface command. They were 19 and 29 for me.

Then I've refreshed IP settings:

ipconfig /renew

This brought back default routes on both interfaces having equal metrics of 266 (== gateway metric 256 + interface metric 10 - these metrics are somehow calculated by Windows itself after I've deleted my manual settings in previous paragraph). For more information on gateway metric and interface metric see these two answers: https://superuser.com/a/345351/434875 and https://superuser.com/a/198556/434875.

Finally, I've set interface metric manually on the interface I want to be default:

netsh interface ip set interface 29 metric=10

After reboot and checking I have the following routing table:

Network address     Network mask      Gateway        Interface         Metric
          0.0.0.0          0.0.0.0   192.168.42.129    192.168.42.89    20
          0.0.0.0          0.0.0.0      192.168.0.1    192.168.0.118    266

And now the routing is performed correctly. Note that in case of manual interface metric, the gateway metric assigned by Windows is equal to interface metric, thus doubling the result metric of the route.

  • I've noticed that in case of disconnecting then reconnecting the Android device, Windows temporarily prefers the route with higher metric. Don't know how to solve this issue, but it eventually sorts itself out, and things return back to normal. Or you can always pull out the LAN cable temporarily. – Alexandr Zarubkin Jun 14 '17 at 9:48

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.