Apple - how to make different apps use wifi vs ethernet?

I'd like to route some apps through WiFi and other apps through ethernet.

Unfortunately, this is not the way it (networking) works. You can't say that you want Safari to go through one network port and iTunes to come through another. The problem with this lies in the fact the applications themselves don't make the network connection - it makes a call to the networking (Berkeley sockets) API that makes the connection and binds the process to the socket itself.

In the simplest terms, the flow looks like this

enter image description here

When your local process (the application in question) wants to make a connection, it requests that a socket be created. Part of that request includes the IP address, the connection is then made, and the app is bound to it. The app then sends and receives data through that socket.

The key to remember here is that the application asks for a socket based on the network address. Other than (assuming you're on a network with a single segment), you have only two routes:

  • your local network
  • everything else (i.e. Internet)

If you have two interfaces connected to this single network, your routes will overlap and the interface with priority will be the primary.

Whatever your application running, it's going to say, "I want to go to foo.bar.com" which will translate to an IP address and a socket will be created over the route that gets you there. The point is, your app has no control over the matter.

However, let's say you're connected to two different networks:

  • Ethernet (en0) -> 1.2.3.0
  • WiFi (en1) -> 5.6.7.0

If there is a file server with an IP of 1.2.3.4, all traffic bound for that address will go through the Ethernet. If your WiFi is configured for Internet access, all calls to 1.2.3.0 and every other address will go through en1. Again, your app has no say in the matter and the socket will be made based on destination.

Can an application use a specific network interfcace?

Yes, of course it can, but this is something done at the source level of the application because it's the one making the call to the API. If you code it to use a specific interface, it will do so (it's not practical in any sense, but you have the ability).

Bottom line: For an external application to re-route traffic based on the application you use, it would have to insert itself between the application and the protocol stack of the OS and that is just not going to happen.