I'm connecting from my Windows 10 machine to a Windows Server 2012 R2 machine in the same subnet. I also have an OpenVPN connection that goes to the office and the server also has its own connection.
When I'm accessing files on the server sometimes the connection goes through the VPN without me noticing. Of course this is not what I want since I have a gigabit connection to it in the local network and a lot slower through the VPN.
The strange thing about this is that I have set the server name in the hosts file to point to the local IP. And even stranger: even if I write
\\192.168.23.45\share to Explorer address line the connection will actually go through the VPN!
The only way I can get it to work properly is to disable the VPN, access files and then maybe enable VPN.
Is there some way to tell Windows that it should never attempt to use the VPN address for that server and always use the local network address?
The metrics for both routes are 276, this might make for it not to favor the local route but won't explain why it doesn't use the IP address I tell it to use. I have also tried to set the metric in OpenVPN configuration to lower or higher but this doesn't change anything.
Local network is 192.168.23.0/24 and VPN network is 10.12.34.0/24 so they are completely separate. No IPv6 on the VPN, local network has the local IPv6 addresses.
I can also stop OpenVPN while transfering files or doing whatever with the file shares. The Windows 10 machine will just wait a moment, then switch to the non-VPN connection and continue. And if I restart it the transfers will switch to the VPN connection.
The server has also now been upgraded to 2016 but that hasn't changed anything. The problem is somehow in the Windows 10 machine. This also doesn't happen at all from another Windows 10 machine in the same subnet, same domain with the same OpenVPN configuration.