Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

A similar question was asked for windows Automatically prefer Ethernet over WLAN but I'm on linux and am using NetworkManager.

Right now if the ethernet cable is plugged in and is available while wifi connections are also available NetworkManager chooses the wifi connection. How can I tell it to always choose the wired connection if available?

I'm on Fedora 17 using NetworkManager-0.9.4.0-9.git20120521

share|improve this question
    
I'm in Fedora 20, and have the same problem. Toggling WiFi off seems to be a workaround. At least this can be done from the top panel (drop-down user menu). –  Brady Trainor Mar 2 at 21:17

1 Answer 1

Just a couple things:

You could try these commands in your environment to see if they work and bring desired results:

  • auto Ethernet
  • auto ethX (Replace X with whatever number your kernel assigns (run ifconfig to check))

Alternatively, you can have a look at your IP routes found by issuing:

sudo route -n

By looking at the output, see if wlan0 is on all routes.

Several other questions have been asked with this and the only way to get Linux to favour an interface (by default it is eth0 but in your case, something went awry) is to manipulate the metrics.

You can configure the metric for an interface using ifmetric which manipulates the metric on an interface you specify. I haven't tested this on Fedora per se, but I can see it is in the repositories. So, issue:

yum install ifmetric

Then when it is installed, you will want to go to:

/etc/network/interfaces

Use vi, nano, emacs, whatever editor you use and then add underneath whichever interface you want to configure (in this case eth0):

up ifmetric eth0 X

X relates to a number determining the priority, 0 by default is the highest priority, but to avoid hitting static/default routes, use something above 2. Then you will want to add a higher number to wlan0. So:

up ifmetric eth0 10

and under wlan0:

up ifmetric wlan0 20

Your file should be looking like this:

 iface eth0 inet dhcp
    up ifmetric eth0 10

iface wlan0 inet dhcp
    up ifmetric wlan0 20

Let us know if it helps!

EDIT: Just come across a few links:

How do I configure a linux machine to ignore wifi when connected via LAN?

How do I set the priority of network connections in Ubuntu?

EDIT 2:

There is also a metric field in Network Manager GUI!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.