13

How do I make Ubuntu choose wifi connection over wired connection when both are connected to internet? I edited the Ethernet connection to route using the preference "Use this connection only for resources on this network", which other people have reported having success with as a means of getting WiFi preferred, but it doesn't work for me. The issue persists. Ethernet is still being preferred for internet, and WiFi gets ignored.

another thing, is it possible to use wired connection as fail over connection to wireless?

1
  • It is preferred if you can post separate questions instead of combining your questions into one. That way, it helps the people answering your question and also others hunting for atleast one of your questions. Thanks!
    – guntbert
    Commented Apr 29, 2014 at 21:07

1 Answer 1

5

You can change metric. route add default dev eth0 metric 20 When you change metric you default route to wless0 will have less metric and traffic will go via wless0. When wless0 is down you default route to wless0 will be deleted from routing table and traffic will go via eth0. After when you wless0 is again up, default metric will be less then 20 on eth0 and traffic will again go to wless0.

Also you can edit /etc/network/interfaces and set metric permanent for interface.

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
network xxx.xxx.xxx.xxx
broadcast xxx.xxx.xxx.xxx
metric XXX

@gunjan parashar Elaborate:

Network service route packages on several parameters. First of that is that packet is for local net or not. For this decision network service use netwotk mask from nic setup. If packet is not fol local net, pc will sendit to default gateway.

If you have 2 interfaces in the same subnet / local network and the same gateway for both interfaces, pc must use some "parameters" for routing decision. Parameter for routing is metric. Practically less metric is better route and pc will send packet to gateway based on that. In case that you have same metric and same gw and both interfaces on local net, traffic to gw will not working because pc can not make routing decision.

When you change metric, practically you say pc "Link over eth0 is worse. Use wlan0" But when is wlan0 down, any connection is better then no connection and pc will be use "worse" connection. When you wlan is again up automatically will be with better because default metric parameter is less then metric parameter configured manually on eth0.

3
  • can you please elaborate bcoz I m not much familiar with networking Commented Apr 26, 2014 at 1:00
  • or give an example setting with default values Commented Apr 26, 2014 at 1:00
  • You have small elaborate.
    – 2707974
    Commented Apr 28, 2014 at 7:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .