How can I use two network adapters on OSX, one for LAN traffic and one for Internet traffic?

6

3

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?

Rob Wright

Posted 2011-08-12T15:27:42.110

Reputation: 63

We need to wiki these questions. . . – surfasb – 2011-08-12T19:05:18.777

Answers

7

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

Jonathan Cremin

Posted 2011-08-12T15:27:42.110

Reputation: 219

This is your safest bet. I would also recommend statically addressing one or the other, and only having ONE link be using DHCP (preferably your outbound internet link). – peelman – 2011-08-12T17:05:37.163

Thanks very much for the help - this looks like it'll be just what I'm looking for. – Rob Wright – 2011-08-16T10:03:33.540

2

You can confirm the routing by looking at the routing table (if you know how to interpret that):

netstat -nr -f inet

or specifically querying the routing table:

route get 204.XXX.YYY.ZZZ

for some destination, 204.XXX.YYY.ZZZ.

Brainiacboy

Posted 2011-08-12T15:27:42.110

Reputation: 21