Configure network interface parameters
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
- Display information about all of the interfaces in the system.
- List only the broadcast interfaces.
- 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.
- List only the interfaces which are down.
- Display the address lifetime for IPv6 addresses, as a time offset string.
- 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.
- 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.
- 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.
- List only the interfaces which are up.
- The name of the interface to configure. This is a string of the form name unit (e.g. en1)
- Either a hostname present in the /etc/hosts database, hosts(5), or a DARPA-Internet address expressed in the standard Internet "dot notation."
- 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".
- Address of the correspondent on the other end of a point-to-point link (for pppx interfaces only).
- See the "Parameters" section below.
- Report only the details specific to this protocol family.
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.
You may set the following parameters with the ifconfig utility:
- 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.
- Remove the additional network address for this interface.
- 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.
- Disable the use of the Address Resolution Protocol.
- ("inet6" only) Set the IPv6 anycast address bit.
- ("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 the specified network pseudo-device.
- 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.
- Unconfigure the physical source and destination address for the IP tunnel interfaces previously configured with tunnel.
- Destroy the specified network pseudo-device.
- Specify the address of the correspondent on the other end of a point-to-point link.
- 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.
- 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.
- Disable hardware checksumming of ip4 headers on the interface.
- 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.
- 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:
- includes the network part of the local address and the subnet part, which is taken from the host field of the address
- can be specified as a single hex number with a leading 0x, with a dot-notation Internet address, or with a pseudo-network name listed in the network table, networks(5)
- contains 1's for the bit positions in the 32-bit address that are to be used for the network and the subnet parts, and 0's for the host part
- should contain at least the standard network portion; the subnet field should be contiguous with the network portion.
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).
- 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.
- Disable hardware checksumming of tcp4 packets on the interface.
- ("inet6" only) Set the IPv6 tentative address bit.
- ("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.
- 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.
- Disable hardware checksumming of udp4 packets on the interface.
- 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.
Depending on the error, the utility may display messages indicating:
- the specified interface doesn't exist
- the requested address is unknown
- the user isn't privileged and tried to alter an interface's configuration.
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.