chiark / gitweb /
.network/.netdev/.link: allow to match on architecture
[elogind.git] / man / systemd-networkd.service.xml
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">
4
5 <!--
6   This file is part of systemd.
7
8   Copyright 2013 Tom Gundersen
9
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.
14
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.
19
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/>.
22 -->
23
24 <refentry id="systemd-networkd.service" conditional='ENABLE_NETWORKD'>
25
26         <refentryinfo>
27                 <title>systemd-networkd.service</title>
28                 <productname>systemd</productname>
29
30                 <authorgroup>
31                         <author>
32                                 <contrib>Developer</contrib>
33                                 <firstname>Tom</firstname>
34                                 <surname>Gundersen</surname>
35                                 <email>teg@jklm.no</email>
36                         </author>
37                 </authorgroup>
38         </refentryinfo>
39
40         <refmeta>
41                 <refentrytitle>systemd-networkd.service</refentrytitle>
42                 <manvolnum>8</manvolnum>
43         </refmeta>
44
45         <refnamediv>
46                 <refname>systemd-networkd.service</refname>
47                 <refname>systemd-networkd</refname>
48                 <refpurpose>Network manager</refpurpose>
49         </refnamediv>
50
51         <refsynopsisdiv>
52                 <para><filename>systemd-networkd.service</filename></para>
53                 <para><filename>/usr/lib/systemd/systemd-networkd</filename></para>
54         </refsynopsisdiv>
55
56         <refsect1>
57                 <title>Description</title>
58
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>
63
64                 <para>To configure low-level link settings independently of
65                 networks, see
66                 <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>
67                 .</para>
68
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,
74                 and back.</para>
75         </refsect1>
76
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>
93
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>
98
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>
102
103                         <variablelist class='network-directives'>
104                                 <varlistentry>
105                                         <term><varname>Host</varname></term>
106                                         <listitem>
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>
110                                                 for details.
111                                                 </para>
112                                         </listitem>
113                                 </varlistentry>
114                                 <varlistentry>
115                                         <term><varname>Virtualization</varname></term>
116                                         <listitem>
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>
121                                                 for details.
122                                                 </para>
123                                         </listitem>
124                                 </varlistentry>
125                                 <varlistentry>
126                                         <term><varname>KernelCommandLine</varname></term>
127                                         <listitem>
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>
132                                                 for details.
133                                                 </para>
134                                         </listitem>
135                                 </varlistentry>
136                                 <varlistentry>
137                                         <term><varname>Architecture</varname></term>
138                                         <listitem>
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>
142                                                 for details.
143                                                 </para>
144                                         </listitem>
145                                 </varlistentry>
146                         </variablelist>
147
148                         <para>The <literal>[NetDev]</literal> section accepts the following
149                         keys:</para>
150
151                         <variablelist class='network-directives'>
152                                 <varlistentry>
153                                         <term><varname>Name</varname></term>
154                                         <listitem>
155                                                 <para>The interface name used when creating the
156                                                 bridge. This option is compulsory.</para>
157                                         </listitem>
158                                 </varlistentry>
159                                 <varlistentry>
160                                         <term><varname>Kind</varname></term>
161                                         <listitem>
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>
165                                         </listitem>
166                                 </varlistentry>
167                         </variablelist>
168
169                         <para>The <literal>[VLAN]</literal> section only applies for netdevs of kind <literal>vlan</literal>,
170                         and accepts the following key:</para>
171
172                         <variablelist class='network-directives'>
173                                 <varlistentry>
174                                         <term><varname>Id</varname></term>
175                                         <listitem>
176                                                 <para>The VLAN ID to use. An integer in the range 0–4094.
177                                                 This option is compulsory.</para>
178                                         </listitem>
179                                 </varlistentry>
180                         </variablelist>
181
182                 </refsect2>
183
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
187                         appear.</para>
188
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>
194
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>
198
199                         <variablelist class='network-directives'>
200                                 <varlistentry>
201                                         <term><varname>MACAddress</varname></term>
202                                         <listitem>
203                                                 <para>The hardware address.</para>
204                                         </listitem>
205                                 </varlistentry>
206                                 <varlistentry>
207                                         <term><varname>Path</varname></term>
208                                         <listitem>
209                                                 <para>The persistent path, as exposed by the udev
210                                                 property <literal>ID_PATH</literal>. May contain shell
211                                                 style globs.</para>
212                                         </listitem>
213                                 </varlistentry>
214                                 <varlistentry>
215                                         <term><varname>Driver</varname></term>
216                                         <listitem>
217                                                 <para>The driver currently bound to the device, as
218                                                 exposed by the udev property <literal>DRIVER</literal>
219                                                 of its parent device.
220                                                 </para>
221                                         </listitem>
222                                 </varlistentry>
223                                 <varlistentry>
224                                         <term><varname>Type</varname></term>
225                                         <listitem>
226                                                 <para>The device type, as exposed by the udev property
227                                                 <literal>DEVTYPE</literal>.</para>
228                                         </listitem>
229                                 </varlistentry>
230                                 <varlistentry>
231                                         <term><varname>Name</varname></term>
232                                         <listitem>
233                                                 <para>The device name, as exposed by the udev property
234                                                 <literal>INTERFACE</literal>. May contain shell style
235                                                 globs.</para>
236                                         </listitem>
237                                 </varlistentry>
238                                 <varlistentry>
239                                         <term><varname>Host</varname></term>
240                                         <listitem>
241                                                 <para>Matches against the hostname or machine ID of the
242                                                 host. See <literal>ConditionHost=</literal> in
243                                                 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
244                                                 for details.
245                                                 </para>
246                                         </listitem>
247                                 </varlistentry>
248                                 <varlistentry>
249                                         <term><varname>Virtualization</varname></term>
250                                         <listitem>
251                                                 <para>Checks whether the system is executed in a virtualized
252                                                 environment and optionally test whether it is a specific
253                                                 implementation. See <literal>ConditionVirtualization=</literal> in
254                                                 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
255                                                 for details.
256                                                 </para>
257                                         </listitem>
258                                 </varlistentry>
259                                 <varlistentry>
260                                         <term><varname>KernelCommandLine</varname></term>
261                                         <listitem>
262                                                 <para>Checks whether a specific kernel command line option is
263                                                 set (or if prefixed with the exclamation mark unset). See
264                                                 <literal>ConditionKernelCommandLine=</literal> in
265                                                 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
266                                                 for details.
267                                                 </para>
268                                         </listitem>
269                                 </varlistentry>
270                                 <varlistentry>
271                                         <term><varname>Architecture</varname></term>
272                                         <listitem>
273                                                 <para>Checks whether the system is running on a specific
274                                                 architecture. See <literal>ConditionArchitecture=</literal> in
275                                                 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
276                                                 for details.
277                                                 </para>
278                                         </listitem>
279                                 </varlistentry>
280                         </variablelist>
281
282                         <para>The <literal>[Network]</literal> section accepts the following keys:</para>
283
284                         <variablelist class='network-directives'>
285                                 <varlistentry>
286                                         <term><varname>Description</varname></term>
287                                         <listitem>
288                                                 <para>A description of the device. This is only used for
289                                                 presentation purposes.</para>
290                                         </listitem>
291                                 </varlistentry>
292                                 <varlistentry>
293                                         <term><varname>DHCP</varname></term>
294                                         <listitem>
295                                                 <para>A boolean. When true, enables basic DHCPv4 support.</para>
296                                         </listitem>
297                                 </varlistentry>
298                                 <varlistentry>
299                                         <term><varname>Address</varname></term>
300                                         <listitem>
301                                                 <para>A static IPv4 or IPv6 address and its prefix length,
302                                                 separated by a <literal>/</literal> character. The format of the address must
303                                                 be as described in
304                                                 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>
305                                                 . This is a short-hand for an [Address] section only containing an Address key (see below).</para>
306                                         </listitem>
307                                 </varlistentry>
308                                 <varlistentry>
309                                         <term><varname>Gateway</varname></term>
310                                         <listitem>
311                                                 <para>The gateway address, which must be in the format described in
312                                                 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>
313                                                 . This is a short-hand for a [Route] section only containing a Gateway key.</para>
314                                         </listitem>
315                                 </varlistentry>
316                                 <varlistentry>
317                                         <term><varname>DNS</varname></term>
318                                         <listitem>
319                                                 <para>A DNS server address, which must be in the format described in
320                                                 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>
321                                                 .</para>
322                                         </listitem>
323                                 </varlistentry>
324                                 <varlistentry>
325                                         <term><varname>Bridge</varname></term>
326                                         <listitem>
327                                                 <para>The name of the bridge to add the link to.</para>
328                                         </listitem>
329                                 </varlistentry>
330                                 <varlistentry>
331                                         <term><varname>Bond</varname></term>
332                                         <listitem>
333                                                 <para>The name of the bond to add the link to.</para>
334                                         </listitem>
335                                 </varlistentry>
336                                 <varlistentry>
337                                         <term><varname>VLAN</varname></term>
338                                         <listitem>
339                                                 <para>The name of a VLAN to create on the link. This option
340                                                 may be specified more than once.</para>
341                                         </listitem>
342                                 </varlistentry>
343                         </variablelist>
344
345                         <para>The <literal>[Address]</literal> section accepts the following keys:</para>
346
347                         <variablelist class='network-directives'>
348                                 <varlistentry>
349                                         <term><varname>Address</varname></term>
350                                         <listitem>
351                                                 <para>As in the <literal>[Network]</literal> section. This key is mandatory.</para>
352                                         </listitem>
353                                 </varlistentry>
354                                 <varlistentry>
355                                         <term><varname>Broadcast</varname></term>
356                                         <listitem>
357                                                 <para>The broadcast address, which must be in the format described in
358                                                 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>
359                                                 . This key only applies to IPv4 addresses. If it is not given, it is
360                                                 derived from the <literal>Address</literal> key.</para>
361                                         </listitem>
362                                 </varlistentry>
363                                 <varlistentry>
364                                         <term><varname>Label</varname></term>
365                                         <listitem>
366                                                 <para>An address label.</para>
367                                         </listitem>
368                                 </varlistentry>
369                         </variablelist>
370
371                         <para>The <literal>[Route]</literal> section accepts the following keys:</para>
372
373                         <variablelist class='network-directives'>
374                                 <varlistentry>
375                                         <term><varname>Gateway</varname></term>
376                                         <listitem>
377                                                 <para>As in the <literal>[Network]</literal> section. This key is mandatory.</para>
378                                         </listitem>
379                                 </varlistentry>
380                                 <varlistentry>
381                                         <term><varname>Destination</varname></term>
382                                         <listitem>
383                                                 <para>The destination prefix of the route. Possibly followed by a slash and the
384                                                 prefixlength, if ommitted a full-length host route is assumed.</para>
385                                         </listitem>
386                                 </varlistentry>
387                         </variablelist>
388
389                         <para>The <literal>[DHCPv4]</literal> section accepts the following keys:</para>
390
391                         <variablelist class='network-directives'>
392                                 <varlistentry>
393                                         <term><varname>UseDNS</varname></term>
394                                         <listitem>
395                                                 <para>When true (the default), the DNS servers received from the DHCP server will
396                                                 be used and take precedence over any statically configured ones.</para>
397                                         </listitem>
398                                 </varlistentry>
399                                 <varlistentry>
400                                         <term><varname>UseMTU</varname></term>
401                                         <listitem>
402                                                 <para>When true, the interface maximum transmission unit from the DHCP server will
403                                                 be used on the current link. Defaults to false.</para>
404                                         </listitem>
405                                 </varlistentry>
406                                 <varlistentry>
407                                         <term><varname>UseHostname</varname></term>
408                                         <listitem>
409                                                 <para>When true (the default), the hostname received from the DHCP server
410                                                 will be used as the transient hostname.</para>
411                                         </listitem>
412                                 </varlistentry>
413                                 <varlistentry>
414                                         <term><varname>CriticalConnection</varname></term>
415                                         <listitem>
416                                                 <para>When true, the connection will never be torn down even if the DHCP lease
417                                                 expires. This is contrary to the DHCP specification, but may be the best choice
418                                                 if, say, the root filesystem relies on this connection. Defaults to false.</para>
419                                         </listitem>
420                                 </varlistentry>
421                        </variablelist>
422
423                 </refsect2>
424         </refsect1>
425
426         <refsect1>
427                 <title>See Also</title>
428                 <para>
429                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
430                         <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
431                 </para>
432         </refsect1>
433
434 </refentry>