I have a desktop connected to the internet and to my home network through Wi-Fi, and a laptop connected to said desktop through an Ethernet cable. But Windows seems to only reach the laptop through Wi-Fi: I want to transfer files through the wired connection instead.
Setting up Internet Connection Sharing and disconnecting the laptop from Wi-Fi altogether doesn't seem like the most elegant solution to me. I also thought about going to the hosts file and setting up the IP address manually, but that would make the laptop completely unavailable if it's not wired, which happens quite often unfortunately.
Is there any way for me to tell Windows to use the wired connection for a particular host if possible, and fallback to any other route it finds otherwise?
Answer
I believe I found a solution. I was thinking, and what I want is to basically subvert Windows' hostname lookup, since it is righfully looking up computers on the wireless network first (it has the lower metric after all, since it has an internet connection). Then I remembered there's a file exactly for that: the lmhosts
file.
Adding a map from the notebook's hostname to it's wired IP works exactly as I want: Windows first tries to reach it through Ethernet, but falls back to NetBIOS/DNS lookup if it's not accessible, and then finds the wireless IP. I thought hostname caching might be a problem, but apparently the lmhosts
file is looked up even before the cache.
TL;DR: Adding the wired IP of the notebook to the lmhosts.sam
(at %windir%\system32\drivers\etc
) file works flawlessly. Thanks for all the helpful answers!
No comments:
Post a Comment