Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am currently using a mobile internet connection, however I wish to mount a drive via a wifi connection. However, whenever I do so, the mobile internet connection appears to be neglected in favour of the wifi connection, which has no internet access. Therefore, I am unable to use the internet whilst using the wifi-based mounted drive and vice versa.

How can I "prioritise" the mobile internet network connection for internet access related tasks when both network types are in use?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

If I understand your question correctly, you have a local-only WiFi connection (or at least you want to use it for local connections only) and an internet-connected mobile broadband connection. Is that correct?

Background

Here's some background. Both your WiFi and mobile broadband connection are claiming the "default route" as in, the route to all the addresses I am not otherwise aware of, i.e. the Internet. As there's just one routing table and your applications aren't (and shouldn't be) aware of those two connections, the kernel just follows the routing table.

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.11.254  0.0.0.0         UG    0      0        0 eth0
192.168.11.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0

In the example above, the local network addresses are available directly on the interface and all other ones are routed via 192.168.11.254. This is the gateway and this address is usually announced by the DHCP server. It's telling the computer requesting for an IP address not just an available host address to use, but also the gateway, DNS servers, NTP time server, etc.

Now, what you would want, is to disable your DHCP client on your PC to ignore the announcement "this is the default gateway: 192.168.11.254", yet still listen to the rest to be able to keep the ability to talk in the local network. Below is how to do that.

Network Manager settings

Try disabling the default route to be assigned to your WiFi adapter when connected. Assuming you're running the default NetworkManager, you should be able to change the behaviour of how routes are assigned.

Below is how it looks like in KDE, but it should be similar in other Desktop Environments. It's important to find the two settings in the "Routes" section of the "IPv4 Address" tab in the settings window of the specific network.

  • Ignore automatically obtained routes (tick it)
  • Use only for resources on this connection (tick it)

Both on the bottom of this window:

enter image description here

You might also want to ignore the information about the DNS servers for the WiFi connection if you don't rely on it for local addresses. This can be done in the "Basic settings" section of the "IPv4 Address" tab by selecting the "Automatic (DHCP) addresses only".

share|improve this answer
    
Thanks, that fixed the problem. I appreciate the effort in giving such a detailed and helpful answer. –  Josh Jan 10 '13 at 18:30
    
@Josh Yeah, I believe most of the "how do I do this/that" related to networking is because of a missing background knowledge in it (unrelated to Ubuntu/Linux!). I will refer to this answer some times in the future, probably. And remember that this site is primarily designed to Q&A that is useful for a wide audience. General answers, applicable for more than one situation are preferred for that reason. –  gertvdijk Jan 10 '13 at 18:41
add comment

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.