Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
You should take a look at How can I restrict Mac sharing services to a specific network/adapter? (which this is probably a dupe of). – Dori Feb 5 '11 at 4:07
@Dori I think that's a different question -- that question was about restricting incoming connections, this is about routing outgoing connections. – Gordon Davisson Feb 5 '11 at 5:03
@Gordon - If I thought it was an exact dupe, I would have just merged them. – Dori Feb 5 '11 at 6:22
up vote 5 down vote accepted

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

share|improve this answer
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.

share|improve this answer

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.

share|improve this answer
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

share|improve this answer

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, 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.

share|improve this answer

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.