How does OS X work when connected to multiple internet connections?

Posted on

QUESTION :

Macbook Pro is connected to internet connection E via thunderbolt/ethernet and to internet connection W via WLAN.

What defines which connection is primarily used and what happens if one or the other fails (the network fails)?

Is it possible to control the failover procedure?

I’m running some mission critical things on the machine and ideally would primarily use the connection E and failover to W.

ANSWER :

The primary interface is controlled by the network service order. If you look in System Preferences -> Network pane, the sidebar will show the current order — whichever is on top will be used for internet connectivity (with a couple of exceptions I’ll get to). You can adjust the order by clicking the Action (gear icon) menu under the service list, choosing Set Service Order, and then dragging the services into the order you prefer. But note that the services will always be reordered based on their current state — services with live connections (green status indicator in the Network preferences) are always prioritized above those in other states, so the order you set only matters if more than one are connected at the same time.

So, in your case, just set the service order to put E above W, and you’re set, right?

Not so fast, let’s talk about what it takes for a service to be considered connected. In general, OS X considers a service good if it sees a physical-layer connection (e.g. there’s a live ethernet connection on the other end of the cable) and has reasonable-looking network settings. Oh, the router’s dead but the network switch you’re plugged into it still alive? That’s still a good connection, and it won’t fail over. If you want a more sensitive failover, you’ll have to do something like build it yourself (ick).

Ok, I promised a couple of exceptions. The first is that it’ll sometimes detect a router failure and partly fail over. I haven’t seen this document, but it appears that if OS X can’t resolve the router with ARP, it won’t actually reorder the services, but will silently start routing through the next service down the list. You need reliable failover? Don’t count on this to provide it.

The other exception is that recent versions of OS X do source-based-routing, which means that if your computer receives an incoming connection over something other than its primary interface, it’ll reply over that same interface rather than the primary. Depending on exactly what you’re doing, this might or might not help. If it’s mission-critical… I wouldn’t count on this either.

Leave a Reply

Your email address will not be published. Required fields are marked *