1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 This file is part of systemd.
8 Copyright 2013 Tom Gundersen
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 <refentry id="systemd-networkd.service" conditional='ENABLE_NETWORKD'>
27 <title>systemd-networkd.service</title>
28 <productname>systemd</productname>
32 <contrib>Developer</contrib>
33 <firstname>Tom</firstname>
34 <surname>Gundersen</surname>
35 <email>teg@jklm.no</email>
41 <refentrytitle>systemd-networkd.service</refentrytitle>
42 <manvolnum>8</manvolnum>
46 <refname>systemd-networkd.service</refname>
47 <refname>systemd-networkd</refname>
48 <refpurpose>Network manager</refpurpose>
52 <para><filename>systemd-networkd.service</filename></para>
53 <para><filename>/usr/lib/systemd/systemd-networkd</filename></para>
57 <title>Description</title>
59 <para><command>systemd-networkd</command> is a system
60 service that manages networks. It detects and configures
61 network devices as they appear, as well as creating virtual
62 network devices.</para>
64 <para>To configure low-level link settings independently of
66 <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>
69 <para>Network configurations applied before networkd is started
70 are not removed, and static configuration applied by networkd
71 is not removed when networkd exits. This ensures restarting
72 networkd does not cut the network connection, and, in particular,
73 that it is safe to transition between the initrd and the real root,
77 <refsect1><title>Configuration Files</title>
78 <para>The configuration files are read from the files located in the
79 system network directory <filename>/usr/lib/systemd/network</filename>,
80 the volatile runtime network directory
81 <filename>/run/systemd/network</filename> and the local administration
82 network directory <filename>/etc/systemd/network</filename>.
83 All configuration files are collectively sorted and processed in lexical order,
84 regardless of the directories in which they live. However, files with
85 identical filenames replace each other. Files in
86 <filename>/etc</filename> have the highest priority, files in
87 <filename>/run</filename> take precedence over files with the same
88 name in <filename>/usr/lib</filename>. This can be used to override a
89 system-supplied configuration file with a local file if needed; a symlink in
90 <filename>/etc</filename> with the same name as a configuration file in
91 <filename>/usr/lib</filename>, pointing to <filename>/dev/null</filename>,
92 disables the configuration file entirely.</para>
94 <refsect2><title>Virtual Network Devices</title>
95 <para>Virtual Network Device files must have the extension
96 <filename>.netdev</filename>; other extensions are ignored. Virtual
97 network devices are created as soon as networkd is started.</para>
99 <para>A virtual network device is only created if the
100 <literal>[Match]</literal> section matches the current
101 environment, or if the section is empty. The following keys are accepted:</para>
103 <variablelist class='network-directives'>
105 <term><varname>Host=</varname></term>
107 <para>Matches against the hostname or machine ID of the
108 host. See <literal>ConditionHost=</literal> in
109 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
115 <term><varname>Virtualization=</varname></term>
117 <para>Checks whether the system is executed in a virtualized
118 environment and optionally test whether it is a specific
119 implementation. See <literal>ConditionVirtualization=</literal> in
120 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
126 <term><varname>KernelCommandLine=</varname></term>
128 <para>Checks whether a specific kernel command line option is
129 set (or if prefixed with the exclamation mark unset). See
130 <literal>ConditionKernelCommandLine=</literal> in
131 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
137 <term><varname>Architecture=</varname></term>
139 <para>Checks whether the system is running on a specific
140 architecture. See <literal>ConditionArchitecture=</literal> in
141 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
148 <para>The <literal>[NetDev]</literal> section accepts the following
151 <variablelist class='network-directives'>
153 <term><varname>Name=</varname></term>
155 <para>The interface name used when creating the
156 netdev. This option is compulsory.</para>
160 <term><varname>Kind=</varname></term>
162 <para>The netdev kind. Currently, <literal>bridge</literal>,
163 <literal>bond</literal> and <literal>vlan</literal>
164 are supported. This option is compulsory.</para>
169 <para>The <literal>[VLAN]</literal> section only applies for netdevs of kind <literal>vlan</literal>,
170 and accepts the following key:</para>
172 <variablelist class='network-directives'>
174 <term><varname>Id=</varname></term>
176 <para>The VLAN ID to use. An integer in the range 0–4094.
177 This option is compulsory.</para>
184 <refsect2><title>Networks</title>
185 <para>Network files must have the extension <filename>.network</filename>;
186 other extensions are ignored. Networks are applied to links whenever the links
189 <para>The network file contains a <literal>[Match]</literal> section,
190 which determines if a given network file may be applied to a given device;
191 and a <literal>[Network]</literal> section specifying how the device should
192 be configured. The first (in lexical order) of the network files that
193 matches a given device is applied.</para>
195 <para>A network file is said to match a device if each of the entries in the
196 <literal>[Match]</literal> section matches, or if the section is empty.
197 The following keys are accepted:</para>
199 <variablelist class='network-directives'>
201 <term><varname>MACAddress=</varname></term>
203 <para>The hardware address.</para>
207 <term><varname>Path=</varname></term>
209 <para>The persistent path, as exposed by the udev
210 property <literal>ID_PATH</literal>. May contain shell
215 <term><varname>Driver=</varname></term>
217 <para>The driver currently bound to the device, as
218 exposed by the udev property <literal>DRIVER</literal>
219 of its parent device, or if that is not set the driver
220 as exposed by <literal>ethtool -i</literal> of the
221 device itself.</para>
225 <term><varname>Type=</varname></term>
227 <para>The device type, as exposed by the udev property
228 <literal>DEVTYPE</literal>.</para>
232 <term><varname>Name=</varname></term>
234 <para>The device name, as exposed by the udev property
235 <literal>INTERFACE</literal>. May contain shell style
240 <term><varname>Host=</varname></term>
242 <para>Matches against the hostname or machine ID of the
243 host. See <literal>ConditionHost=</literal> in
244 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
250 <term><varname>Virtualization=</varname></term>
252 <para>Checks whether the system is executed in a virtualized
253 environment and optionally test whether it is a specific
254 implementation. See <literal>ConditionVirtualization=</literal> in
255 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
261 <term><varname>KernelCommandLine=</varname></term>
263 <para>Checks whether a specific kernel command line option is
264 set (or if prefixed with the exclamation mark unset). See
265 <literal>ConditionKernelCommandLine=</literal> in
266 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
272 <term><varname>Architecture=</varname></term>
274 <para>Checks whether the system is running on a specific
275 architecture. See <literal>ConditionArchitecture=</literal> in
276 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
283 <para>The <literal>[Network]</literal> section accepts the following keys:</para>
285 <variablelist class='network-directives'>
287 <term><varname>Description=</varname></term>
289 <para>A description of the device. This is only used for
290 presentation purposes.</para>
294 <term><varname>DHCP=</varname></term>
296 <para>A boolean. When true, enables basic DHCPv4 support.</para>
300 <term><varname>Address=</varname></term>
302 <para>A static IPv4 or IPv6 address and its prefix length,
303 separated by a <literal>/</literal> character. The format of the address must
305 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>
306 . This is a short-hand for an [Address] section only containing an Address key (see below).</para>
310 <term><varname>Gateway=</varname></term>
312 <para>The gateway address, which must be in the format described in
313 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>
314 . This is a short-hand for a [Route] section only containing a Gateway key.</para>
318 <term><varname>DNS=</varname></term>
320 <para>A DNS server address, which must be in the format described in
321 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>
326 <term><varname>Bridge=</varname></term>
328 <para>The name of the bridge to add the link to.</para>
332 <term><varname>Bond=</varname></term>
334 <para>The name of the bond to add the link to.</para>
338 <term><varname>VLAN=</varname></term>
340 <para>The name of a VLAN to create on the link. This option
341 may be specified more than once.</para>
346 <para>The <literal>[Address]</literal> section accepts the following keys:</para>
348 <variablelist class='network-directives'>
350 <term><varname>Address=</varname></term>
352 <para>As in the <literal>[Network]</literal> section. This key is mandatory.</para>
356 <term><varname>Broadcast=</varname></term>
358 <para>The broadcast address, which must be in the format described in
359 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>
360 . This key only applies to IPv4 addresses. If it is not given, it is
361 derived from the <literal>Address</literal> key.</para>
365 <term><varname>Label=</varname></term>
367 <para>An address label.</para>
372 <para>The <literal>[Route]</literal> section accepts the following keys:</para>
374 <variablelist class='network-directives'>
376 <term><varname>Gateway=</varname></term>
378 <para>As in the <literal>[Network]</literal> section. This key is mandatory.</para>
382 <term><varname>Destination=</varname></term>
384 <para>The destination prefix of the route. Possibly followed by a slash and the
385 prefixlength, if ommitted a full-length host route is assumed.</para>
390 <para>The <literal>[DHCPv4]</literal> section accepts the following keys:</para>
392 <variablelist class='network-directives'>
394 <term><varname>UseDNS=</varname></term>
396 <para>When true (the default), the DNS servers received from the DHCP server will
397 be used and take precedence over any statically configured ones.</para>
401 <term><varname>UseMTU=</varname></term>
403 <para>When true, the interface maximum transmission unit from the DHCP server will
404 be used on the current link. Defaults to false.</para>
408 <term><varname>UseHostname=</varname></term>
410 <para>When true (the default), the hostname received from the DHCP server
411 will be used as the transient hostname.</para>
415 <term><varname>CriticalConnection=</varname></term>
417 <para>When true, the connection will never be torn down even if the DHCP lease
418 expires. This is contrary to the DHCP specification, but may be the best choice
419 if, say, the root filesystem relies on this connection. Defaults to false.</para>
428 <title>See Also</title>
430 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
431 <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>