Force windows to use a faster network connection

I have 2 machines - 1 is my windows PC, the other is my NAS, running linux.

They’re both connected to the internet via my router with a 1G ethernet link. But they’re DIRECTLY connected via 2.5G ethernet link.

How can I force windows to use the 2.5G link preferentially?

Currently when I copy files the speed is limited to 1G. If I disconnect the 1G link, I get the full 2.5G speed. The moment I reconnect, I’m back down to 1G.

It used to work before (I don’t know how), but my windows install got botched and I had to reinstall windows. Now I can’t get it to work.

Things I’ve tried that don’t work:

  1. Restarting everything (I think that’s what fixed it before).
  2. Removing and re-adding the shared drives.
  3. Setting a custom metric for both connections (800 for the slow connection and 5 for the fast one).
  4. Manually adding a route

If I disable the 1G, I can get faster speed for about 5 min, then it reverts back to 1G.

Metric, or interfacemetric is what you want to change, lowering the metric on the 2.5 gig links, for both sides. That or routting/default route

You can also change the priority (metric) of a network interface in the network adapter properties using the Network Connections applet (ncpa.cpl) in the Control Panel.

Open the properties of the IPv4 protocol in the adapter settings → Advanced → change the value in the Interface metric field and apply the changes.

By default, the Automatic metric option is enabled here, which indicates that the network adapter priority is set automatically according to the link speed.

From here. Change Network Connection (Adapter) Priorities in Windows | Windows OS Hub

2 Likes

I would like to direct your attention to point #3 above.
Thank you very much.

Further verified by:

> route print -4
===========================================================================
Interface List
  9...70 85 c2 ab 9a bd ......Realtek Gaming 2.5GbE Family Controller
  4...70 85 c2 ab 9a bf ......Intel(R) Ethernet Connection (7) I219-V
 12...0a 00 27 00 00 0c ......VirtualBox Host-Only Ethernet Adapter
  1...........................Software Loopback Interface 1
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.0.1      192.168.0.2    800
        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.0.0    255.255.255.0         On-link       192.168.0.2    656
      192.168.0.2  255.255.255.255         On-link       192.168.0.2    656
    192.168.0.255  255.255.255.255         On-link       192.168.0.2    656
     192.168.10.0    255.255.255.0         On-link      192.168.10.2    261
     192.168.10.2  255.255.255.255         On-link      192.168.10.2    261
   192.168.10.255  255.255.255.255         On-link      192.168.10.2    261
     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
        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.10.2    261
        224.0.0.0        240.0.0.0         On-link       192.168.0.2    656
  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.10.2    261
  255.255.255.255  255.255.255.255         On-link       192.168.0.2    656
===========================================================================
Persistent Routes:
  None

I apologise, but also, am glad you already thought of it

Your 2.5g link should have its own IP that is different from your main internet 1g link. Same on the NAS. When you mount the share it should be using the NAS 2.5g IP, not the 1g IP. That will make the connection go to the 2.5g link since that is the address the mount is for, and it isnt possible to go over the 1g link since the mount doesnt use that IP.

I suppose there could be some theoretical scenario where if you have both links set up in the same subnet, and the 2.5g link goes into sleep mode and disconnects, that the connection could try to go out the default gateway instead, making its way to the router, and the router may have a small chance of knowing that the NAS 1g IP has a route to the 2.5g IP. That is a lot of if, ands, and buts though and should never really happen. You could avoid this possible far out scenario by having your 2.5g IPs on both devices be a completely different network subnet than your main one, so a possible scenario like this wont go out the default gateway.

But there is no need to set metrics or any of that.
If your transfer speeds are around 1 gigabit over the 2.5g link then you are bottlenecked somewhere. Either a drive on the PC or NAS side, or anti virus scanning the connection, or just general Windows being stupid. Or you are doing lots of little files and have too much overhead on a TCP SMB connection.

I used interface metric for this and I also found Windows sometimes ignored the metric for no apparent reason.

In the end my solution was different internet ranges AND different hostnames for the 1Gbe and 10Gbe in the DHCP/DNS of the router with static leases per MAC defined even for those interfaces with static addresses.

So I have 192.168.2.xxx/24 and Hostname_1GB for the 1Gbe and 192.168.1.xxx/24 and Hostname for the 10Gbe .

After a couple hours of debugging I have correctly (I think) identified the root cause and 2 potential solutions, 1 on either side of the link.

Presumptions:

My primary method of testing (and usage) was copying files to and from the network shares. Aka using SMB.

To start eliminating causes I ran an iperf test:

iperf -s -B 192.168.10.5 (nas)
iperf -c 192.168.10.5 -P 2 -i 5 -t 20 (windows)
= [SUM] 0.00-5.00 sec 1.45 GBytes 2.48 Gbits/sec

This at least proves it’s not a NETWORK LINK issue. The network itself is fully capable of tossing around data at that speed.

That leaves us with 2 other potential causes:

  1. Routing
  2. SMB itself

Like I said in OP, I tested manually adding a route, which had no effect.

I am not a not a networking whiz, so this is a little out of my depth and I lack the knowledge to verify how the route is working. But assuming nothing broke means it was working, that eliminates routing as the culprit.

This leaves SMB itself. I went through dozens of commands, but I’ll only post what ultimately yielded results.

SMB has a feature called Multichannel. It’s on by default in the versions of samba and windows I have. While I can’t use it to aggregate my connections (apparently a server-only feature), apparently it functions as failover / high reliability. (Hence it using the other connection if I disable the 1st one.)

  1. Get-SmbMultichannelConnection
    =
Server Name   Selected Client IP   Server IP     Client Interface Index Server Interface Index Client RSS Capable Client RDMA Capable
-----------   -------- ---------   ---------     ---------------------- ---------------------- ------------------ -------------------
192.168.10.5  True     192.168.0.2 192.168.0.5   4                      3                      False              False

So even tho the share is mapped with the IP of the fast connection, SMB does its own path discovery and is choosing the wrong connection.

Why tho?

  1. Eventually we land on the following command providing the critical clue:
    Get-SmbMultichannelConnection -ServerName "192.168.10.5" | Format-List *
    =
SmbInstance                 : Default
ClientInterfaceFriendlyName : Realtek 2.5G
ClientInterfaceIndex        : 9
ClientIpAddress             : 192.168.10.2
ClientLinkSpeed             : 100000000
ClientRdmaCapable           : False
ClientRSSCapable            : False
CurrentChannels             : 0
Failed                      : False
FailureCount                : 0
MaxChannels                 : 1
Selected                    : True
ServerInterfaceIndex        : 2
ServerIpAddress             : 192.168.10.5
ServerLinkSpeed             : 100000000
ServerName                  : 192.168.10.5
ServerRdmaCapable           : False
ServerRSSCapable            : True
PSComputerName              :

If you count the 0’s you’ll notice that’s actually 100M. So technically SMB is doing the correct thing and choosing the higher bandwidth connection - only based on faulty data. But why is the data faulty?

Well, google’s dumb AI overview thing actually made itself useful for once. It worded the answer well, so here’s the relevant bit:

The underlying problem is that Windows relies on the remote server’s SMB implementation (such as Samba on TrueNAS/Unraid or Synology DSM) to negotiate and declare the interface specs.

The original source is https://linustechtips.com/topic/864034-problem-setting-up-samba-multichannel-connection-and-achieving-2gbit-trasnfers/

This gives us 2 possible solutions on either end:

1. Client side (windows)

Force SMB to use the faster link manually, regardless of what it thinks by using a constraint:

New-SmbMultichannelConstraint -ServerName "192.168.10.5" -InterfaceIndex 9 -Force

2. Server side (linux/samba)

Have the server correctly advertise the link speed.

/etc/samba/smb.conf
↓
interfaces = "eno1;capability=RSS" , "enp4s0;speed=2500000000,capability=RSS"

3 Likes

Couldn’t you just use a separate subnet for the direct connection to the NAS & map all smb, nfs, iscsi on the subnet? I have 10gb & 40gb. 10gb for internet & 40gb for the NAS on a separate subnet. All drive mapping & share are on the 40gb subnet.

The NAS has shares on both subnets for the rest of the clients on 10gb.

Bookmarking this for future reference.

Did you try both solutions independently?

I did. Both worked as intended.

First I stumbled upon the workaround (the constraint), then I kept digging for the root cause (the falsely advertised link speed by the server).

You do have to remove/re-add the shares in between updating things and restart things like samba, but I assume that’s self evident to most.

Coincidentally, this marks the first time in my life, ever, all this AI bs has been truly useful to me.
(ChatGPT gave me the constraint thing and google gave me the root cause.)

They’re already on a separate subnet. Otherwise the network breaks.

I mean I didn’t explicitly mention the IPs, but the routing table I posted contains them.
192.168.0.x for 1G link
192.168.10.x for 2.5G link

I haven’t looked at the in between post, but you stated the 2.5 is a direct connection. There’s no need to route the traffic. Leave the 1gb network alone. Just manually assign the ips on the separate subnets to the NIC interface for your pc and the nas connection to be the same. Direct all shares to the direct subnet address. Done.

Example. To get to the NAS from your pc \\192.168.10.x; it will directly connect to the NAS as long as the shares are enabled on that subnet.

I remember that happening my first time as well. Seems like AI answers can be so generic or wrong quite often and just parrot something said by a random person in a forum post that may or may not be true. And then every once in a blue moon you get a highly specific and detailed answer that seems rather obscure and yet technical that turns out to be right. Maybe there is hope for AI in the future yet, just need to get it so that those perfect answers are a regular occurance.

yes that is what I was saying as well, and what martixy already did. The problem was that Microsoft SMB was enabling and using MultiChannel mode by default and doing a route discovery on its own, and finding the 1g connection as well and adding that in to its available connections despite not mounting the share with that IP.

Disable multi-channel on the NAS & it will route to the designated ip.

More specifically, because the server was faultily (or not at all) advertising the 2.5G speed as 100mbit, it was obviously picking the “faster” 1G link.

Also, I suppose that yes, disabling multi-channel can count as a 3rd solution.

Are both NIC’s on the workstation/NAS 2.5 or is one multi-link supported & 2.5 is not one of them? You can see the link status under Network Connections and check Status for the physical connection. You may also need to lookup the model of the multi-link card to see if it supports 2.5Gbps. Another possibility is a bad cable on the 2.5Gb connection.