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 are 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>
138 <para>The <literal>[NetDev]</literal> section accepts the following
141 <variablelist class='network-directives'>
143 <term><varname>Name</varname></term>
145 <para>The interface name used when creating the
146 bridge. This option is compulsory.</para>
150 <term><varname>Kind</varname></term>
152 <para>The netdev kind. Currently, <literal>bridge</literal>,
153 <literal>bond</literal> and <literal>vlan</literal>
154 are supported. This option is compulsory.</para>
159 <para>The <literal>[VLAN]</literal> section only applies for netdevs of kind <literal>vlan</literal>,
160 and accepts the following key:</para>
162 <variablelist class='network-directives'>
164 <term><varname>Id</varname></term>
166 <para>The VLAN ID to use. An integer in the range 0–4094.
167 This option is compulsory.</para>
174 <refsect2><title>Networks</title>
175 <para>Network files must have the extension <filename>.network</filename>;
176 other extensions are ignored. Networks are applied to links whenever the links
179 <para>The network file contains a <literal>[Match]</literal> section,
180 which determines if a given network file may be applied to a given device;
181 and a <literal>[Network]</literal> section specifying how the device should
182 be configured. The first (in lexical order) of the network files that
183 matches a given device is applied.</para>
185 <para>A network file is said to match a device if each of the entries in the
186 <literal>[Match]</literal> section matches, or if the section is empty.
187 The following keys are accepted:</para>
189 <variablelist class='network-directives'>
191 <term><varname>MACAddress</varname></term>
193 <para>The hardware address.</para>
197 <term><varname>Path</varname></term>
199 <para>The persistent path, as exposed by the udev
200 property <literal>ID_PATH</literal>. May contain shell
205 <term><varname>Driver</varname></term>
207 <para>The driver currently bound to the device, as
208 exposed by the udev property <literal>DRIVER</literal>
209 of its parent device.
214 <term><varname>Type</varname></term>
216 <para>The device type, as exposed by the udev property
217 <literal>DEVTYPE</literal>.</para>
221 <term><varname>Name</varname></term>
223 <para>The device name, as exposed by the udev property
224 <literal>INTERFACE</literal>. May contain shell style
229 <term><varname>Host</varname></term>
231 <para>Matches against the hostname or machine ID of the
232 host. See <literal>ConditionHost=</literal> in
233 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
239 <term><varname>Virtualization</varname></term>
241 <para>Checks whether the system is executed in a virtualized
242 environment and optionally test whether it is a specific
243 implementation. See <literal>ConditionVirtualization=</literal> in
244 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
250 <term><varname>KernelCommandLine</varname></term>
252 <para>Checks whether a specific kernel command line option is
253 set (or if prefixed with the exclamation mark unset). See
254 <literal>ConditionKernelCommandLine=</literal> in
255 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
262 <para>The <literal>[Network]</literal> section accepts the following keys:</para>
264 <variablelist class='network-directives'>
266 <term><varname>Description</varname></term>
268 <para>A description of the device. This is only used for
269 presentation purposes.</para>
273 <term><varname>DHCP</varname></term>
275 <para>A boolean. When true, enables basic DHCPv4 support.</para>
279 <term><varname>Address</varname></term>
281 <para>A static IPv4 or IPv6 address and its prefix length,
282 separated by a <literal>/</literal> character. The format of the address must
284 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>
285 . This is a short-hand for an [Address] section only containing an Address key (see below).</para>
289 <term><varname>Gateway</varname></term>
291 <para>The gateway address, which must be in the format described in
292 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>
293 . This is a short-hand for a [Route] section only containing a Gateway key.</para>
297 <term><varname>DNS</varname></term>
299 <para>A DNS server address, which must be in the format described in
300 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>
305 <term><varname>Bridge</varname></term>
307 <para>The name of the bridge to add the link to.</para>
311 <term><varname>Bond</varname></term>
313 <para>The name of the bond to add the link to.</para>
317 <term><varname>VLAN</varname></term>
319 <para>The name of a VLAN to create on the link. This option
320 may be specified more than once.</para>
325 <para>The <literal>[Address]</literal> section accepts the following keys:</para>
327 <variablelist class='network-directives'>
329 <term><varname>Address</varname></term>
331 <para>As in the <literal>[Network]</literal> section. This key is mandatory.</para>
335 <term><varname>Broadcast</varname></term>
337 <para>The broadcast address, which must be in the format described in
338 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>
339 . This key only applies to IPv4 addresses. If it is not given, it is
340 derived from the <literal>Address</literal> key.</para>
344 <term><varname>Label</varname></term>
346 <para>An address label.</para>
351 <para>The <literal>[Route]</literal> section accepts the following keys:</para>
353 <variablelist class='network-directives'>
355 <term><varname>Gateway</varname></term>
357 <para>As in the <literal>[Network]</literal> section. This key is mandatory.</para>
361 <term><varname>Destination</varname></term>
363 <para>The destination prefix of the route. Possibly followed by a slash and the
364 prefixlength, if ommitted a full-length host route is assumed.</para>
369 <para>The <literal>[DHCPv4]</literal> section accepts the following keys:</para>
371 <variablelist class='network-directives'>
373 <term><varname>UseDNS</varname></term>
375 <para>When true (the default), the DNS servers received from the DHCP server will
376 be used and take precedence over any statically configured ones.</para>
380 <term><varname>UseMTU</varname></term>
382 <para>When true, the interface maximum transmission unit from the DHCP server will
383 be used on the current link. Defaults to false.</para>
387 <term><varname>UseHostname</varname></term>
389 <para>When true (the default), the hostname received from the DHCP server
390 will be used as the transient hostname.</para>
394 <term><varname>CriticalConnection</varname></term>
396 <para>When true, the connection will never be torn down even if the DHCP lease
397 expires. This is contrary to the DHCP specification, but may be the best choice
398 if, say, the root filesystem relies on this connection. Defaults to false.</para>
407 <title>See Also</title>
409 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
410 <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>,