Ask AFP548 January 25, 2005 at 3:20 am

Command to return currently used network interface?

Ed. Note: There are a number of ways of doing this, so I'm curious as to what people are using in their scripts?does anyone no of a terminal command that will reveal which network interface (built-in ethernet, AirPort, etc.) is currently in use? it can return en0 or en1. i'm not looking for whether the port is active, but the one that is currently being used.

thank you,


No Comments

  • Depends on what you define as the network interface that is currently being
    used. If you’re talking about “what interface does my outbound traffic use to
    get out onto the network,” you can check the default route:

    $ netstat -rn | awk '/default/ {print $7}'

    If it’s a matter of determining which interface traffic is entering the machine,
    you’re going to have a harder time. You could use lsof to
    find out which IP upon which the connection is established, but you’d have to
    pass that along to ifconfig to find out the actual interface.

    • Oops! That command should be:

      netstat -rn | awk '/default/ {print $6}'

  • which network interface (built-in ethernet, AirPort, etc.) is currently
    in use?

    This is a non-sensical question. ALL active network
    interfaces are in use. Look at the routing table when you have multiple active
    connections (such as when you are using Internet connection sharing) and see
    that routes for different subnets lead out of different ports. Depending on the
    destination, the packet may head out of any of the active ports.

    You need to re-think what you mean when you ask the question.


  • samiam872

    What file can I edit, to allow Bonjour / Rendevouse see another subnet?

    • Either you enable multicast routing on the network, or you can setup a wide
      area bonjour server like this.

      We’ve been meaning to do an article, but there are some bugs in the process
      that stop it from being really useful.

      Breaking my server to save yours.

      Josh Wisenbaker

  • samiam872

    problem, how can we back up three locations with a terabite each over the wire to a co-location using bit level backup to limit bandwidth?

  • evan goldstein

    Instead of using a Font management tool such as Font Agent Pro or
    Suitcse, I would like to place as many fonts as possible into the users/
    library/fonts folder. But we have thousands of fonts and if I load them all
    there is a performance hit when opening apps and in general. Does
    anyone know what the practical limit of the amount of fonts to put into
    that folder before effecting performance? Is there a formula that can be
    tied to the number of apps open or RAM?


  • muloman

    I need help.Seriously. I have almost 300 mac clients and i have configured
    to join AD domain, which is running 2003 Server. I am getting lockout
    issues. I am able to successfully join domain, but the moment i try to login
    to a mobile account that i have defined to automatically create, it
    automatically locks the account. I have to manually unlock it at the server’s

    Also when i am running screen saver, with password security, and i am
    prompted with a password, i get locked out. This happens when i leave the
    screensaver on for about 30 mins. If i do an immediate test on screensaver,
    i am able to log in without any problems.

    Also i have set to lockout at 3 failed attempts but i get lockout on 1 failed
    attempt. Please help me

  • tonypowell

    I am currently integrating an OD and OD setup. What is the maximum number of users that can be in a group on OS X server 10.4.8? The group on the AD server currently has 28,000 users and we are having problems with it.

  • rinaufr

    I have a problem on the mail server (OSX 10.4.9). Mail dispatched to a specific user, never reach the user IMAP mailbox. No information appear on the IMAP log (set to debug), neither on the amavis log (debug as well).
    I disactivated virus/spam control and set a message copy to the postmaster of all messages. On the postmaster mailbox I can see messages sent to that user, but on the IMAP mailbox of that user there are not all the messages. Strangely this does not apply to all incoming messages. I do not know simply where lost messages have gone.
    Any suggestion will be highly appreciated.

  • leeinspain

    I work for a college and have a Dual 2.3Ghz Xserve G5 running OSX Server 10.4.9 with a 700Gb Xserve RAID (has 270Gb free). We also have a Xserve G4 as the LDAP Replica. All users home directories are stored on the RAID of Xserve G5. I have 1361 users on the LDAP Open Directory system and all is running perfectly. I tried to add another 10 users, all added fine into Workgroup Manager, but I was then getting “User already Logged In” messages on the Client Macs, when the users were not logged in. If I turn on “multiple logins” the user can login but the home directory is not created on the RAID!!
    Is this a limitation of LDAP OD? A problem with the OS and the Finder not handling more than 1361 directories??? Any help would be excellent!!!!!!

  • jayartibee

    Please help if you can!

    In school I look after 200+ kids accounts. The boys all have selected sexy desktop backgrounds (the girls all have J.Depp or O. Bloom of course)

    I once downloaded instructions to force all clients (with networked user accounts) to have a fixed, corporate background. I lost the file!

    Anyone know how?

    (server 10.4)

  • markbate

    I’m currently looking to do the same thing..
    I managed to get our lab into blogging and now the 10.4 blog has a stack of useful stuff on there, that would be really nice to just port straight in to the 10.5 blog.

    I haven’t installed 10.5 server yet, I’m still in the process of making sure all the currently running stuff will be fine for 10.5.
    after scouring google, I came up empty on how both the 10.4 & 10.5 weblog work, so I decided to tinker around in the 10.4 terminal..

    It would appear that all your blog posts from 10.4 live in:
    /Library/Application Support/Weblogs/*blog_name*/

    each entry has a .html file & a .meta file.. the .html file being the literal blog post text, and the .meta being some strings of meta data about the post.

    In addition to the blog posts there is also some .properties files & .filters files that live in:

    I hope that helps