systemd.link.xml revision 5256e00e8b9015dd1a976d647fc71dc7efbd8cf8
2818N/A<?xml version='1.0'?> <!--*-nxml-*-->
2818N/A<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
2818N/A<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2818N/A "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
2818N/A
2818N/A<!--
2818N/A This file is part of systemd.
2818N/A
2818N/A Copyright 2014 Tom Gundersen
2818N/A
2818N/A systemd is free software; you can redistribute it and/or modify it
2818N/A under the terms of the GNU Lesser General Public License as published by
2818N/A the Free Software Foundation; either version 2.1 of the License, or
2818N/A (at your option) any later version.
2818N/A
2818N/A systemd is distributed in the hope that it will be useful, but
2818N/A WITHOUT ANY WARRANTY; without even the implied warranty of
2818N/A MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2818N/A Lesser General Public License for more details.
2818N/A
2818N/A You should have received a copy of the GNU Lesser General Public License
2818N/A along with systemd; If not, see <http://www.gnu.org/licenses/>.
5466N/A-->
2818N/A
2818N/A<refentry id="systemd.link">
2818N/A <refentryinfo>
2818N/A <title>systemd.link</title>
5227N/A <productname>systemd</productname>
2818N/A
2818N/A <authorgroup>
2818N/A <author>
2818N/A <contrib>Developer</contrib>
5227N/A <firstname>Tom</firstname>
2818N/A <surname>Gundersen</surname>
3869N/A </author>
2818N/A </authorgroup>
2818N/A </refentryinfo>
5227N/A
2899N/A <refmeta>
3817N/A <refentrytitle>systemd.link</refentrytitle>
3817N/A <manvolnum>5</manvolnum>
3817N/A </refmeta>
3817N/A
2818N/A <refnamediv>
2818N/A <refname>systemd.link</refname>
2818N/A <refpurpose>Network device configuration</refpurpose>
2818N/A </refnamediv>
2818N/A
2818N/A <refsynopsisdiv>
2818N/A <para><filename><replaceable>link</replaceable>.link</filename></para>
4976N/A </refsynopsisdiv>
2818N/A
2818N/A <refsect1>
2818N/A <title>Description</title>
2818N/A
2818N/A <para>Network link configuration is performed by the
2818N/A <command>net_setup_link</command> udev builtin.</para>
2818N/A
2818N/A <para>The link files are read from the files located in the system
2818N/A network directory <filename>/usr/lib/systemd/network</filename>,
2818N/A the volatile runtime network directory
2818N/A <filename>/run/systemd/network</filename>, and the local
2818N/A administration network directory
2818N/A <filename>/etc/systemd/network</filename>. Link files must have
2818N/A the extension <filename>.link</filename>; other extensions are
2818N/A ignored. All link files are collectively sorted and processed in
2818N/A lexical order, regardless of the directories in which they live.
2818N/A However, files with identical filenames replace each other. Files
2818N/A in <filename>/etc</filename> have the highest priority, files in
2818N/A <filename>/run</filename> take precedence over files with the same
2818N/A name in <filename>/usr/lib</filename>. This can be used to
2818N/A override a system-supplied link file with a local file if needed;
2818N/A a symlink in <filename>/etc</filename> with the same name as a
2818N/A link file in <filename>/usr/lib</filename>, pointing to
2818N/A <filename>/dev/null</filename>, disables the link file
2818N/A entirely.</para>
2818N/A
4302N/A <para>The link file contains a <literal>[Match]</literal> section,
4302N/A which determines if a given link file may be applied to a given
5934N/A device, as well as a <literal>[Link]</literal> section specifying
5934N/A how the device should be configured. The first (in lexical order)
5934N/A of the link files that matches a given device is applied. Note
5934N/A that a default file <filename>99-default.link</filename> is
4302N/A shipped by the system, any user-supplied
4302N/A <filename>.link</filename> should hence have a lexically earlier
3633N/A name to be considered at all.</para>
3633N/A </refsect1>
3633N/A
2818N/A <refsect1>
2818N/A <title>[Match] Section Options</title>
2818N/A
2818N/A <para>A link file is said to match a device if each of the entries
2818N/A in the <literal>[Match]</literal> section matches, or if the
2818N/A section is empty. The following keys are accepted:</para>
2818N/A
2818N/A <variablelist class='network-directives'>
2818N/A <varlistentry>
2818N/A <term><varname>MACAddress=</varname></term>
2818N/A <listitem>
2818N/A <para>The hardware address.</para>
2818N/A </listitem>
2818N/A </varlistentry>
2818N/A <varlistentry>
3693N/A <term><varname>OriginalName=</varname></term>
3693N/A <listitem>
3693N/A <para>A whitespace-separated list of shell-style globs matching
3693N/A the device name, as exposed by the udev property
3693N/A "INTERFACE". This can not be used to match on names that have
3693N/A already been changed from userspace. Caution is advised when matching on
3693N/A kernel-assigned names, as they are known to be unstable
2818N/A between reboots.</para>
2818N/A </listitem>
2818N/A </varlistentry>
2818N/A <varlistentry>
2818N/A <term><varname>Path=</varname></term>
2818N/A <listitem>
2818N/A <para>A whitespace-separated list of shell-style globs matching
2818N/A the persistent path, as exposed by the udev property
3251N/A <literal>ID_PATH</literal>.</para>
2818N/A </listitem>
2818N/A </varlistentry>
2818N/A <varlistentry>
2818N/A <term><varname>Driver=</varname></term>
2818N/A <listitem>
2818N/A <para>A whitespace-separated list of shell-style globs matching
2818N/A the driver currently bound to the device,
2818N/A as exposed by the udev property <literal>DRIVER</literal>
3693N/A of its parent device, or if that is not set, the
2818N/A driver as exposed by <literal>ethtool -i</literal>
2818N/A of the device itself.</para>
2818N/A </listitem>
2818N/A </varlistentry>
2818N/A <varlistentry>
2818N/A <term><varname>Type=</varname></term>
2818N/A <listitem>
2818N/A <para>A whitespace-separated list of shell-style globs matching
2818N/A the device type, as exposed by the udev
2818N/A property <literal>DEVTYPE</literal>.</para>
3497N/A </listitem>
3497N/A </varlistentry>
3497N/A <varlistentry>
3497N/A <term><varname>Host=</varname></term>
3497N/A <listitem>
3497N/A <para>Matches against the hostname or machine
3497N/A ID of the host. See <literal>ConditionHost=</literal> in
3497N/A <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
3497N/A for details.</para>
3497N/A </listitem>
3497N/A </varlistentry>
3497N/A <varlistentry>
3497N/A <term><varname>Virtualization=</varname></term>
3497N/A <listitem>
3693N/A <para>Checks whether the system is executed in
3497N/A a virtualized environment and optionally test
3497N/A whether it is a specific implementation. See
4828N/A <literal>ConditionVirtualization=</literal> in
4828N/A <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
3497N/A for details.</para>
3497N/A </listitem>
3497N/A </varlistentry>
3497N/A <varlistentry>
4828N/A <term><varname>KernelCommandLine=</varname></term>
4828N/A <listitem>
3497N/A <para>Checks whether a specific kernel command line option
2818N/A is set (or if prefixed with the exclamation mark unset). See
3477N/A <literal>ConditionKernelCommandLine=</literal> in
2818N/A <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
2818N/A for details.</para>
2818N/A </listitem>
2818N/A </varlistentry>
2818N/A <varlistentry>
2818N/A <term><varname>Architecture=</varname></term>
2818N/A <listitem>
2818N/A <para>Checks whether the system is running on a specific
2818N/A architecture. See <literal>ConditionArchitecture=</literal>
2818N/A in
2818N/A <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
2818N/A for details.</para>
2818N/A </listitem>
3722N/A </varlistentry>
3722N/A </variablelist>
2818N/A
2818N/A </refsect1>
4089N/A
4089N/A <refsect1>
4089N/A <title>[Link] Section Options</title>
4089N/A
4089N/A <para>The <literal>[Link]</literal> section accepts the following
2818N/A keys:</para>
3747N/A
3747N/A <variablelist class='network-directives'>
3747N/A <varlistentry>
3747N/A <term><varname>Description=</varname></term>
3747N/A <listitem>
3747N/A <para>A description of the device.</para>
3747N/A </listitem>
2818N/A </varlistentry>
4089N/A <varlistentry>
2818N/A <term><varname>Alias=</varname></term>
3817N/A <listitem>
3817N/A <para>The <literal>ifalias</literal> is set to this
3817N/A value.</para>
3817N/A </listitem>
3817N/A </varlistentry>
3817N/A <varlistentry>
3817N/A <term><varname>MACAddressPolicy=</varname></term>
3817N/A <listitem>
3817N/A <para>The policy by which the MAC address should be set. The
3817N/A available policies are:
3817N/A </para>
3817N/A
3817N/A <variablelist>
3817N/A <varlistentry>
<term><literal>persistent</literal></term>
<listitem>
<para>If the hardware has a persistent MAC address, as
most hardware should, and if it is used by the kernel,
nothing is done. Otherwise, a new MAC address is
generated which is guaranteed to be the same on every
boot for the given machine and the given device, but
which is otherwise random. This feature depends on ID_NET_NAME_*
properties existing for the link, on hardware where these
properties are not set the generation of a persistent MAC address
will fail.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>random</literal></term>
<listitem>
<para>If the kernel is using a random MAC address,
nothing is done. Otherwise, a new address is randomly
generated each time the device appears, typically at
boot.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>MACAddress=</varname></term>
<listitem>
<para>The MAC address to use, if no
<literal>MACAddressPolicy=</literal>
is specified.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>NamePolicy=</varname></term>
<listitem>
<para>An ordered, space-separated list of policies by which
the interface name should be set.
<literal>NamePolicy</literal> may be disabled by specifying
<literal>net.ifnames=0</literal> on the kernel command line.
Each of the policies may fail, and the first successful one
is used. The name is not set directly, but is exported to
udev as the property <literal>ID_NET_NAME</literal>, which
is, by default, used by a udev rule to set
<literal>NAME</literal>. If the name has already been set by
userspace, no renaming is performed. The available policies
are:</para>
<variablelist>
<varlistentry>
<term><literal>kernel</literal></term>
<listitem>
<para>If the kernel claims that the name it has set
for a device is predictable, then no renaming is
performed.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>database</literal></term>
<listitem>
<para>The name is set based on entries in the udev's
Hardware Database with the key
<literal>ID_NET_NAME_FROM_DATABASE</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>onboard</literal></term>
<listitem>
<para>The name is set based on information given by
the firmware for on-board devices, as exported by the
udev property <literal>ID_NET_NAME_ONBOARD</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>slot</literal></term>
<listitem>
<para>The name is set based on information given by
the firmware for hot-plug devices, as exported by the
udev property <literal>ID_NET_NAME_SLOT</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>path</literal></term>
<listitem>
<para>The name is set based on the device's physical
location, as exported by the udev property
<literal>ID_NET_NAME_PATH</literal>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>mac</literal></term>
<listitem>
<para>The name is set based on the device's persistent
MAC address, as exported by the udev property
<literal>ID_NET_NAME_MAC</literal>.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>Name=</varname></term>
<listitem>
<para>The interface name to use in case all the
policies specified in
<varname>NamePolicy=</varname> fail, or in case
<varname>NamePolicy=</varname> is missing or
disabled.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>MTUBytes=</varname></term>
<listitem>
<para>The maximum transmission unit in bytes to set for the
device. The usual suffixes K, M, G, are supported and are
understood to the base of 1024.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>BitsPerSecond=</varname></term>
<listitem>
<para>The speed to set for the device, the value is rounded
down to the nearest Mbps. The usual suffixes K, M, G, are
supported and are understood to the base of 1000.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>Duplex=</varname></term>
<listitem>
<para>The duplex mode to set for the device. The accepted
values are <literal>half</literal> and
<literal>full</literal>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>WakeOnLan=</varname></term>
<listitem>
<para>The Wake-on-LAN policy to set for the device. The
supported values are:</para>
<variablelist>
<varlistentry>
<term><literal>phy</literal></term>
<listitem>
<para>Wake on PHY activity.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>magic</literal></term>
<listitem>
<para>Wake on receipt of a magic packet.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>off</literal></term>
<listitem>
<para>Never wake.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Example</title>
<example>
<title>/etc/systemd/network/wireless.link</title>
<programlisting>[Match]
MACAddress=12:34:56:78:9a:bc
Driver=brcmsmac
Path=pci-0000:02:00.0-*
Type=wlan
Virtualization=no
Host=my-laptop
Architecture=x86-64
[Link]
Name=wireless0
MTUBytes=1450
BitsPerSecond=10M
WakeOnLan=magic
MACAddress=cb:a9:87:65:43:21</programlisting>
</example>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<citerefentry>
<refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum>
</citerefentry>
</para>
</refsect1>
</refentry>