At work we have a firewall that prevents certain outbound connections. But I also have a Clear wireless personal hotspot. I would like to use the work connection for normal requests but for certain requests such as my Mysql app, I would like to use my personal wireless. Is there a way to do that without having to switch back and forth. So all mysql connections just know to use one network interface while other requests use the default.


I've asked the same question a long time ago on superuser.com


  • Adjusting the routing tables doesn't work by application, it works by remote IP address. So you have to know all the IP addresses that App 'A' needs (not always easy, esp. with different DNS on each interface), set up manual routes to those IPs, and then hope that App 'B' doesn't need any of those IPs also. – Ctrl-Alt-Del Fatigue Jun 29 '11 at 21:26

I suggest you look in to routing with iptables. I can't remember how off the top of my head, but it would definitely be possible to just catch packets going to a certain host/port and push them off through another interface.


To separate traffic by app (and not by destination) would require an OSX version of something like ForceBindIP (for Windows only). No matter how you change the routing tables or ipfw, if you have 2 apps that are trying to reach google.com, they will use the same interface, same route.

You might be able to approximate the same kind of behaviour by running each app in a chroot jail that can see only a limited set of devices, and restrict it to a single interface. But that would take a whole lotta configuation for each app.


I'm pretty sure there's a way to do this using IPTables, but I'm not an expert at that so I can't really give you detailed information. However, that may point you in the right direction.

Essentially you would set a route for all outgoing connections on the port you connect to with mysql to use that wireless connection.

  • Not iptables, ipfw. Iptables is for linux. Same idea though everything packet related can be done. – chiggsy Apr 19 '11 at 19:31

This is most definitely possible, but like the other people here, I don't know how to do it. Just that it certainly can be done.

Try asking in https://unix.stackexchange.com/.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .