So recently I had a situation where I had my Ethernet and Wifi connected to 2 different networks in my MAC OS X, and I had a very specific use case for this
I needed to use the Ethernet connection to access 1 specific host (an internal web service), the connection through the ethernet cable allowed this but did not allow internet access, the Wifi connection allowed internet access but will not allow access to the internal web service, so basically what I needed was :
- Have both connections active
- Access the internal web service through the Ethernet connection
- Access all the other hosts through the Wi-fi connection
Just connecting both interfaces does not work I was either getting access to the internet or either access to the internal WebService; if you check this article over at apple OS X network interfaces priority you can see that you can change the priority used by the system to route the requests; so if you change the priority of the Wi-fi to be on top you get internet access but not access to the internal network, and vice-versa
Sure you can make it work this way but it's really painful to have to manually change the interfaces priority to accommodate what you are trying to do at that moment
The solution that I found is to add a static route to that host; this can be easily done in a few steps (you will need for this the IP of the internal host you are trying to access)
- Give your Wi-fi interface the highest priority (put it on top), for this you can refer to the apple link cited above
- Identify the interface names, for that execute the following command on the terminal netstat -nr (in my case en0 is the ethernet interface whereas the Wi-fi is the en1)
sudo route add -host 10.120.136.57 10.247.131.1
And that should be it, please note that restarting the PC will probably remove the static route from the routing table so you will have to re-add it