Next: , Previous: , Up: GNU Inetutils   [Contents][Index]


5 ifconfig: Configure network interfaces

ifconfig is a program to retrieve and to set selected properties of network interfaces. It is best viewed as a tool to get information, rather than for changing the behaviour of adapters, since it is hard to support property setting in a portable manner.

Synopsis:

ifconfig iface [arg…]
ifconfig -i iface [option…] [-i iface2 [option…]]

5.1 Command line options

-a
--all

Display all available interfaces, including those that not are marked as ‘up’, i.e., also the inactive interfaces.

-A addr
--address=addr

Set address of selected interface to addr.

-b addr
-B addr
--brdaddr=addr
--broadcast=addr

Set broadcast address of selected interface to addr.

-d addr
-p addr
--dstaddr=addr
--peer=addr

Set destination (peer) address of selected interface.

--down

Deactivate the selected interface.

-F list
--flags=list

Change those interface flags mentioned in list. The argument is a comma separated list of one ore more flag names to be set, or in case the name is prepended with ‘no’, the corresponding flag is cleared. The output of ifconfig with the option --help contains a list of available flag names.

--format=format

Select output format; the value ‘help’ prints a list of all available formats.

-i name
--interface=name

Select the named interface for any following action.

-l
--list

List, with name only, all available interfaces, or only those selected should at least one option -i have specified.

-m mask
--netmask=mask

Set netmask of selected interface to mask.

--metric=n

Set the metric of selected interface to the number n.

-M n
--mtu=n

Set MTU of selected interface to the number n.

-s
--short

Use short output format. This is identical to specifying ‘--format=netstat’.

--up

Activate the selected interface.

-v
--verbose

Print informational messages when configuring an interface.

Observe that the use of program options is the only manner in which ifconfig is able to handle multiple interfaces in one invocation. Once a particular interface has been selected using -i, it is affected by any following option until replaced by another interface selector. This is also the main cause, that ifconfig is unable to treat options independently of their order, as is mostly the case in other GNU software.

5.2 Formatted status output

The status of one or more interfaces can be presented in a number of different formats. A list of them is printed by the option --format=help. In the following table the valid formats are given, each is used in the form --format=name.

check
check-existence
?

Place holders for the ability to check whether the interfaces selected by one or more options -i are determining existing interfaces in the running system. No output in case of success, an error message in case of a failure.

gnu
default

Standard GNU output format.

gnu-one-entry

Like the previous format, but with intermediary newlines removed.

help

Display a list of valid formats, together with a short description for each choice.

net-tools

Imitation of presentation used by the implementation in ‘net-tools’. Default format for GNU/Linux.

netstat

Terse output with statistics, similar to that of netstat -i.

osf

Format variant of ‘unix’ preferred by OSF’s implementation.

unix

Traditional UNIX type format. Default for BSD, HPUX and Solaris.

5.3 Legacy syntax

The traditional mode of invoking ifconfig is via a parsed command line, without all use of program switches and options, relying fully on argument parsing. This mode of use is supported also in the present implementation, but keep in mind that only one interface can be manipulated using this legacy syntax.

ifconfig NAME [ADDR [DSTADDR]] [broadcast BRDADDR] [netmask MASK]
         [metric N] [mtu N] [up|down]

As is conventional, only the primary address and possibly the peer destination address are stated as bare arguments, without a specifying keyword. Some slight variation on this syntax will depend on the target system for which the program is being built, as not all platforms support identical abilities. The best information is found via the usage massage ‘ifconfig --usage’.


Next: logger: Send messages to system log, Previous: hostname: Show or set system host name., Up: GNU Inetutils   [Contents][Index]