ethtool Equivalent for OS X Lion
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
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.
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
I would mix both ifconfig and networksetup:
ifconfig
alex@smiley:~|⇒ ifconfig en0 | grep status
status: active
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.