To allocate data usage efficiently with two internet connections

Assume you have two connections in Mobile Broadband and WiFi.

I would like to allocate manually given packages to given connections. For instance, my bank connection to Mobile Broadband and my internet surfing and software downloads to WiFi.

  1. How does Ubuntu 11.10 or 11.04 allocate the usage of two connections to Google Chrome?

  2. How can you manually decide which internet connection to use with Wget? Do you need any external command to do the allocation? - In my opinion, it would be much more orthogonal and efficient if you could have an external program to do the allocation. - I could then simply launch my Google Chrome to the wanted connection manually.


Solution 1:

This is a question of packet routing, e.g. deciding which packets (addressed to which IP addresses) go out which interface. To answer question 1, both connections' packets are routed to the same interface. Use the route command to show your current routing setup. Use the ifconfig -a command to see your interfaces and the IP addresses assigned to them.

There are two ways to force wget to use a particular internet connection: use the --bind-address=ADDRESS option to wget (See man wget for details); OR add a route to an IP address/netmask pointing to the interface packets for that address (those addresses) should use. Using route affects all packets to that IP. See man route. You want something like:

sudo route add -host <*bank's IP*> dev <*MobileBroadband's interface*>

You have to do this once per reboot, or once every time your Mobile Broadband comes up.