Mac OS X ipconfig

If you momentarily forget where you are at a Mac OS X terminal session, you might type "ipconfig /all" or something equally Windowish. You will get a response:

usage: ipconfig <command> <args>>
where <command> is one of waitall, getifaddr, ifcount, getoption, getpacket, set, setverbose

What's this? You already know you mistyped: on Mac OS X you probably meant to run "ifconfig -a" just as you would on Linux. But "ipconfig" is different, and is actually something good to have in your bag of tricks.

The first thing ipconfig can do for you is quickly give you all your dhcp info:

$ ipconfig getpacket en0
op = BOOTREPLY
htype = 1
flags = 0
hlen = 6
hops = 0
xid = 1045997387
secs = 0
ciaddr = 0.0.0.0
yiaddr = 192.168.9.30
siaddr = 0.0.0.0
giaddr = 0.0.0.0
chaddr = 0:16:cb:8d:38:f7
sname =
file =
options:
Options count is 7
dhcp_message_type (uint8): ACK 0x5
subnet_mask (ip): 255.255.255.0
lease_time (uint32): 0x93a80
router (ip_mult): {192.168.9.254}
domain_name_server (ip_mult): {192.168.9.254}
server_identifier (ip): 192.168.9.254
end (none):

There are shortcuts to the items listed under "options":

$ ipconfig getoption en0 router
192.168.9.254
$ ipconfig getoption en0 domain_name_server
192.168.9.254

"ipconfig getifaddr en0" is a quick way to just get the ip address. You can also use ipconfig with its "set" options to change an interface from DHCP to manual or vice-versa. That's temporary; it doesn't write any start up files.

If you are having difficulty with DHCP, ipconfig has one more use: you can (as root) set verbose logging with "ipconfig setverbose 1". With that set, you get minor debugging info written to syslog (/var/log/system.log on my system) , but you also get a separate BOOTP/DHCP log in /var/log/com.apple.IPConfiguration.bootp that shows the full BOOTREQUEST/BOOTREPLY packet negotiation.

Think of ipconfig the next time you are looking for DHCP info on a Mac.




8 comments




More Articles by

Find me on Google+

© Anthony Lawrence







Sun Feb 26 08:04:24 2012: 10647   informatiquegrenoble

gravatar


mode verbose has not been set � and am looking for network profile (an IP address) !

any idea where to find this files / settings ? looked into /etc, /user/etc, /var, /library etc � nothing found !

thanks

sebastien



Sun Feb 26 09:32:09 2012: 10648   TonyLawrence

gravatar


Look in /Library/Preferences/SystemConfiguration/com.apple.network.identification.plist

and the other files in that directory.



Sun Feb 26 09:57:55 2012: 10649   sebastien

gravatar


thanks, already looked into � but nothing found here �
so if all these path are the right place, i stop search !

thank for your time !

Sebastien



Sun Feb 26 10:24:40 2012: 10650   TonyLawrence

gravatar


But it is. I can see it in com.apple.network.identification.plist

Way back before 10.3 it was in /var/db/SystemConfiguration/preferences.xml I think, but that was a long time ago.

 

<key>IPv4</key>
<dict>
<key>Addresses</key>
<array>
<string>192.168.11.8</string> </array>
<key>InterfaceName</key>
<string>en1</string>
<key>Router</key>
<string>192.168.11.1</string>
<key>SubnetMasks</key>
<array>




Sun Feb 26 11:21:30 2012: 10651   sebastien

gravatar


you are right, but information 'am lookin for are not in this files �
have found lots of profile, not the one am looking for

maybe settings have been modified or automatic profile is not stored or anything else ?

path/file is OK, but settings are not available so there is nothing i can do �

Sebastien



Sun Feb 26 12:01:05 2012: 10652   TonyLawrence

gravatar


Then what are you looking for??



Sun Feb 26 12:07:54 2012: 10653   sebastien

gravatar


lookin' for a network profile (exactly LAN IP adress) �
i need it after OS X install, and setup printer or other network stuff

but data/settings have found are not the one am lookin for !
so i have to find another way to get this address �

Thanks again

Sebastien



Sun Feb 26 12:33:19 2012: 10654   TonyLawrence

gravatar


OK - I guess I don't understand what you are after because my IP address IS in that file..


------------------------
Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us