Terminal in Mac OS XTerminal in Mac OS X

The networksetup utility offers a command line interface to configuring the variety of Mac networking features available in Mac OS X. We’ve discussed networksetup and accompanying features many times here for more advanced purposes, but one of the simpler uses of networksetup is that it can list out every piece of networking hardware attached to a Mac, it’s accompanying device interface, and it’s associated address. This works to list both internal networking components and external connected networking devices as well, so if you’re using an external NIC card, you should find it here.

How to List All Network Hardware on a Mac via Command Line

To see what networking hardware is connected to a given Mac, simply issue the following command string into the Terminal:

networksetup -listallhardwareports

You will see something like the following reported back, which displays the hardware port (which in this case is basically the user friendly name of the interface, like Wi-Fi, Bluetooth, Thunderbolt, Ethernet, etc), the device interface (en1, en0, en3, bridge1, usb1, etc), and the hardware address of the device, called Ethernet Address here, but you may know it better as a devices MAC address, which can be important to know for address filtering and spoofing.

Hardware Port: Bluetooth DUN
Device: Bluetooth-Modem
Ethernet Address: N/A

Hardware Port: Wi-Fi
Device: en0
Ethernet Address: d7:02:65:7c:1e:14

Hardware Port: Bluetooth PAN
Device: en1
Ethernet Address: N/A

Hardware Port: Thunderbolt 1
Device: en2
Ethernet Address: bb:e8:c3:25:2b:12

Hardware Port: Thunderbolt Bridge
Device: bridge0
Ethernet Address: N/A

What’s not listed in the hardware report are external devices that are connected through the networking interfaces, meaning things like routers, relays, switches,any iPhone Personal Hotspot, and tethered or wireless Android hotspots, because those are not considered native hardware, though you can retrieve that data with networksetup as well.

Using “networksetup -listallhardwareports” can be an excellent trick for troubleshooting network devices and connections, particularly if a hardware interface appears to be nonexistent or is having problems.

For example, if a connection is failing to work because you can’t find a specific networking device in Network preference panel of Mac OS X, you can check to see if something like a wifi card is found here, and if so, try to power-cycle it off and on again, which often resolves many of those simple detection problems.

On the other hand, if you know for certain that a piece of hardware is connected but it’s still not showing up, that could point to a hardware problem either with the network card, or with the interface itself. More simply, it also makes it simple to find the device interface, which is necessary if you’re trying to connect to wifi networks from the command line using the same networksetup command.

networksetup has many other uses and extremely advanced features aimed at advanced Mac users, you can find some of the other tricks we’ve covered using the networksetup utility here.

Source

Follow Me:
Top Best Sellers!!