IFCONFIG(8) BSD System Manager's Manual IFCONFIG(8)
ifconfig -- configure network interface parameters
ifconfig [-L] [-m] [-r] interface [create] [address_family] [address [dest_address]] [parameters]
ifconfig interface destroy
ifconfig -a [-L] [-d] [-m] [-r] [-u] [-v] [address_family]
ifconfig -l [-d] [-u] [address_family]
ifconfig [-L] [-d] [-m] [-r] [-u] [-v] [-C]
ifconfig interface vlan vlan-tag vlandev iface
ifconfig interface -vlandev iface
ifconfig interface bonddev iface
ifconfig interface -bonddev iface
ifconfig interface bondmode lacp | static
The ifconfig utility is used to assign an address to a network interface and/or configure network interface parameters.
The following options are available:
For the DARPA-Internet family, the address is either a host name present in the host name data base, hosts(5), or a DARPA Internet
address expressed in the Internet standard ``dot notation''.
It is also possible to use the CIDR notation (also known as the slash notation) to include the netmask. That is, one can specify an
address like 192.168.0.1/16.
For the ``inet6'' family, it is also possible to specify the prefix length using the slash notation, like ::1/128. See the prefixlen
parameter below for more information.
The link-level (``link'') address is specified as a series of colon-separated hex digits. This can be used to e.g. set a new MAC
address on an ethernet interface, though the mechanism used is not ethernet-specific. If the interface is already up when this
option is used, it will be briefly brought down and then brought back up again in order to ensure that the receive filter in the
underlying ethernet hardware is properly reprogrammed.
Specify the address family which affects interpretation of the remaining parameters. Since an interface can receive transmissions in
differing protocols with different naming schemes, specifying the address family is recommended. The address or protocol families
currently supported are ``inet'', ``inet6'', and ``link''. The default is ``inet''. ``ether'' and ``lladdr'' are synonyms for
Specify the address of the correspondent on the other end of a point to point link.
This parameter is a string of the form ``name unit'', for example, ``en0''.
The following parameters may be set with ifconfig:
add Another name for the alias parameter. Introduced for compatibility with BSD/OS.
alias Establish an additional network address for this interface. This is sometimes useful when changing network numbers, and one wishes
to accept packets addressed to the old interface. If the address is on the same subnet as the first network address for this inter-
face, a non-conflicting netmask must be given. Usually 0xffffffff is most appropriate.
-alias Remove the network address specified. This would be used if you incorrectly specified an alias, or it was no longer needed. If you
have incorrectly set an NS address having the side effect of specifying the host portion, removing all NS addresses will allow you to
respecify the host portion.
(Inet6 only.) Specify that the address configured is an anycast address. Based on the current specification, only routers may con-
figure anycast addresses. Anycast address will not be used as source address of any of outgoing IPv6 packets.
arp Enable the use of the Address Resolution Protocol (arp(4)) in mapping between network level addresses and link level addresses
(default). This is currently implemented for mapping between DARPA Internet addresses and IEEE 802 48-bit MAC addresses (Ethernet,
FDDI, and Token Ring addresses).
-arp Disable the use of the Address Resolution Protocol (arp(4)).
(Inet only.) Specify the address to use to represent broadcasts to the network. The default broadcast address is the address with a
host part of all 1's.
debug Enable driver dependent debugging code; usually, this turns on extra console error logging.
-debug Disable driver dependent debugging code.
delete Another name for the -alias parameter.
down Mark an interface ``down''. When an interface is marked ``down'', the system will not attempt to transmit messages through that
interface. If possible, the interface will be reset to disable reception as well.
ether Another name for the lladdr parameter.
Set the link-level address on an interface. This can be used to e.g. set a new MAC address on an ethernet interface, though the
mechanism used is not ethernet-specific. The address addr is specified as a series of colon-separated hex digits. If the interface
is already up when this option is used, it will be briefly brought down and then brought back up again in order to ensure that the
receive filter in the underlying ethernet hardware is properly reprogrammed.
If the driver supports the media selection system, set the media type of the interface to type. Some interfaces support the mutually
exclusive use of one of several different physical media connectors. For example, a 10Mbit/s Ethernet interface might support the
use of either AUI or twisted pair connectors. Setting the media type to 10base5/AUI would change the currently active connector to
the AUI port. Setting it to 10baseT/UTP would activate twisted pair. Refer to the interfaces' driver specific documentation or man
page for a complete list of the available types.
If the driver supports the media selection system, set the specified media options on the interface. The opts argument is a comma
delimited list of options to apply to the interface. Refer to the interfaces' driver specific man page for a complete list of avail-
If the driver supports the media selection system, disable the specified media options on the interface.
If the driver supports user-configurable checksum offloading, enable receive (or transmit) checksum offloading on the interface.
Some drivers may not be able to enable these flags independently of each other, so setting one may also set the other. The driver
will offload as much checksum work as it can reliably support, the exact level of offloading varies between drivers.
If the driver supports user-configurable checksum offloading, disable receive (or transmit) checksum offloading on the interface.
These settings may not always be independent of each other.
tso If the driver supports tcp(4) segmentation offloading, enable TSO on the interface. Some drivers may not be able to support TSO for
ip(4) and ip6(4) packets, so they may enable only one of them.
-tso If the driver supports tcp(4) segmentation offloading, disable TSO on the interface. It will always disable TSO for ip(4) and
lro If the driver supports tcp(4) large receive offloading, enable LRO on the interface.
-lro If the driver supports tcp(4) large receive offloading, disable LRO on the interface.
av If supported by the driver, enable 802.1 AVB on the interface.
-av If supported by the driver, disable 802.1 AVB on the interface.
If the driver offers user-configurable VLAN support, enable reception of extended frames or tag processing in hardware, respectively.
Note that this must be issued on a physical interface associated with vlan(4), not on a vlan(4) interface itself.
If the driver offers user-configurable VLAN support, disable reception of extended frames or tag processing in hardware, respec-
create Create the specified network pseudo-device. If the interface is given without a unit number, try to create a new device with an
arbitrary unit number. If creation of an arbitrary device is successful, the new device name is printed to standard output unless
the interface is renamed or destroyed in the same ifconfig invocation.
Destroy the specified network pseudo-device.
plumb Another name for the create parameter. Included for Solaris compatibility.
Another name for the destroy parameter. Included for Solaris compatibility.
Set the routing metric of the interface to n, default 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, default is interface specific. The MTU is used to limit the size of packets
that are transmitted on an interface. Not all interfaces support setting the MTU, and some interfaces have range restrictions.
(Inet only.) Specify how much of the address to reserve for subdividing networks into sub-networks. The mask includes the network
part of the local address and the subnet part, which is taken from the host field of the address. The mask can be specified as a
single hexadecimal number with a leading '0x', with a dot-notation Internet address, or with a pseudo-network name listed in the net-
work table networks(5). The mask contains 1's for the bit positions in the 32-bit address which are to be used for the network and
subnet parts, and 0's for the host part. The mask should contain at least the standard network portion, and the subnet field should
be contiguous with the network portion.
The netmask can also be specified in CIDR notation after the address. See the address option above for more information.
(Inet6 only.) Specify that len bits are reserved for subdividing networks into sub-networks. The len must be integer, and for syn-
tactical reason it must be between 0 to 128. It is almost always 64 under the current IPv6 assignment rule. If the parameter is
omitted, 64 is used.
The prefix can also be specified using the slash notation after the address. See the address option above for more information.
remove Another name for the -alias parameter. Introduced for compatibility with BSD/OS.
Enable special processing of the link level of the interface. These three options are interface specific in actual effect, however,
they are in general 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. Refer to the man page for the specific driver for more information.
Disable special processing at the link level with the specified interface.
up Mark an interface ``up''. This may be used to enable an interface after an ``ifconfig down''. It happens automatically when setting
the first address on an interface. If the interface was reset when previously marked down, the hardware will be re-initialized.
The following parameters are for ICMPv6 Neighbor Discovery Protocol. Note that the address family keyword ``inet6'' is needed for them:
nud Perform network unreachability detection (NUD).
-nud Do not perform network unreachability detection (NUD).
Disable all IPv6 communication on the interface.
Do not disable all IPv6 communication on the interface.
Disable the processing of Secure Neighbor Discovery (SEND).
Do not disabled the processing of Secure Neighbor Discovery (SEND).
The following parameters are specific to link aggregate interfaces:
If the interface is a bond pseudo device, associate physical interface iface with it. By default, the bond pseudo device is in LACP
(Link Aggregation Control Protocol) mode (see bondmode below). In this mode, the device conforms to the IEEE 802.3ad Link Aggrega-
If this is the first physical interface to be associated with the bond interface, the bond interface inherits the ethernet address
from the physical interface. Physical interfaces that are added to the bond have their ethernet address re-programmed so that all
members of the bond have the same ethernet address. If the physical interface is subsequently removed from the bond using -bonddev,
a new ethernet address is chosen from the remaining interfaces, and all interfaces are re-programmed again with the new ethernet
address. If no remaining interfaces exist, the bond interface's ethernet address is cleared.
If the specified physical interface iface is not capable of having its ethernet address re-programmed, the bonddev command will fail.
Once the physical interface iface is successfully associated with the bond interface, all received packets are diverted to the bond
interface. The physical interface is no longer useable on its own, and remains that way until it is removed from the bond using
It is possible that the specified interface iface is not capable of aggregating, and may remain unused until the operating conditions
The link status of the bond interface depends on the state of link aggregation. If no active partner is detected, the link status
will remain inactive.
To monitor the 802.3ad Link Aggregation state, use the -b option.
A physical interface that is associated with a vlan pseudo device cannot at the same time be associated with a bond pseudo device. A
physical interface cannot be associated with more than one bond pseudo device at the same time.
It is not possible to associate a bond with pseudo interfaces such as vlan. Only physical ethernet interfaces may be associated with
If the interface is a bond pseudo device, disassociate the physical interface iface from it. Before the interface is removed from
the bond, the bond device announces to the link partner that the interface is now individual and no longer aggregatable. If the
physical iface is the last interface in the bond, the bond interface clears its link address.
bondmode lacp | static
If the interface is a bond pseudo device, this option will set the mode on the bond interface. The two currently supported modes are
lacp and static. The default mode is lacp.
To enable static mode (and turn off LACP), specify static. In static mode, a member interface is made an active part of the link
aggregate as long as the link status is active.
To re-enable LACP mode, specify lacp.
The following parameters are specific to IP tunnel interfaces, gif(4):
tunnel src_addr dest_addr
Configure the physical source and destination address for IP tunnel interfaces. The arguments src_addr and dest_addr are interpreted
as the outer source/destination for the encapsulating IPv4/IPv6 header.
Unconfigure the physical source and destination address for IP tunnel interfaces previously configured with tunnel.
Another name for the -tunnel parameter.
The following parameters are specific to bridge interfaces:
Add the interface named by interface as a member of the bridge. The interface is put into promiscuous mode so that it can receive
every packet sent on the network.
Remove the interface named by interface from the bridge. Promiscuous mode is disabled on the interface when it is removed from the
Set the size of the bridge address cache to size. The default is 100 entries.
Set the timeout of address cache entries to seconds seconds. If seconds is zero, then address cache entries will not be expired.
The default is 240 seconds.
addr Display the addresses that have been learned by the bridge.
static interface-name address
Add a static entry into the address cache pointing to interface-name. Static entries are never aged out of the cache or re-placed,
even if the address is seen on a different interface.
Delete address from the address cache.
flush Delete all dynamically-learned addresses from the address cache.
Delete all addresses, including static addresses, from the address cache.
Mark an interface as a ``discovering'' interface. When the bridge has no address cache entry (either dynamic or static) for the des-
tination address of a packet, the bridge will forward the packet to all member interfaces marked as ``discovering''. This is the
default for all interfaces added to a bridge.
Clear the ``discovering'' attribute on a member interface. For packets without the ``discovering'' attribute, the only packets for-
warded on the interface are broadcast or multicast packets and packets for which the destination address is known to be on the inter-
Mark an interface as a ``learning'' interface. When a packet arrives on such an interface, the source address of the packet is
entered into the address cache as being a destination address on the interface's segment. This is the default for all interfaces
added to a bridge.
Clear the ``learning'' attribute on a member interface.
Enable Spanning Tree protocol on interface. The if_bridge(4) driver has support for the IEEE 802.1D Spanning Tree protocol (STP).
Spanning Tree is used to detect and remove loops in a network topology.
Disable Spanning Tree protocol on interface. This is the default for all interfaces added to a bridge.
Set the time that a Spanning Tree protocol configuration is valid. The default is 20 seconds. The minimum is 6 seconds and the max-
imum is 40 seconds.
Set the time that must pass before an interface begins forwarding packets when Spanning Tree is enabled. The default is 15 seconds.
The minimum is 4 seconds and the maximum is 30 seconds.
Set the time between broadcasting of Spanning Tree protocol configuration messages. The hello time may only be changed when operat-
ing in legacy stp mode. The default is 2 seconds. The minimum is 1 second and the maximum is 2 seconds.
Set the bridge priority for Spanning Tree. The default is 32768. The minimum is 0 and the maximum is 61440.
ifpriority interface value
Set the Spanning Tree priority of interface to value. The default is 128. The minimum is 0 and the maximum is 240.
ifpathcost interface value
Set the Spanning Tree path cost of interface to value. The default is calculated from the link speed. To change a previously
selected path cost back to automatic, set the cost to 0. The minimum is 1 and the maximum is 200000000.
ifmaxaddr interface size
Set the maximum number of hosts allowed from an interface, packets with unknown source addresses are dropped until an existing host
cache entry expires or is removed. Set to 0 to disable.
The following parameters are specific to vlan interfaces:
Set the VLAN tag value to vlan_tag. This value is a 16-bit number which is used to create an 802.1Q VLAN header for packets sent
from the vlan(4) interface. Note that vlan and vlandev must both be set at the same time.
Associate the physical interface iface with a vlan(4) 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 parent
interface with the correct VLAN tag will be diverted to the associated vlan(4) pseudo-interface. The vlan(4) interface is assigned a
copy of the parent interface's flags and the parent's ethernet address. The vlandev and vlan must both be set at the same time. If
the vlan(4) interface already has a physical interface associated with it, this command will fail. To change the association to
another physical interface, the existing association must be cleared first.
Note: if the hardware tagging capability is set on the parent interface, the vlan(4) pseudo interface's behavior changes: the vlan(4)
interface recognizes that the parent interface supports insertion and extraction of VLAN tags on its own (usually in firmware) and
that it should pass packets to and from the parent unaltered.
If the driver is a vlan(4) pseudo device, disassociate the parent interface from it. This breaks the link between the vlan(4) inter-
face and its parent, clears its VLAN tag, flags and its link address and shuts the interface down. The iface argument is useless and
The ifconfig utility displays the current configuration for a network interface when no optional parameters are supplied. If a protocol fam-
ily is specified, ifconfig will report only the details specific to that protocol family.
If the -m flag is passed before an interface name, ifconfig will display the capability list and all of the supported media for the specified
If -L flag is supplied, address lifetime is displayed for IPv6 addresses, as time offset string.
Optionally, the -a flag may be used instead of an interface name. This flag instructs ifconfig to display information about all interfaces
in the system. The -d flag limits this to interfaces that are down, and -u limits this to interfaces that are up. When no arguments are
given, -a is implied.
The -l flag may be used to list all available interfaces on the system, with no other additional information. Use of this flag is mutually
exclusive with all other flags and commands, except for -d (only list interfaces that are down) and -u (only list interfaces that are up).
The -v flag may be used to get more verbose status for an interface.
The -C flag may be used to list all of the interface cloners available on the system, with no additional information. Use of this flag is
mutually exclusive with all other flags and commands.
The -r flag may be used to show additional information related to the count of route references on the network interface.
For bridge interfaces, the list of addresses learned by the bridge is not shown when displaying information about all interfaces except when
the -v flag is used.
Only the super-user may modify the configuration of a network interface.
The media selection system is relatively new and only some drivers support it (or have need for it).
Assign the IPv4 address 192.0.2.10, with a network mask of 255.255.255.0, to the interface en0:
# ifconfig en0 inet 192.0.2.10 netmask 255.255.255.0
Add the IPv4 address 192.0.2.45, with the CIDR network prefix /28, to the interface en0, using add as a synonym for the canonical form of the
# ifconfig en0 inet 192.0.2.45/28 add
Remove the IPv4 address 192.0.2.45 from the interface en0:
# ifconfig en0 inet 192.0.2.45 -alias
Add the IPv6 address 2001:DB8:DBDB::123/48 to the interface en0:
# ifconfig en0 inet6 2001:db8:bdbd::123 prefixlen 48 alias
Note that lower case hexadecimal IPv6 addresses are acceptable.
Remove the IPv6 address added in the above example, using the / character as shorthand for the network prefix, and using delete as a synonym
for the canonical form of the option -alias:
# ifconfig en0 inet6 2001:db8:bdbd::123/48 delete
Configure the interface en1, to use 100baseTX, full duplex Ethernet media options:
# ifconfig en1 media 100baseTX mediaopt full-duplex
Create the software network interface gif1:
# ifconfig gif1 create
Destroy the software network interface gif1:
# ifconfig gif1 destroy
Messages indicating the specified interface does not exist, the requested address is unknown, or the user is not privileged and tried to
alter an interface's configuration.
netstat(1), netintro(4), sysctl(8)
The ifconfig utility appeared in 4.2BSD.
Basic IPv6 node operation requires a link-local address on each interface configured for IPv6. Normally, such an address is automatically
configured by the kernel on each interface added to the system; this behaviour may be disabled by setting the sysctl MIB variable
net.inet6.ip6.auto_linklocal to 0.
If you delete such an address using ifconfig, the kernel may act very odd. Do this at your own risk.
June 20, 2008 BSD