We help IT Professionals succeed at work.

Direct traffic to multiple WiFi Adapters (Linux)

Jax Logan
Jax Logan asked
Medium Priority
Last Modified: 2012-05-12

I have a laptop with linux on it and two WiFi adapters. Both are connected to the WiFi network and get separate IP addresses. How I can stream a movie or download a file from a server using one adapter versus another?

So, as an example I'd like to set up adapter 1 to stream a movie from youtube and adapter 2 to download a file from a backup site.


Watch Question

Selection of the adapter is done by the linux routing.
To see current routing table use
# ip route

Look for the default route "default via ...."
That will be interface used for all connectivity if there is no more specific route.

All you need to do is add a specific static route through the adapter that is not use for the default route to your server, then linux will use it for the server connection and the other one for all the rest of the traffic.

ip route add  X.serv.ip.X   dev    ADAPT2

I hope you also have 2 x AP's that you connect to, remember Wifi is a half-duplex shared medium, on ly one card at a time can talk to the same AP.
You should have a look at linux advanced routing - with this you can do stuff like use a different default gateway for connections to a specific port or similar.
For #1, if you're streaming a movie from youtube via web browser, then your browser will simply take the system default gateway, and access Youtube that way.  If you change your system default gateway, it will change it for all your graphical applications.   You can however add a static route to your routing table to force the use of a given gateway for certain sites (the example below is Youtube):

  route add -net gw [gateway IP address of your preferred wireless controller]

For #2, if you use the 'curl' utility to do your download, you can actually specify an interface to use so something like:

  curl --interface wlan1 http://somesite.com/myfile

Explore More ContentExplore courses, solutions, and other research materials related to this topic.