Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Other than ifconfig, is there an app/script for OS X Lion that produces similar output/info to ethtool?

Specifically, I would like to be able to query the following:

  • driver info
  • online/offline
  • speed
  • duplex

Output from ethtool looks like this:

ajc@ajc-3] sudo ethtool eth0|grep Duplex                                                                                                                                                    ~
    Duplex: Full
ajc@ajc-3] sudo ethtool eth0|grep Speed                                                                                                                                                     ~
    Speed: 100Mb/s
ajc@ajc-3] sudo ethtool eth0|grep Link                                                                                                                                                      ~
    Link detected: yes
ajc@ajc-3] sudo ethtool -i eth0                                                                                                                                                             ~
driver: pcnet32
version: 1.32
firmware-version: 
bus-info: 0000:00:03.0
share|improve this question
    
Information about the features you're looking for would be helpful. Don't make us do the research—help us to help you. Nobody should care more about the answer to your question than you do –  jaberg Mar 19 '12 at 21:59
1  
Per your suggestion, details provided. –  AJ. Mar 19 '12 at 22:02

3 Answers 3

up vote 5 down vote accepted
+100

My primary tools for reading OSX details on hardware are system_profiler and ioreg. For network interface details, ifconfig is the best bet. The first two will show you connection paths for the hardware as well as software driver information. In your example - media and status provide most of the details you listed.

mac:~ me$ ifconfig en0 

en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=2b<RXCSUM,TXCSUM,VLAN_HWTAGGING,TSO4>
    ether 00:1b:63:a8:33:33 
    inet6 fe80::21b:63ff:fea8:3333%en0 prefixlen 64 scopeid 0x4 
    inet 172.16.1.8 netmask 0xffffff00 broadcast 172.16.1.255
    media: autoselect (100baseTX <full-duplex,flow-control>)
    status: active

mac:~ me$ system_profiler|awk '/^Ethernet Cards/{c=15;next}c-->0'

        ethernet:

          Type: Ethernet Controller
          Bus: PCI
          Vendor ID: 0x10de
          Device ID: 0x0ab0
          Subsystem Vendor ID: 0x10de
          Subsystem ID: 0xcb79
          Revision ID: 0x00b1
          BSD name: en0
          Kext name: nvenet.kext
          Location: /System/Library/Extensions/IONetworkingFamily.kext/Contents/PlugIns/nvenet.kext
          Version: 2.0.17

In your case, you are grepping for Duplex, Speed and Link and on Mac hardware you can get all of that data from ifconfig en0 | egrep [media|status] as desired.

share|improve this answer
    
Thanks, added output above. –  AJ. Mar 19 '12 at 22:28
    
I checked both of these commands, and they seem to probe extensive, system-wide info. I'd rather avoid that if possible...I wonder if there's something networking-focused? –  AJ. Mar 19 '12 at 22:40
1  
I disagree with this comment, you can easily replicate the suggested output of ethtool simply by adding a grep statement in the same way you did. ifconfig en0 | grep Media: supplies the same details as the first 3 of your ethtool outputs in a single command and without any extraneous information. –  stuffe Mar 24 '12 at 13:07
    
The only difference remaining is that macs list autoselect and the negotiated link speed and don't simply report just the link speed. Piping output to awk and cut can help there is desired. –  bmike Mar 24 '12 at 15:13
    
@stuffe - the "two commands" to which my comment refers were system_profiler and ioreg. i agree that ifconfig is less resource-intensive. –  AJ. Mar 27 '12 at 20:12

Maybe networksetup can give you some information you're looking for:

networksetup -getinfo Ethernet
networksetup -getmedia Ethernet

NETWORKSETUP(8) BSD System Manager's Manual NETWORKSETUP(8)

NAME networksetup -- configuration tool for network settings in System Preferences.

But it's not really lean and may give you less information than ifconfig

share|improve this answer

I would mix both ifconfig and networksetup:

ifconfig:

alex@smiley:~|⇒ ifconfig en0 | grep status

status: active

Then networkstatus

alex@smiley:~|⇒ networksetup -getinfo "Ethernet Adaptor (en0)"

DHCP Configuration

IP address: 192.168.1.11

Subnet mask: 255.255.255.0

Router: 192.168.1.1

Client ID:

IPv6: Automatic IPv6

IP address: none

IPv6 Router: none

Ethernet Address: 1c:6f:65:98:de:81

Grep out whichever lines from both tools that you want. Would be easy enough to combine the various lines into a simple script to output all the information together.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.