wireless-tools/ifrename.8

192 lines
5.2 KiB
Groff
Raw Normal View History

2022-05-14 03:18:37 +08:00
.\" Jean II - HPL - 2004-2007
.\" ifrename.8
.\"
.TH IFRENAME 8 "26 February 2007" "wireless-tools" "Linux Programmer's Manual"
.\"
.\" NAME part
.\"
.SH NAME
ifrename \- rename network interfaces based on various static criteria
.\"
.\" SYNOPSIS part
.\"
.SH SYNOPSIS
.B "ifrename [-c configfile] [-p] [-d] [-u] [-v] [-V] [-D] [-C]"
.br
.B "ifrename [-c configfile] [-i interface] [-n newname]"
.\"
.\" DESCRIPTION part
.\"
.SH DESCRIPTION
.B Ifrename
is a tool allowing you to assign a consistent name to each of your
network interface.
.PP
By default, interface names are dynamic, and each network interface is
assigned the first available name
.RI ( eth0 ", " eth1 "...)."
The order network interfaces are created may vary. For built-in
interfaces, the kernel boot time enumeration may vary. For removable
interface, the user may plug them in any order.
.PP
.B Ifrename
allow the user to decide what name a network interface will have.
.B Ifrename
can use a variety of
.I selectors
to specify how interface names match the network interfaces on the
system, the most common selector is the interface
.IR "MAC address" .
.PP
.B Ifrename
must be run before interfaces are brought up, which is why it's mostly
useful in various scripts (init, hotplug) but is seldom used directly
by the user. By default,
.B ifrename
renames all present system interfaces using mappings defined in
.IR /etc/iftab .
.\"
.\" PARAMETER part
.\"
.SH PARAMETERS
.TP
.BI "-c " configfile
Set the configuration file to be used (by default
.IR /etc/iftab ).
The configuration file define the mapping between selectors and
interface names, and is described in
.IR iftab (5).
.br
If
.I configfile
is "-", the configuration is read from stdin.
.TP
.B -p
Probe (load) kernel modules before renaming interfaces. By default
.B ifrename
only check interfaces already loaded, and doesn't auto-load the
required kernel modules. This option enables smooth integration with
system not loading modules before calling
.BR ifrename .
.TP
.B -d
Enable various
.B Debian
specific hacks. Combined with
.BR -p ,
only modules for interfaces specified in
.I /etc/network/interface
are loaded.
.TP
.BI "-i " interface
Only rename the specified
.I interface
as opposed to all interfaces on the system. The new interface name is
printed.
.TP
.BI "-n " newname
When used with
.IR -i ,
specify the new name of the interface. The list of mappings from the
configuration file is bypassed, the interface specified with
.I -i
is renamed directly to
.IR newname .
The new name may be a wildcard containing a single '*'.
.br
When used without
.IR -i ,
rename interfaces by using only mappings that would rename them to
.IR newname .
The new name may not be a wildcard. This use of ifrename is
discouraged, because inefficient
.RI ( -n " without " -i ).
All the interfaces of the system need to be processed at each
invocation, therefore in most case it is not faster than just letting
ifrename renaming all of them (without both
.IR -n " and " -i ).
.TP
.B -t
Enable name takeover support. This allow interface name swapping
between two or more interfaces.
.br
Takeover enable an interface to 'steal' the name of another
interface. This works only with kernel 2.6.X and if the other
interface is down. Consequently, this is not compatible with
Hotplug. The other interface is assigned a random name, but may be
renamed later with 'ifrename'.
.br
The number of takeovers is limited to avoid circular loops, and
therefore some complex multi-way name swapping situations may not be
fully processed.
.br
In any case, name swapping and the use of this feature is discouraged,
and you are invited to choose unique and unambiguous names for your
interfaces...
.TP
.B -u
Enable
.I udev
output mode. This enables proper integration of
.B ifrename
in the
.I udev
framework,
.BR udevd (8)
will use
.B ifrename
to assign interface names present in
.IR /etc/iftab .
In this mode the output of ifrename can be parsed
directly by
.BR udevd (8)
as an IMPORT action. This requires
.I udev
version 107 or later.
.TP
.B -D
Dry-run mode. Ifrename won't change any interface, it will only print
new interface name, if applicable, and return.
.br
In dry-run mode, interface name wildcards are not resolved. New
interface name is printed, even if it is the same as the old name.
.br
Be also aware that some selectors can only be read by root, for
example those based on
.BR ethtool ),
and will fail silently if run by a normal user. In other words,
dry-run mode under a standard user may not give the expected result.
.TP
.B -V
Verbose mode. Ifrename will display internal results of parsing its
configuration file and querying the interfaces selectors. Combined
with the
.I dry-run
option, this is a good way to debug complex configurations or trivial
problems.
.TP
.B -C
Count matching interfaces. Display the number of interface matched,
and return it as the exit status of ifrename.
.br
The number of interfaces matched is the number of interface on the
system for which a mapping was found in the config file (which is
different from the number of interface renamed).
.\"
.\" AUTHOR part
.\"
.SH AUTHOR
Jean Tourrilhes \- jt@hpl.hp.com
.\"
.\" FILES part
.\"
.SH FILES
.I /etc/iftab
.\"
.\" SEE ALSO part
.\"
.SH SEE ALSO
.BR ifconfig (8),
.BR ip (8),
.BR iftab (5).