ifconfig

Configure network interface parameters

Syntax:

ifconfig interface address_family [address [dest_address]]
         [parameters]
ifconfig [-m] [-L] interface [protocol_family]
ifconfig -a [-m] [-L] [-b] [-d] [-u] [-s]
         [protocol_family]
ifconfig -l [-b] [-d] [-u] [-s]
ifconfig -s interface
ifconfig -C

Runs on:

Neutrino

Options:

-a
Display information about all of the interfaces in the system.
-b
List only the broadcast interfaces.
-C
List all of the interface cloners available on the system, with no additional information. This option is mutually exclusive with all other options and commands.
-d
List only the interfaces which are down.
-L
Display the address lifetime for IPv6 addresses, as a time offset string.
-l
List all available interfaces on the system, with no additional information. This option is mutually exclusive with all other options and commands, except for -b, -d, -s, -u.
-m
Display all of the supported media for all of the interfaces in the system (used in conjunction with -a).
-m interface
Display all of the supported media for the specified interface.
-s
List only the interfaces that are connected.
-s interface
Query this interface for its media status. If the interface supports reporting media status, and it reports that it doesn't appear to be connected to a network, ifconfig exits with status of 1 (false); otherwise, it exits with zero (true). Not all interface drivers support media status reporting.
-u
List only the interfaces which are up.
interface
The name of the interface to configure. This is a string of the form name unit (e.g. en1)
address
Either a hostname present in the /etc/hosts database, hosts(5), or a DARPA-Internet address expressed in the standard Internet "dot notation."
address_family
The address family that affects the interpretation of the remaining parameters. Specifying an address family is recommended since an interface can receive transmissions in differing protocols with different naming schemes. Address or protocol families currently supported are "inet" and "inet6".
dest_address
Address of the correspondent on the other end of a point-to-point link (for pppx interfaces only).
parameters
See the "Parameters" section below.
protocol_family
Report only the details specific to this protocol family.

Description:

The ifconfig utility is used to assign an address and/or configure parameters for a network interface. This utility must be run at boot time to define the network address of each interface present on a machine; it may also be run later on to redefine an interface's address or to configure other interface parameters.

When no optional parameters are specified, The ifconfig utility displays the current configuration for a network interface. If a protocol family is specified, it will report only the details specific to that protocol family.

Note that only a superuser may modify the configuration of a network interface.

Parameters

You may set the following parameters with the ifconfig utility:

alias
Establish an additional network address for this interface. This is useful when someone changes network address of an interface, or when someone wishes to accept packets addressed to the old interface.
-alias
Remove the additional network address for this interface.
arp
Enable the use of the Address Resolution Protocol in mapping between network-level addresses and link-level addresses (default). This is implemented to do mapping between DARPA Internet addresses and 10 Mbits/sec Ethernet addresses.
-arp
Disable the use of the Address Resolution Protocol.
anycast
("inet6" only) Set the IPv6 anycast address bit.
-anycast
("inet6" only) Clear the IPv6 anycast address bit.
broadcast mask
("inet" only) Use this address to represent broadcasts to the network. The default broadcast address is the address with a host part of all 1's.
create
Create the specified network pseudo-device.
delete
Remove a specified network address. You should use this parameter if you have incorrectly specified an alias, or you will no longer use an alias. In the event that you have incorrectly set an NS address which has the side effect of specifying the host portion, you must respecify the host portion while removing all NS addresses. Note that this parameter does not work for IPv6 addresses. If you need to delete IPv6 addresses, use -alias with an explicit IPv6 address.
deletetunnel
Unconfigure the physical source and destination address for the IP tunnel interfaces previously configured with tunnel.
destroy
Destroy the specified network pseudo-device.
dest_address
Specify the address of the correspondent on the other end of a point-to-point link.
down
Mark an interface "down." When an interface is marked down, the system won't attempt to transmit messages through that interface. If possible, the interface is reset to disable reception as well. This action doesn't automatically disable routes using the interface.
ip4csum[-rx][-tx]
Enable hardware checksumming of ip4 headers on the interface provided it's supported. This action can be restricted to either rx or tx directions depending on hardware limitations or user preference.
-ip4csum[-rx][-tx]
Disable hardware checksumming of ip4 headers on the interface.
link[0-2]
Enable special processing at the link-level for the interface. Whereas three options are interface-specific in actual effect, they're generally used to select special modes of operation. An example of this is to enable SLIP compression, or to select the connector type for some Ethernet cards. For more information, refer to the documentation for the specific driver.
-link[0-2]
Disable special processing at the link-level for the specified interface.
metric n
Set the routing metric of the interface to n (default is 0). The routing metric is used by the routing protocol, routed(8). Higher metrics have the effect of making a route less favorable; metrics are counted as additional hops to the destination network or host.
mtu n
Set the maximum transmission unit of the interface to n. Most interfaces don't support this parameter.
netmask mask
("inet", "inet6" and ISO) Reserve this much of the address for subdividing networks into subnetworks. The mask:

For "inet" and "inet6" addresses, the netmask can also be given with slash-notation after the address (e.g. 192.168.17.3/24).

pltime n
("inet6" only) Use this value as the preferred lifetime for the address.
prefixlen n
("inet6" only) Set the prefix length (the effect is similar to netmask).
tcp4csum[-rx][-tx]
Enable hardware checksumming of tcp4 packets on the interface provided it's supported. This action can be restricted to either rx or tx directions depending on hardware limitations or user preference.
-tcp4csum[-rx][-tx]
Disable hardware checksumming of tcp4 packets on the interface.
tentative
("inet6" only) Set the IPv6 tentative address bit.
-tentative
("inet6" only) Clear the IPv6 tentative address bit.
tunnel src_addr dest_addr
(IP tunnel devices only) Configure the physical source and destination address for IP tunnel interfaces (GIF). The src_addr and dest_addr arguments are interpreted as the outer source or destination for the encapsulating IPv4/IPv6 header.
udp4csum[-rx][-tx]
Enable hardware checksumming of udp4 packets on the interface provided it's supported. This action can be restricted to either rx or tx directions depending on hardware limitations or user preference.
-udp4csum[-rx][-tx]
Disable hardware checksumming of udp4 packets on the interface.
up
Mark an interface "up." You can use this command to enable an interface once it has been turned "down" using ifconfig down. By default, an interface is marked as "up" the first time the ifconfig utility is run to assign the interface an address. If the interface is reset when previously marked as "down", the hardware will be initialized.
vlan tag
Set the VLAN tag to tag if the interface is a vlan(4) pseudo-interface. This 16-bit number is used to create a 802.1Q VLAN header for the packets sent from the vlan(4) interface. Note that vlan and vlanif must be set at the same time.
vlanif iface
Associate the physical interface iface if the interface is a vlan(4) pseudo-interface. Packets transmitted through the vlan(4) interface will be diverted to the specified physical interface iface with 802.1Q VLAN encapsulation. Packets with 802.1Q encapsulation received by the physical interface with the correct VLAN tag will be diverted to the associated vlan(4) pseudo-interface. The VLAN interface is assigned a copy of the physical interface's flags and Ethernet address. This command will fail if the vlan(4) interface already has a physical interface associated with it. In order to change this association to another physical interface, the existing association must be cleared first. Note that vlanif and vlan must be set at the same time.
vltime n
("inet6" only) Set valid lifetime for the address.

Diagnostics

Depending on the error, the utility may display messages indicating:

The ifconfig utility doesn't work with tiny TCP/IP stack (npm-ttcpip.so). In order to configure the network interface, see the options for the npm-ttcpip.so utility.

See also:

/etc/autoconnect, netmanager, netstat, phlip, routed