Macos – How to tell which network interface the computer is using

airportethernetmacosnetworkingwireless-networking

On a MBP (OS X 10.6.2) I've got the wired ethernet and wireless airport configurations set up to use the same static IP to my router (e.g. as described at http://forums.macrumors.com/archive/index.php/t-708685.html). I've also got the Service Order set up so that the wired connection is above Airport (e.g. as described at Mac OS X automatically turn off Airport if ethernet cable is plugged in).

This seems to "work": an open ssh connection to a remote location stays up as I plug in and unplug the ethernet cable. However, since the Airport card stays live (and connected to the router) regardless of whether the wired connection is present, how can I tell that the wired interface is actually the "active" connection when it is available? Since the IP address is the same for both, is this a guarantee that the wireless interface cannot be used? Is there some other way to tell if this interface is in use?

PS. I'm going to post a (partial) answer as soon as I post this, as the act of writing this up and checking all my facts lead me to some insights. (The more interesting and unanswered part is in bold above.)

Best Answer

The definitive reference for questions such as 'Which interface will be used to reach host w.x.y.z?' for any given time or situation is to refer to the routing table.

[mini-nevie:~] nevinwilliams% route get 10.10.10.10
   route to: 10.10.10.10
destination: default
       mask: default
    gateway: 192.168.2.1
  interface: en0
      flags: <UP,GATEWAY,DONE,STATIC,PRCLONING>
 recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
       0         0         0         0         0         0      1500         0 

I've both en0 and en1 enabled, and en0 is first in Service Order. Unplugging my ethernet, making no other changes, the same command gives:

mini-nevie:~] nevinwilliams% route get 10.10.10.10
   route to: 10.10.10.10
destination: default
       mask: default
    gateway: 192.168.2.1
  interface: en1
      flags: <UP,GATEWAY,DONE,STATIC,PRCLONING>
 recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
       0         0         0         0         0         0      1500         0 
Related Question