Wired and wireless connections: make Windows prefer Ethernet when connecting to a specific other computer in the network?
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?
Solution 1:
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!
Solution 2:
It looks like you haven't configured wired interfaces. You need to assign an IP address to each connected interface. Take a look at how to assign a static IP address.
For example, use the IP address 192.168.13.1 and netmask 255.255.255.0 on your desktop and the IP address 192.168.13.2 with netmask 255.255.255.0 on the laptop.
After that you can reach the laptop's shares from the desktop using the address \\192.168.13.2 . On the desktop put that address in the Windows Explorer Address bar or in Run... window (Win+R).
Solution 3:
From what I can tell the wireless tromps the wired when it comes to connecting without control in the windows systems. This is based on the "metric" (priority) set for that network item.
If everything else is working correctally ,and you could normally connect to either of them , Disabling the wireless connection in Network stuff , will disable the wireless (duh). The working and correct wired connection will immediataly be used instead. (re-enabling wireless the system will start using wireless again) the inner workings of that are beyond me, it just does.
I can hop from wired to wireless in the push of a shortcut button in my windows XP system, by device disable methods. I use the tool "devcon" (device connect), put it in a script to shut the devices on and off at will, and at a whim for testing. (talk about secure, it is off)
Anybody want to learn it, I could show you, I use most simplistic methods (dolt) as possible so I can debug, alter, and control, so this shouldnt be That hard.
This is a XP script for One device, my Nic Card itself, which I had previously Identified by its cryptic junk that the system shows me when doing a Devcon "find".
Simple switch, check to see if it is running or not, toggle it, tell me what happend.
echo OFF
cls
C:\Desk\batch\DEVCON.exe >"%USERPROFILE%\Local Settings\Temp\Rescheck" status *811A1043*
FIND /I /C "RUNNING" "%USERPROFILE%\Local Settings\Temp\Rescheck"
IF %ERRORLEVEL% GTR 0 GOTO NOTRUN
start /B "beeps" C:\Desk\batch\wav.exe C:\WINDOWS\Media\AppSounds\netdetecto.wav
ECHO driver is probably running disable it
C:\Desk\batch\DEVCON.exe disable *811A1043*
exit
:NOTRUN
echo driver is probably not running enable it
start /B "beeps" C:\Desk\batch\wav.exe C:\WINDOWS\Media\AppSounds\netdetectc.wav
C:\Desk\batch\DEVCON.exe enable *811A1043*
exit
That wasnt so bad was it :-) of course it could be done in 1/3rd that, but it has to keep me informed.
Break it down
run the command Devcon.exe. > send the output to some temp wherever. do a status . * Wildcard * some aspect of the device ID simply partial ID of device.
Check the simple text file FIND. look for the text running /I /C "RUNNING". in the temp
If the above fails because running is not found IF %ERRORLEVEL% GTR 0. Then go to the tag GOTO NOTRUN
If it goes to that tag :NOTRUN then enable the device DEVCON.exe ENABLE wildcarded Device numbers
Go to the Device manager in your system to see hardware names, and even IDs on some systems.
The simplest way to see device ID things from devcons perspective, is to do a devcon.exe /find and to simply start applying your wildcards * now to reduce the list.
To make things easy, dont even bother with Full ID or hwid , it will only cause frustration, use the wildcards, just get enough ID so it is different, test that manually using /find, test using /enable ,with the wildcards.
Devcon DL http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q311272 (now in both 32bit and 64 bit 78K zip file)