MacOS – Under Mac OS X, can I choose to use the Wireless connection for some specific traffic and the Wired connection for the rest



I am currently using Mac OS X Mavericks in a professional network where there is a difference in access between the Ethernet and WiFi networks. Specific to my case, when using the WiFi connection I can use SSH for my GitHub needs, but for internal git repositories I need to use the Ethernet connection to be able to access them.


Is it possible to configure my machine such that any (SSH) traffic to GitHub uses the WiFi connection, but all other traffic uses the Ethernet connection?

The system administrators are unwilling to unblock outbound SSH traffic on the Ethernet network, citing the availability of the unrestricted WiFi connection as one of their motivations. This works fine and it's possible to switch off the WiFi when I'm not using it, or unplug the Ethernet when I don't need internal resources, but this can get fairly tedious.


Halfway through implementing the offered solution I've found a different solution for my issue, apparently it's possible to use SSH over the HTTPS port and this works within my situation. I'll leave the question here for any others.

Best Answer


First as a side note, you can probably write an applescript to switch WIFI on/off. Since you can code and use terminal, just execute the script before/after. Just make sure WIFI is above Ethernet in System Preferences -> Network, so the system will use WIFI when both are available.

Besides that, you can use WIFI interface like a proxy. In this case, make sure Ethernet is ranked higher, so all traffic goes through Ethernet by default. An app/shell with configurable proxy setting can direct its traffic /-only to the internal IP address/LAN address of WIFI.

Drawback is that your shell may not support proxy and requires a new program.

I know this works because I have a similar setup with WIFI and VPN. Most of my traffic goes through WIFI, while a special/separate Firefox is pointed at VPN. This way I can access university's library at will, without compromising privacy or ease of use.

Related Question