ifconfig

view and control IP configuration state

 ipconfig waitall
     getifaddr interface-name
     ifcount
     getoption interface-name (option-name | option-code)
     getpacket interface-name
     getv6packet interface-name
     setverbose level

     set interface-name NONE | (DHCP | BOOTP) | (MANUAL | INFORM) ip-address subnet-mask | NONE-V6| 
     AUTOMATIC-V6
     MANUAL-V6 ipv6-address prefix-length
     6TO4
Communicates with the IPConfiguration agent to retrieve and set IP configuration parameters.
Should only be used in a test and debug context. Public API's in the SystemConfiguration framework are currently the only supported way to access and control the state of IPConfiguration.

The IPConfiguration agent is responsible for configuring and managing the IP addresses on direct, connectionless interfaces such as IEEE 802.3 Ethernet and IEEE 1394 FireWire. The IPConfiguration agent is a program bundle that is loaded and executed by the configd(8) process.

The IPConfiguration agent implements the client side of the DHCP and BOOTP protocols described in RFC951, RFC1542, RFC2131, and RFC2132. It also assigns and maintains static IP addresses. It may also allocate and assign a link-local IP address if DHCP fails to acquire an IP address.

IPConfiguration agent performs IP address conflict detection before assigning an IP address to an interface.

waitall Blocks until all network services have completed configuring, or have timed out in the process of configuring. This is only useful for initial system start-up time synchronization for legacy network services that are incapable of dealing with dynamic network configuration changes.
getifaddr interface-name Output IP address for the first network service associated with the given interface. The output will be empty if no service is currently configured or active on the interface.
ifcount Outputs number of interfaces that IPConfiguration is capable of configuring. The value that's printed will not change unless relevant network interfaces are either added to or removed from the system.
getoption interface-name (option-name | option-code) Outputs BOOTP/DHCP option with the given name or option code integer value. See bootpd(8) for option code names. If an option has multiple values e.g. domain_name_server, only the first value is printed.
getpacket interface-name Outputs the DHCP/BOOTP packet that the client accepted from the DHCP/BOOTP server.
check what the server provided, and whether the values are sensible.
outputs nothing if DHCP/BOOTP is not active on the interface, or the attempt to acquire an IP address was unsuccessful.
getv6packet interface-name Outputs latest DHCPv6 packet that the client accepted from the DHCPv6 server.
In the case of stateful DHCPv6, it corresponds to the last packet from the server that contained addressing information.
useful to check what the server provided, and whether the values are sensible.
outputs nothing if DHCPv6 is not active on the interface.
set interface-name

requires root privileges.

debugging, it can't be used to configure a persistent service.

NONE all existing IPv4 services are de-configured.
NONE-V6 is specified, all existing IPv6 services are de-configured.
DHCP | BOOTP The IP address, subnet mask, router, and DNS information are retrieved automatically.
MANUAL | INFORM an IP address ip-address and a subnet mask subnet-mask. configures the IP address statically
, INFORM broadcasts DHCP INFORM packets to retrieve DHCP option information.
If the DHCP server responds and supplies a subnet mask, that subnet mask is used instead of the specified subnet-mask.
NONE-V6 IPv6 address, prefix length and router are retrieved
AUTOMATIC-V6
MANUAL-V6 ipv6-address prefix-length
6TO4 only for Six To Four (IFT_STF) interfaces e.g. stf0. Sets the interface to have a new temporary network service of the given type. Any existing services on the interface for the particular protocol (IPv4 or IPv6) are first de-configured before the new service is instantiated. The temporary services that are created only remain until the next network configuration change occurs. See scselect(8).
setverbose level interface 0̸ to disable , the default.
1 to enable . persistent across boots !

When enabled, verbose log files are generated in the directory /Library/Logs/CrashReporter. The filenames follow the naming convention com.apple.networking.IPConfiguration.log.. The setverbose command requires root privileges.

EXAMPLES

     # ipconfig getpacket en0
     op = BOOTREPLY
     htype = 1
     dp_flags = 0
     hlen = 6
     hops = 0
     xid = 1956115059
     secs = 0
     ciaddr = 0.0.0.0
     yiaddr = 192.168.4.10
     siaddr = 192.168.4.1
     giaddr = 0.0.0.0
     chaddr = 0:3:93:7a:d7:5c
     sname = dhcp.mycompany.net
     file =
     options:
     Options count is 10
     dhcp_message_type (uint8): ACK 0x5
     server_identifier (ip): 192.168.4.1
     lease_time (uint32): 0x164a
     subnet_mask (ip): 255.255.255.0
     router (ip_mult): {192.168.4.1}
     domain_name_server (ip_mult): {192.168.4.1}
     domain_name (string): mycompany.net
     end (none):

     # ipconfig getoption en0 router
     192.168.4.1

SEE ALSO configd(8), bootpd(8), scselect(8)


MS WIndows

ifconfig

ipconfig [/allcompartments] [/? | /all | /renew [adapter] | /release [adapter] | /renew6 [adapter] | /release6 [adapter] | /flushdns | /displaydns | /registerdns | /showclassid adapter | /setclassid adapter [classid] ]

adapter Connection name (wildcard characters * and ? allowed, see examples)
/all
/allcompartments
/release
/release6
/renew
/renew6
/flushdns
/registerdns Refreshes all DHCP leases and re-registers DNS names
/displaydns contents of DNS Resolver Cache.
/showclassid dhcp class IDs allowed
/setclassid Modifies the dhcp class id.

default : display only the IP address, subnet mask and default gateway for each adapter bound to TCP/IP.

For release and renew, if no adapter name is specified, then the IP address leases for all adapters bound to TCP/IP will be released or renewed.

For Setclassid, if no ClassId is specified, then the ClassId is removed.

Examples:

    > ipconfig                       ... Show information
    > ipconfig /all                  ... Show detailed information
    > ipconfig /renew                ... renew all adapters
    > ipconfig /renew EL*            ... renew any connection that has its
                                         name starting with EL
    > ipconfig /release *Con*        ... release all matching connections,
                                         eg. "Local Area Connection 1" or
                                             "Local Area Connection 2"
    > ipconfig /allcompartments      ... Show information about all
                                         compartments
    > ipconfig /allcompartments /all ... Show detailed information about all
                                         compartments