Name

ipconfig — stdin  stdout  - file  -- opt  --help  --version

Synopsis

ipconfig action [arguments]

The ipconfig command displays and sets various aspects of your computer’s network interface. This command is only for testing and debugging, and the whole topic is beyond the scope of this book, but we’ll teach you a few tricks. To see the IP address and subnet mask of the network interface en0, try:

ipconfig getifaddr en0
192.168.1.7
➜ ipconfig getoption en0 subnet_mask
255.255.255.0

or to count your network interfaces, run:

ipconfig ifcount
2

To display the IP address of your Mac’s primary DNS server, and your Mac’s domain name, run:

ipconfig getoption en0 domain_name_server
192.168.1.1
➜ ipconfig getoption en0 domain_name
example.com

To view the DHCP information that your Mac received from a DHCP server, run:

ipconfig getpacket en0
op = BOOTREPLY
htype = 1
flags = 0
hlen = 6
...

Most other ipconfig actions, such as changing parameters of your network interface, require more technical knowledge of networking.

Get Macintosh Terminal Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.