I have a Linux box (Debian 9) with 2 NICs (Ethernet & Wifi) and they both connect to different networks. Is it possible to configure the browser to use the Wifi NIC and all the rest of apps to use the Ethernet NIC (or choose which traffic should go through which NIC) ?

  • You can either play with ip routes or use a proxy for the browser... However not defining traffic per app per se. – Rui F Ribeiro Mar 24 '19 at 3:54
  • Simplest way to do that is to create a network namespace (google), and put both the Wifi NIC and the browser in that namespace. Trying to "configure" those things in the application itself is usually painful, even if you can configure it in the application (unlikely for your browser, whatever concrete browser it is). – dirkt Mar 24 '19 at 10:20

Based on @dirkt comment, it can be done using namespaces.

If you are not using physical NICs, that can be done with ip nets:

1- Create a new network namespace : ip netns add net1

2- Move your NIC to that new namespace : ip link set NIC netns wifi // replace NIC

3- Start the app inside that new namespace and it will use only the NIC moved inside that namespace : ip netns exec net1 CMD args ...

If your NIC is a physical card then a more elaborated process should be used, the following link provides more details: Move physical NIC to a different namespace

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.