How can I make Windows prefer my wired connection?

14

4

I am running Windows 7 RC, but have noticed this behavior on Windows Vista as well.

When I am in an area that has a wireless network and I plug in my wired network so I can get a better connection (faster, more reliable), Windows continues to use the wireless network for everything.

It is not a matter of if a connection starts on the wireless it stays there, and I just need to restart my apps. All connections, new and old, are started on the wireless if it is available, irregardless of the wired connection being active or not.

Right now I toggle my hardware wifi switch on my laptop, but I would prefer if I could tell Windows to prefer one connection over the other.

Mike Cooper

Posted 2009-08-21T16:41:09.217

Reputation: 2 036

Answers

9

Looks like Windows (XP, Vista, 7) are supposed to do this automatically. Windows uses the lowest 'metric' connection. You can manually alter these metrics if it isn't working correctly, but in most cases, wired should be preferred over wireless automatically. Check the source below for more how-to and explanation.

Source

th3dude

Posted 2009-08-21T16:41:09.217

Reputation: 9 189

My first thought in response to this was "Doesn't the metric only control routing and not what source address is used?" But I found a TechNet article that suggests the best route actually determines the connection endpoint to use in Vista and later: http://technet.microsoft.com/en-us/magazine/2007.09.cableguy.aspx Can someone actually confirm this behaviour?

– rakslice – 2011-11-04T01:30:40.570

1One thing the article doesn't specifically mention is how to check your metric values. Type route print at a cmd prompt. My wireless was 10 and my wired was 20 in XP. – Luke – 2012-11-28T21:57:52.860

4

th3dude's answer is great but he doesn't mention a key point in the link he provided.

From the link that th3dude posted: http://blogs.technet.com/b/clint_huffman/archive/2009/04/19/windows-prefers-wired-connections.aspx

You should know that Vista made a change to how we handle existing sockets – after plugging in, connections will not be switched over, you must re-establish the connection in order to make use of a wired connection. For example, if you’re downloading something from a website and realize that it would go faster by plugging in, you’d have to cancel and start over after plugging in. This is a change from XP and 2003. Here is a good reference:

The Cable Guy Strong and Weak Host Models http://technet.microsoft.com/en-us/magazine/2007.09.cableguy.aspx

Which means that when I am on wireless at work in a conference room and then drop the laptop back on the dock, I have to disconnect (software) from the wireless connection OR disable (hardware switch) the wireless adapter to get back on the wired network.

Hopefully that helps you understand that it is probably not the 'metricing' that is choosing the wireless adapter but rather that Windows no longer auto-switches as it did in XP.

I'm not sure why Microsoft thought this was preferred behavior. I would have preferred a pop-up asking me whether to enable the wired adapter instead at the risk of ongoing downloads and sessions. Windows 7 makes me answer all kinds of other popups.

Keith Hoffman

Posted 2009-08-21T16:41:09.217

Reputation: 141

Leave it to Microsoft to take something that works just fine and make it harder. – Chance – 2012-02-22T19:26:47.570

@Keith: your answer is slightly misleading, you do not strictly need to disable your wireless connection. new TCP connections will use the wired connection, existing TCP connections will continue to use the wireless connection if they were already using it. – dwurf – 2012-05-14T23:09:40.177

1

As explained here:

http://answers.microsoft.com/en-us/windows/forum/windows_7-networking/how-make-win-7-to-prefer-wired-over-wireless/97ae998b-5743-e011-9767-d8d385dcbb12?tab=question&status=AllReplies#tabs

a. Open the Network Connections folder (Start > Run > ncpa.cpl)

b. Right click the desired connection.

c. Click Properties and then click on Internet Protocol Version 4.

d. Click Properties and then click on Advanced.

e. Un-check "Automatic metric".

f. Enter a number between 1 and 9999 for the "Interface metric".

mydoghasworms

Posted 2009-08-21T16:41:09.217

Reputation: 682

0

I tried every answer I could find but what worked in the end is me stumbling across right-clicking my wireless connection in the list of all available wireless connections (left-click up arrow near clock, then left-click on your connection, then right-click on the wireless connection you want to have available, but not be the default connect-to choice, and then clicking "Properties"). Under the "Connections" tab, uncheck "Connect automatically when this network is in range." This was even still necessary after changing the Metrics!

Jake

Posted 2009-08-21T16:41:09.217

Reputation: 1

Nice, but I doubt this will disconnect wireless and connect wired when plugged in? – Arjan – 2013-08-26T08:32:52.260

Yes; I doubt that too. – Jake – 2013-08-26T22:43:44.197

1I think the information I provided will still help people though. – Jake – 2013-08-26T23:08:44.033

0

I know this question is rather old, but I found a solution that may work. Apparently, you can control this via scheduled tasks.

It involves using events generated by the LAN adapter when wired connection availability changes.

I haven't personally tested it yet, but I will after lunch and post back.

Edit: It was pointed out that I should include a more detailed answer. So with that in mind. You can open the event viewer in Windows 7 via Control Panel >> Administrative Tools >> Event Viewer. In Event Viewer, click Windows Logs >> System. With this open, unplug the ethernet cable and plug it back in. Press F5 to refresh the event listing. Click on the new events to see a description of them. There should be one referring to a network link being disconnected, and one referring to that link being re-established. Note the source and the event ID.

Now, open the task manager (Control panel >> Administrative Tools >> Event Viewer), and create a basic task. Name it something like "Switch to LAN" and click Next. Under Trigger, select when a specific event is logged. Click Next. Select the System log, and enter the event source and ID for the "Network being re-established" event. Click Next, and then select Start a Program. In the Program/Script section, type "C:\Windows\System32\netsh.exe". Then, in the Add arguments section, type 'interface set interface "Insert Wireless Network Name Here" disable' (make sure you include the quotes around the name of your wireless network). Click next and finish. Now when you plug an ethernet cable into your laptop, it will automatically disable the wireless network and switch to your LAN.

Now go and do the opposite in order to re-enable wifi when the cable is unplugged (type "enable" at the end of the script arguments). It should be noted, that this works on my Thinkpad W540 when the ethernet cable is plugged/unplugged. However, only the "Switch to LAN" functionality works with the dock.

Source

detroitwilly

Posted 2009-08-21T16:41:09.217

Reputation: 111

Just tested the task-scheduler solution on my ThinkPad W540. It works like a charm. When I remove my laptop from the dock, it switches to the wireless network. When I put it back on the dock, it switches to the LAN.

The only problem I have with it is that a command prompt briefly pops up when the task is running, but it is a small price to pay for the functionality. – detroitwilly – 2014-11-19T20:04:48.150

Apparently, the switching-back-to-WAN functionality doesn't work great with the dock, only when a cable is physically unplugged, will post back if I get it working. – detroitwilly – 2014-11-19T21:20:47.973

While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Canadian Luke – 2014-11-19T21:57:17.053

Good point. I will edit the answer. – detroitwilly – 2014-11-20T04:32:16.157