IFCONFIG(8)

NAME
ifconfig - configure network interface

SYNOPSIS
ifconfig [interface]
ifconfig interface [ protocol [configuration new-value ...] ...]
ifconfig -l [interface [protocol [configuration]]]
ifconfig -l interface protocol [configuration ...] ...

DESCRIPTION
ifconfig can both write the current configuration of if(4) network interface devices as well as update the configuration of a network interface. By default the configuration of every network interface is written. If the interface argument is given, only the configuration of that network interface is written.

If an interface is specified along with further operands, the configuration of the network interface is updated by iterating over the remaining operands: Naming a protocol makes it the current protocol, naming a configuration sets it within the current protocol to the subsequent new-value operand.

The options are as follows:

-l  Write the current value of each specified configuration rather than setting a new value. The new-value argument is no longer passed.

    If only an interface and a protocol is specified, list the names of each configuration of that protocol on the network interface.

    If only an interface is specified, list the names of each protocol on the network interface.

    If no interface is specified, list the names of each network interface.

The interface argument can be the name or the path of an interface, or a specifier uniquely matching an interface:

ether:mac
    Local ether(4) address.
etherhw:mac
    Hardware ether(4) address.
inet:ip
    Local inet(4) address.
id:num
    Network interface integer index.

The link protocol provides information about the network interface. The following configurations are supported:

up  yes if the link is up and no otherwise. (read-only)
type
    The type of the network interface, either ether or loopback. (read-only)
id  The network interface integer index. (read-only)
name
    The name of the network interface. (read-only)

The loopback protocol (lo(4)) has no configuration.

The ether protocol (Ethernet, ether(4)) has the following configurations:

address
    The local address in ether(4) address notation, or default to use the hardware address.
hwaddress
    The hardware address in ether(4) address notation. (read-only)

The inet protocol (Internet Protocol version 4, inet(4)) has the following configurations:

address
    The local address in inet(4) address notation.
router
    The default route in inet(4) address notation.
subnet
    The subnet mask in inet(4) address notation.

EXIT STATUS
ifconfig will exit 0 on success and non-zero otherwise.

EXAMPLES

    $ ifconfig
    if0:
    	link up yes type ether id 2
    	ether address 00:00:5e:00:53:ff hwaddress 00:00:5e:00:53:ff
    	inet address 192.0.2.2 router 192.0.2.1 subnet 255.255.255.0
    lo0:
    	link up yes type loopback id 1
    	loopback
    	inet address 127.0.0.1 router 0.0.0.0 subnet 255.0.0.0
    $ ifconfig if0
    if0:
    	link up yes type ether id 2
    	ether address 00:00:5e:00:53:ff hwaddress 00:00:5e:00:53:ff
    	inet address 192.0.2.2 router 192.0.2.1 subnet 255.255.255.0
    $ ifconfig if0 inet address 198.51.100.2 router 198.51.100.1
    $ ifconfig if0 ether address 00:00:5e:00:53:42 inet address 198.51.100.3
    $ ifconfig -l
    if0
    lo0
    $ ifconfig -l if0
    link
    ether
    inet
    $ ifconfig -l if0 inet
    address
    router
    subnet
    $ ifconfig -l if0 inet address
    198.51.100.3
    $ ifconfig -l if0 inet address subnet ether address link id
    198.51.100.3
    255.255.255.0
    00:00:5e:00:53:42
    42
    $ ifconfig -l etherhw:00:00:5e:00:53:ff link name
    if0

SEE ALSO
ether(4), if(4), inet(4), lo(4), dhclient(8), dnsconfig(8)

CAVEATS
ether(4) network interfaces with the inet(4) protocol are commonly automatically configured by dhclient(8). Disable dhclient(8) before manually configuring inet(4) on such interfaces to avoid the manual configuration being overwritten, or configure dhclient(8) to set your desired network interface configuration in the first place.