Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Retrieve network info from the command line' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Retrieve network info from the command line
Authored by: satcomer on Jun 17, '10 09:18:00AM

I guess I am good enough to edit the script because on my Mac Pro I have en0, en1 as wired and en2 as wireless. If some could help me edit for this extra port I would appreciate it.

Edited on Jun 17, '10 09:19:50AM by satcomer



[ Reply to This | # ]
Retrieve network info from the command line
Authored by: babbage on Jun 17, '10 10:11:24AM

Right -- this script assumes two Ethernet ports: one wired, one wireless. It doesn't attempt to handle the case of a Mac Pro or G5 with twin Ethernet ports, nor does it attempt to handle alternate custom ports such as a 10-gigabit Ethernet PCI card, multi-port 1-gigabit Ethernet cards, USB network adapters, etc.

For that matter, it's possible to set up standard TCP/IP networking over the Firewire port[s], though almost no one does that, but it would be nice to account for it just in case someone is using them. Likewise, if you have Parallels or VMWare Fusion installed, they can set up virtual interfaces that you might want to know about.

This script is an excellent starting point, but a more general solution to this would attempt to enumerate all of the current ports (by scanning the output of `networksetup -listallhardwareports`, for example), then go from there. I might tinker with it a bit & post back if I come up with anything useful.

--
DO NOT LEAVE IT IS NOT REAL

---

--
DO NOT LEAVE IT IS NOT REAL
Edited on Jun 17, '10 10:53:07AM by babbage


[ Reply to This | # ]