Macos – How to use two network adapters on OSX, one for LAN traffic and one for Internet traffic

macosnetworkingrouting

I have two networks available in my location, and am using a MacBook Pro running OS X Lion.

  • BLUE NETWORK –
    DHCP assigns me 10.x.x.x address, and is for internal traffic only. It has no connection to the Internet, and is available either on Ethernet or Wifi.

  • RED NETWORK –
    DHCP assigns me a 192.168.x.x address, and is a direct connection to the Internet. It has no connection to any internal resources, and is available either on Ethernet or Wifi.

By default, it seems that OS X favours the connection with the greater bandwidth almost exclusively. That's to say, if I'm connected via Ethernet on the RED network, and by Wifi on the BLUE network, I can access the outside world just fine, but RDP connections to internal servers fail and I can't connect to internal fileshares.

Conversely, if I'm connected via Ethernet on the BLUE network, and by Wifi on the RED network, FTP to external servers doesn't work (or Skype etc.) but internal fileshares can be accessed just fine.

Really, I only need 10.0.0.0/8 addresses to be routed on the BLUE network, and everything else on the RED. And for named servers, some rules like *.int.foo.com resolved on the BLUE network but everything else on the RED.

Is this something that can be achieved?

Best Answer

Mac OS X gives the default route to the highest-ranked, active interface. It doesn't have anything to do with bandwidth. To change interface rankings, go to System Preferences > Network, click the cog drop-down menu under the list of devices and select Set Service Order. Then drag to rearrange your interface rankings. It sounds like you want RED ranked above BLUE.

If BLUE is a multi-hop network (i.e. not just the local subnet), then things may get tricky. You can also add specific routes using the route command. This would allow you to route 10.0.0.0/8 addresses over "BLUE".

Related Question