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.

Is it possible to route the traffic used by a process over a specific interface?

For example, network traffic by download application should always use the interface wlan0 where as all other applications on the machine should use eth0.

Is it possible to have this kind of rule in Linux?

share|improve this question
add comment

3 Answers 3

It can be done using Linux Network Namespaces.

Here is an article that explains how. Basically you create a network namespace with a different default route and run the processes that need it there. You connect the newly created network namespace to the physical adapter with a bridge (but other solutions are possible of course).

share|improve this answer
add comment

A few people have written shims that use the LD_PRELOAD feature of Linux to achieve this:

share|improve this answer
add comment

Not per application, no. You can do it per port or per ip-address etc, or an application itself can bind to (and use) a specific network card.

You can't set up a rule to do it though.

share|improve this answer
I've a java application, is it possible to bind that app to an interface? –  Suresh Apr 17 '11 at 13:36
A Java application you have the source code for and can re-program the internals? –  Majenko Apr 17 '11 at 13:48
I've a java application source code that uses apache http library. –  Suresh Apr 17 '11 at 13:52
Then I would head over to stackoverflow.com and ask the programmers there how to change your program. I have never programmed in Java. –  Majenko Apr 17 '11 at 14:04
add comment

Your Answer


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.