IFCONFIG(8) BSD System Manager's Manual IFCONFIG(8)NAMEifconfig - configure and display network interface parameters
SYNOPSISifconfig-a [-m] [address_family]
ifconfig [-m] interface [address_family]
ifconfig [-mv] interface [address_family] [address parameters] [link
parameters]
DESCRIPTION
Ifconfig is used to assign one or more addresses to a network interface
and/or configure network interface parameters. Ifconfig must be used at
boot time to define the network address of each interface present on a
machine; it may also be used at a later time to redefine the address or
other interface operating parameters.
address_family
Specifies the address family for the addresses being configured,
or the address family for which configured information will be
displayed. The default is inet(4); inet6(4), iso(4) and ns(4)
are also recognized.
interface
Specifies the name of the interface being configured. The inter-
face name is of the form ``name unit'' where name describes the
type of interface and unit identifies a particular instance of
the given type of interface. Information about an interface of
the given name can be found in section four of the manual. For
example, ef0 is the first instance of the ef family of interfaces
as described in ef(4).
Displaying interface configuration
In the first synopsis, ifconfig displays the complete interface configu-
ration for the system. An address_family may be specified to restrict
the output to those parameters related to a specific address family.
If the -m flag is supplied, a list of all possible network media configu-
rations and media options (which may vary by interface) are listed.
In the second synopsis, ifconfig will display the interface configuration
for the given interface. Again, the output may be restricted to a given
address_family if desired.
A special address family, link, is used to describe characteristics of
the physical interface. These characteristics included, in some cases
like Ethernet, a physical (or ``link level'') address. An interface may
also supply detailed media information, including the current media and
options selected as well as the current state of the interface (ie: is it
plugged into an operating network). Not all interfaces support this level
of detailed information, those that do not simply do not include this in-
formation.
Configuring Interface Addresses
The third synopsis is used to change the interface configuration.
Ifconfig may be used to configure both address family specific parameters
and physical interface parameters. If address family specific parameters
are being configured and they are not inet(4) addresses, the
address_family must be specified immediately after the interface is spec-
ified.
Only the super-user may modify the configuration of a network interface.
One flag is available when configuring an interface:
-v The configuration of the interface is displayed after the specified
changes have been made. Output is limited to the link level and the
address family being configured.
There are five operations that can be used to configure addresses on an
interface; add, modify, remove, -remove and set. Only one operation can
be performed per invocation of ifconfig. When only one address per ad-
dress family is configured on an interface, the -remove and set opera-
tions may be used.
For compatibility, if an address is specified without an operation, set
is assumed. If address parameters (destination address, broadcast
address and nsellength) are specified with neither an operation nor an
address, an operation of modify is assumed. Some address families
(namely inet6) do not support this compatibility.
-remove
If only one address is configured for the specified address fami-
ly, that address is removed.
[set] address
The specified address is configured as the only address in this
address family on the interface. If only one address is config-
ured on the interface, it is replaced by the specified address.
When multiple addresses per address family are configured on an interface
it is necessary to use the add, modify and remove operations:
add address
The specified address is to be added to the list of addresses
configured on the interface. The specified address must not al-
ready exist.
modify address
The parameters (destination address, broadcast address, netmask
and nsellength as appropriate for the address family) of the
specified address will be changed.
remove address
The specified address is removed from the list of addresses con-
figured on the interface. No other address parameters need be
specified.
For compatibility the alias, -alias and delete parameters are recognized,
but their use is discouraged.
The following address configuration parameters can also be configured:
[destination] address
The specified address is configured as the destination of the in-
terface. This only applies to point-to-point interfaces, i.e.
those that have the POINTOPOINT flag set. The destination key-
word is optional for compatibility reason, it's use is encour-
aged.
netmask mask
(inet and iso) 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 netmask is not
used for packet forwarding on point-to-point and loopback inter-
faces, it only provides information for routing daemons. When
not specified, a default is chosen.
Internet IPv4 Address Parameters
For the internet family (see inet(4)), the address is either a host name
present in the host name data base (see hosts(5)), the distributed do-
main name database (see gethostbyname(3) and resolver(3)) or an internet
IPv4 address expressed in the Internet standard ``dot notation''.
The mask can be specified as a single hexadecimal number with a leading
0x, as a dot-notation internet address, or as a pseudo-network name list-
ed in the network table networks(5) or in the Domain Name System. 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.
A shorthand notation is available for setting the address and netmask:
address/mask_length, where mask_length is the number of contiguous one
bits in the network mask. A value of 8 is equivalent to a class A net-
work mask (255.0.0.0), 16 is the equivalent of a class B network mask
(255.255.0.0) and 24 is the equivalent of a class C network mask
(255.255.255.0).
The following parameters only apply to the inet(4) address family:
broadcast address
The specified address is configured as the broadcast address of
the interface. This parameter is only applicable to broadcast
interfaces, i.e. those that have the BROADCAST flag set. If not
specified, a default broadcast address is the interface address
with a host part of all ones. For example, 10.1.1.3/24 will
yield a broadcast address of 10.1.1.255.
Internet IPv6 Address Parameters
For the internet family (see inet6(4)), the address is either a host
name present in the host name data base (see hosts(5)), the distributed
domain name database (see gethostbyname(3) and resolver(3)) or an IPv6
address express specified as a hexadecimal string with colons as separa-
tors. Duplicate address detection is always performed by the kernel, and
verified by the ifconfig command.
The mask is specified using the same shorthand notation available for
setting the address and netmask with IPv4 addresses: address/mask_length,
where mask_length is the number of contiguous one bits in the network
mask.
In addition to the parameters for inet(4) address, the following parame-
ters only apply to the inet6(4) address family:
prefixlen
scopeid
anycast
-anycast
autoconf
-autoconf
tentative
-tentative
pltime
vltime
ISO Address Parameters
For the iso(4) family, addresses are specified as a long hexadecimal
string, as in the Xerox family. However, two consecutive dots imply a
zero byte, and the dots are optional, if the user wishes to (carefully)
count out long strings of digits in network byte order.
The following parameters only apply to the ISO address family:
nsellength length
This specifies a trailing number of bytes for a received NSAP
used for local identification, the remaining leading part of
which is taken to be the NET (Network Entity Title). The default
value is 1, which conforms to US GOSIP. When an iso address is
set in an ifconfig command, it is really the NSAP which is being
specified. For example, in US GOSIP, 20 hex digits should be
specified in the iso NSAP to be assigned to the interface. There
is some evidence that a number different from 1 may be useful for
AFI 37 type addresses.
Ethernet and IEEE 802.11 Address Parameters
For ethernet and IEEE 802.11 Wireless LAN devices that support the set-
ting of the link level address (MAC Address), the following parameter is
available:
linkaddr address
This specifies the ethernet address for the interface for devices
that support the setting of the ethernet address. It is speci-
fied as a series of 6 8 bit hexadecimal numbers separated by
colons (i.e., 01:02:03:04:05:06).
XNS Address Parameters
For the Xerox Network Systems(tm) (see ns(4)) family, addresses are
net:a.b.c.d.e.f, where net is the assigned network number (in decimal),
and each of the six bytes of the host number, a through f, are specified
in hexadecimal. The host number may be omitted on Ethernet interfaces,
which use the hardware physical address, and on interfaces other than the
first.
The following parameter only applies to NS address family:
ipdst address
This is used to specify an internet host who is willing to re-
ceive NS packets encapsulated in IP packets bound for a remote
network. An apparent point-to-point link is constructed, and the
address specified will be taken as the NS address and network of
the destination.
Configuring AIF Parameters
Ifconfig is used to configure Aggregating Interfaces (AIF).
[-]aif aif-interface
Attach (detach) an interface to (from) an aggregating interface.
The following parameters only apply to AIF interfaces.
[-]aifaddr inet-address
This parameter is used in conjunction with aifether, aifif, or
aifvid, and is used to either add or delete an address mapping.
aifether ethernet-address
Specify an inet-address to ethernet-address mapping. Packets
will not be sent until at least on packet has been received with
an ethernet-address source address, so the inet-address to
interface mapping can be established.
aifif interface
Specify an inet-address to interface mapping.
-aifif interface
Remove all mappings for interface. (This also happens automati-
cally when interface is detached from using the -aif parameter).
aifvid vlan-id
Specify an inet-address to vlan-id mapping. This will fail if
there is more than one vlan with vlan-id attached to this AIF.
aifflags option,option,option,...
Enable or disable AIF flags on an interface. Valid options are:
roaming Allow hosts to roam between attached interfaces. Nor-
mally once a host is associated with a particular in-
terface, any packets from that host arriving on a dif-
ferent interface will be ignored. When the roaming
flag is set, if packets arrive on a different inter-
face, the mapping for that host will be updated to
point to the new interface.
-roaming Turn off the roaming flag.
arpok Allow ARP requests from unknown hosts. Normally when
ARP packets are received for a host for which an ad-
dress mapping does not exist, the packet is dropped.
When the arpok flag is set, ARP requests from unknown
hosts will be processed.
-arpok Turn off the arpok flag.
default Set all flags to their default value (all flags off.)
0xNNNN Specifies the entire flags field as a numeric value.
aifmap The aifmap command prints out the address mappings for all AIF
interfaces. The protocol address, interface name, and hardware
address are printed for each entry.
Configuring Non-Address Interface Parameters
Ifconfig is also used to configure interface parameters. These parame-
ters are used to configure the hardware and/or protocol independent at-
tributes of the interface. These parameters are:
debug Enable driver dependent debugging code; usually, this turns on
extra console error logging.
-debug Disable driver dependent debugging code.
down Mark an interface ``down''. When an interface is marked ``down'',
the system will not attempt to transmit messages through that in-
terface. If possible, the interface will be reset to disable re-
ception as well. This action does not automatically disable
routes using the interface.
[-]link[0-2]
Used by some interfaces to select debug or other options. Some
interfaces use link flags to select media options, however this
such usage deprecated in favor of the media selection method de-
scribed below. See the manual page for the specific network in-
terface in manual section four for more information.
linktype type
Set the link level protocol of the physical interface to be type.
More common types are ppp, chdlc, and frelay. Generally, only
point-to-point interfaces support setting the link type; the ex-
ception is interfaces that can run as either token_ring or ether.
Some types understood by ifconfig may not be compiled into or un-
derstood by the kernel.
media option,option,option,...
Specifies a comma separated list of media options as described
below.
metric metric
Set the routing metric of the interface to metric, the default is
0. The routing metric is used by the routing daemons (routed(8)
and gated(8)). Higher metrics have the effect of making a route
less favorable; metrics are counted as addition hops to the des-
tination network or host.
mtu mtu
Set the maximum transmission unit (mtu) of the interface to mtu.
Not all interfaces allow the mtu to be modified, and those that
do may have limitations on what range of values is valid. Note
that this only changes the mtu associated with the interface, not
the mtu in any routes pointing at that interface. Thus, the mtu
should be set before assigning the address to the interface, or
the interface address should be reassigned after changing the
mtu.
[-]pif pif-interface
Attach (detach) an interface to (from) a parallel interface.
pifflags option,option,option,...
This option only applies to parallel interfaces, and is a comma
separated list of options as described below.
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.
vid Specify the VLAN id to be used for a vlan(4) interface. If spec-
ified without vparent only the VLAN ID will be changed.
vparent parent_if
Specifies the physical interface (parent) to use for a vlan(4)
interface. If vid is not also specified the default (id 1) will
be used. If the vlan(4) interface is already configured with a
parent, it will be unconfigured and reconfigured with the speci-
fied parent.
-vparent
Specifies that the vlan(4) interface should be detached from it's
physical (parent) interface.
The arp, -arp, trailers and -trailers parameters no longer change the in-
terface configuration, instead a warning message is generated. It is no
longer possible to disable the Address Resolution Protocol on interfaces
that require it and packets using trailer encapsulation can still be re-
ceived, but no longer generated.
Selecting media and related options
Broadcast media (currently Ethernet, IEEE802.11, FDDI, and Token Ring)
support a driver independent method of selecting media and media related
options via ifconfig. The currently selected media configuration is al-
ways displayed. In some cases (such as a media configuration of auto)
the actual configuration is displayed in parentheses. The carrier de-
tect, or in-ring, status is also displayed if available.
A given interface exports a list of valid media options which can be enu-
merated with the -m flag. In the resulting display global options (if
any) and a list of supported combinations of media flags are displayed.
Only the given combinations of media flags (as modified by the listed op-
tions) are valid for an interface. Attempting to set media or options
that are not valid for a particular interface results in an error.
Media options are manipulated in much the same manner as tty settings via
the stty(1) program: the current settings are first read from the inter-
face, user changes are applied, then the settings are written back to the
interface. Flags are turned on by naming them, and off by naming them
with a leading hyphen (-). Case is not significant in keyword recogni-
tion. In many cases several aliases for the same parameter exist.
Keep in mind that not all the following keywords will be available, gen-
erally only a small subset are available on a given interface.
Keywords used for Ethernet interfaces:
aui, 10base5
Select the DB15 AUI connector.
bnc, 10base2
Selects 10base2 media (sometimes called Thinnet or Cheapernet).
10baseT, utp
Select unshielded twisted pair media.
10baseFL, fl
Select 10 Mbit Ethernet over multimode fiber.
100baseTX, tx
Select 100 Mbit Ethernet over 2 category 5 cable pairs, this is
the most common form of 100 Mbit Ethernet.
100baseFX, fx
Select 100 Mbit Ethernet over multimode fiber.
100baseT4, t4
Select 100 Mbit Ethernet over 4 pair category 3 cable.
100baseT2, t2
Select 100 Mbit T2 standard.
100VgAnyLAN, vg, anylan
Select 100 Mbit over 4 pair category 3 cable (an alternate stan-
dard).
1000baseX
Select 1000 Mbit over fiber (and STP).
1000baseT
Select 1000 Mbit over copper.
IEEE802.11 ((Wireless LAN)) interfaces support the following media and
options:
auto Automatically determine best available data rate.
1Mb 1Mb data rate.
2Mb 2Mb data rate.
5.5Mb 5.5Mb data rate.
11Mb 11Mb data rate.
ibss, ad-hoc
Operate in IBSS (Independent Basic Service Set) mode, that is,
without a base station or access point.
ess, infrastructure
Operate in ESS (Extended Service Set), that is, with a base sta-
tion or access point.
authmode
Set the authentication mode to one of none, open, shared, or
encrypted.
wep Turn on Wire Equivalency Protocol.
-wep Turn off Wire Equivalency Protocol.
wepkey key
Set the Wire Equivalency Protocol key. The key typically should
be either 40 or 102 bytes long. (128 bit WEP keys are specified
with 102 bits.) The key is either presented in hexadecimal by
preceeding 10 or 26 digits with 0x. If the key is does not start
with 0x then it should be 5 or 13 bytes representing the actual
key. Setting the key to a dash (-) clears the key. 802.11 spec-
ifies there are 4 keys. By default key number 0 is set. Other
keys may be set by preceeding the key with the key number fol-
lowed by a colon (i.e., 1:0x1234567890). Some cards have multiple
sets of keys. In general, the first 4 keys are the ones normally
used. If a card has both volatile and non-volatile key storage
then the first 4 keys should be volatile and the second 4 keys
(keys 4 - 7) are the non-volatile versions.
wektxkey index
Use WEP key number index as the transmit key.
station name
Sets the station name to name.
ssid name
Sets the desired Service Set Identifier to ssid.
channel number
Set the channel to number. The channel number that you are autho-
rized to use is dependent on your geographic location. Some
cards may only allow you to set the channel when in ad-hoc mode.
Token ring (IEEE802.5) interfaces support the following media and op-
tions:
utp16 Select unshielded twisted pair media (RJ454) at 16 Mbit ring
speed.
utp4 Select unshielded twisted pair media (RJ454) at 4 Mbit ring
speed.
stp16 Select shielded twisted pair media (DB9) at 16 Mbit ring speed.
stp4 Select shielded twisted pair media (DB9) at 4 Mbit ring speed.
early_token_release, early, etr, -early_token_release, -early, -etr
Enable/disable early token release feature, this increases per-
formance on 16 Mbit Token Ring networks for adapters which sup-
port the option.
source_route, srt, -source_route, -srt
Enable/disable source route bridging with IP, this causes the ARP
protocol to transmit discovery requests across source route
bridges.
all_broadcast, allbc, -all_broadcast, -allbc
Enable/disable all rings broadcast on source routed networks.
This causes ARP (and other broadcasts) to be sent as 'all-routes'
instead of certain routers (as configured at the router) copy
single-route broadcasts.
mulcast_functional_address, mfa, -mulcast_functional_address, -mfa
If enabled, use RFC1469 functional address to transmit multicast
packets. If disabled, send multicast packets using the token
ring broadcast address.
FDDI interfaces support the following media and options:
multimode, fiber, mmf
Select FDDI over multi-mode fiber.
singlemode, smf
Select FDDI over single mode fiber.
utp, cddi
Select FDDI over category 5 twisted pair cabling.
dual_attach, dual, da, -dual_attach, -dual, -da
Enable/disable dual attach feature (dual counter rotating rings);
with this option cleared single attach mode is selected. This is
intended for diagnostics and debugging.
The following selections and options can apply to any type of media:
auto, automedia
This option causes the interface to automatically select an ap-
propriate media type (either the currently active one or one it
considers best if multiple are possible). Some interfaces only
determine their media automatically when the option is initially
set, for these it may be necessary to configure the interface
down then back up again when media is changed.
disc, nomedia
Disconnects the interface from its media completely (sometimes
referred to as isolating the interface).
manual Selects the media configured by manual means (jumpers, dip
switches, DOS configuration utilities, etc...). Many older inter-
face drivers advertise manual mode since it is not possible for
the driver to determine what type of media is supported by the
card.
full_duplex, fdx, -full_duplex, -fdx
This flag forces full duplex operation. Note that it is possible
for an interface to be running in full duplex mode without this
flag set if the interface supports automatic negotiation of full
duplex mode.
half_duplex, hdx, -half_duplex, -hdx
This flag forces half duplex mode, it is mutually exclusive with
the full duplex flag. As with full duplex, some interfaces may
automatically negotiate half duplex mode (or run only in that
mode); this flag is typically advertised by an interface to allow
automatic negotiation of full duplex mode to be overridden.
loopback, -loopback
Forces outgoing network data to be looped back at the hardware
level (usually in the ENDEC). Used for diagnosis and debugging.
flag0, flag1, flag2, -flag0, -flag1, -flag2
Used for debugging or driver specific options, see the section 4
man page on specific device drivers for details on the usage of
these flags (note: most interfaces do not use these flags).
instn, instancen
Selects a given instance of a media type. Some interfaces may
have multiple media interfaces that are identical in terms of the
flags and options above, this keyword allows instances of these
interfaces to be differentiated. An example would be an Ethernet
chip with an internal ENDEC and an external MII based PHY: both
might advertise themselves to the driver as a 10baseT physical
interface. Most interfaces have only one instance (inst0).
rx_flow, tx_flow, -rx_flow, -tx_flow
Enable/disable 802.3x/802.3z flow control support on receiver and
transmitter, respectively.
Interfaces may report media status to ifconfig when it is called to print
link level status. If direct status of the media is possible an addition-
al keyword (dependent on the media type) is printed. Ethernet interfaces
may report 'active' or 'no-carrier', Token Ring and FDDI interfaces re-
port 'inserted' or 'no-ring'.
Parallel Interface related options
Parallel interfaces are logical interfaces, not associated with any par-
ticular physical interface. They are used to link several physical in-
terfaces into a single logical interface. A parallel interface has a
name of pif, such as pif0. Physical interfaces may be manually linked to
a logical interface using the pif pif-interface command. This should on-
ly be used for link types other than ppp, such as a chdlc, or frelay. To
link multiple physical PPP interfaces together, the PPP Multilink Proto-
col should be used. The ppp(8) command automatically takes care of allo-
cating a pif interface.
The pifflags option can be used to set parallel interface specific flags.
Currently, it is only used to specify one of four methods of selecting
which interface should be used to output any given packet. The values
for this option are:
first-idle
Use the first idle interface for output.
first-up
Use the first interface that is up for output.
next-idle
Use a round-robin technique to find the next idle interface for
output.
next-up
Use a round-robin technique to find the next interface for out-
put.
default
Sets the flags to their default value. (Currently this is the
same as next-idle)
0xNNNN Specifies the entire flags field as a numeric value.
EXAMPLESifconfig-a
Display the interface configuration for all address family param-
eters on all configured interfaces.
ifconfig-a inet
Display the interface configuration for all inet(4) addresses on
all configured interfaces.
ifconfig ef0
Display all address family parameters on interface ef0
ifconfig-m ef0
Display all available media sections on interface ef0.
ifconfig ef0 media 100basetx,full_duplex
Set full duplex 100 Mbit operation on interface ef0.
ifconfig tl0 media instance1,100basetx,full_duplex
Set full duplex 100 Mbit operation on the second physical inter-
face on an interface card with an MII bus.
ifconfig le0 inet
Display on the the inet(4) addresses configured on le0.
ifconfig ef0 set 10.2.3.4/26
Assign the inet(4) address of 10.2.3.4 with a network mask of
255.255.255.192 to ef0. If ef0 is a BROADCAST interface, the
broadcast address will default to 10.2.3.191.
ifconfig ef0 add 10.1.1.1 netmask 255.255.255.0
Add the additional inet(4) address of 10.1.1.1 with a network
mask of 255.255.255.0 to ef0.
ifconfig ef0 remove 10.2.3.4
Remove the previously configured inet(4) address of 10.2.3.4 from
interface ef0.
ifconfig ntwo0 linktype ppp
Configure the ntwo0 interface to use the ppp(4) protocol.
ifconfig ntwo0 down
Disable the ntwo0 interface from sending packets.
ifconfig ntwo0 pif pif0 up
ifconfig ntwo1 pif pif0 up
Link the ntwo0 and ntwo1 interfaces to pif0 and mark them as up.
The assignment of an address would then be done using the pif0
interface, not the individual ntwo0 and ntwo1 interfaces.
ifconfig exp0 up
ifconfig vlan0 10.0.0.254/24 vparent exp0 vid 2
ifconfig vlan1 10.0.1.254/24 vparent exp0 vid 3
Configure exp0 as vlan trunk, and vlan0 as virtual interface to
VLAN 2, and vlan1 for VLAN 3, respectively.
ifconfig vlan0 -remove -vparent
Unconfigure vlan0 and remove its address.
ifconfig lo0 set localhost
Configure the loopback interface with the symbolic name for the
loopback host.
ifconfig lo0 add pophost
Add an alias on the loopback interface using a symbolic name.
ifconfig vlan0 vparent ne0 vid 1
ifconfig vlan0 aif aif0 up
ifconfig aif0 10.0.0.2/24
ifconfig aif0 aifaddr 10.0.0.1 aifif vlan0
ifconfig aif0 aifaddr 10.0.0.3 aifvid 1
ifconfig aif0 aifaddr 10.0.0.5 aifether 0:90:27:37:16:75
Configure ne0 as vlan trunk, and vlan0 as virtual interface to
VLAN 1. Attach vlan0 to aif0. Assign 10.0.0.2/24 to aif0. Three
specific mappings are then set up; 10.0.0.1 is assigned to vlan0,
10.0.0.3 is assigned to VLAN 1, which the kernel maps to vlan0,
and 10.0.0.5 is assigned to the ethernet address
0:90:27:37:16:75. When a packet is received from that host (on
vlan0), 10.0.0.5 will be mapped to the interface on which it was
received (vlan0).
DIAGNOSTICS
Messages indicating the specified interface does not exit, the requested
address is unknown, or the user is not privileged and tried to alter an
interface's configuration.
SEE ALSOnetstat(1), arp(4), inet(4), iso(4), netintro(4), ns(4), pif(4),
ppp(4), vlan(4), ppp.sys(5), gated(8), rc(8), route(8), routed(8)HISTORY
The ifconfig command appeared in 4.2BSD.
4.4BSD June 25, 1994 12