Multihoming

Default Routes

The concept of default routes always seems to stir up discussion and confusion, so I will try here to lay the groundwork for understanding what this concept means in the context of Mac OS X and Darwin.

First, since it is a "default", it makes some sense that there is only one of them (whatever it is). There are some systems that feature multiple default routes, but these are typically either routers, supporting complex route maintenance protocols, or systems that use more than one default route in a sort of round-robin scheme (called multipath routing) to balance traffic through multiple routers. Mac OS X/Darwin does not support more than one active default route.

While each device can have an associated default route, only the first active device's route is used. Thus, if the order is "en0, en1", then as long as en0 is active, its "default route" will be the system's default route. If en0 were to go inactive (e.g, you tripped over the cat-5 cable plugged into the device), then the system would remove the current default route and install the one associated with en1 as the new default.

You can control the ordering of devices by dragging: click and hold one, and move the mouse cursor to put the selected device in the desired position. For example, moving 'en1' to the top of the list will cause the system, if the configuration is applied, to remove the current default route (associated with "en0"), and install that associated with "en1" as the new system default route.

As individual network devices are configured, either manually, using the Network Preferences panel, or automatically, with the aid of protocols like BOOTP or DHCP, a default route may be defined for this device. Just because you have multiple active devices defined, each with a default route, does not mean all of these default routes are active. In fact, there is only one, and it is chosen based on the ordering of the network devices for the particular "location" that is in force (the route chosen is from the first active device with a specified default route).

A default route can be installed by hand using the route command:

    route add default {gateway IP address}

This assumes that the gateway address is directly reachable from your system. You can also remove this route by hand:

    route delete default