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: Tomnibus on Jun 17, '10 08:01:40AM

I wonder if this works with statically defined interfaces?

I'm connected with a Macbook Pro and I have the wired interface (en0) plugged in with a static IP. I copy/pasted this script and it tells me the Wired Interface is inactive like the example.

I notice it's getting the information from this command: ipconfig getpacket en0

I run that in the command line and there is no output. Whereas en1 shows the wireless information.



[ Reply to This | # ]
Retrieve network info from the command line
Authored by: feyd.rm on Jun 17, '10 03:02:33PM
The getpacket option is actually showing you the DHCP or BOOTP information from the packet that the computer accepted. If you are assigning the IP manually it makes sense that you are not seeing it.
$ man ipconfig


[ Reply to This | # ]
Retrieve network info from the command line
Authored by: victic on Jun 18, '10 10:35:57AM
Yes, the branch of code written for static address might benefit from a few changes. For example, the way I can retrieve my own IP when it's static is:
ifconfig en0 | grep inet | awk '{print $2}'

[ Reply to This | # ]