]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd-networkd.service.xml
net-util: match on the driver as exposed by ethtool if DRIVER not set
[thirdparty/systemd.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 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,
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 netdev. 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 04094.
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, or if that is not set the driver
220 as exposed by <literal>ethtool -i</literal> of the
221 device itself.</para>
222 </listitem>
223 </varlistentry>
224 <varlistentry>
225 <term><varname>Type=</varname></term>
226 <listitem>
227 <para>The device type, as exposed by the udev property
228 <literal>DEVTYPE</literal>.</para>
229 </listitem>
230 </varlistentry>
231 <varlistentry>
232 <term><varname>Name=</varname></term>
233 <listitem>
234 <para>The device name, as exposed by the udev property
235 <literal>INTERFACE</literal>. May contain shell style
236 globs.</para>
237 </listitem>
238 </varlistentry>
239 <varlistentry>
240 <term><varname>Host=</varname></term>
241 <listitem>
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>
245 for details.
246 </para>
247 </listitem>
248 </varlistentry>
249 <varlistentry>
250 <term><varname>Virtualization=</varname></term>
251 <listitem>
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>
256 for details.
257 </para>
258 </listitem>
259 </varlistentry>
260 <varlistentry>
261 <term><varname>KernelCommandLine=</varname></term>
262 <listitem>
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>
267 for details.
268 </para>
269 </listitem>
270 </varlistentry>
271 <varlistentry>
272 <term><varname>Architecture=</varname></term>
273 <listitem>
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>
277 for details.
278 </para>
279 </listitem>
280 </varlistentry>
281 </variablelist>
282
283 <para>The <literal>[Network]</literal> section accepts the following keys:</para>
284
285 <variablelist class='network-directives'>
286 <varlistentry>
287 <term><varname>Description=</varname></term>
288 <listitem>
289 <para>A description of the device. This is only used for
290 presentation purposes.</para>
291 </listitem>
292 </varlistentry>
293 <varlistentry>
294 <term><varname>DHCP=</varname></term>
295 <listitem>
296 <para>A boolean. When true, enables basic DHCPv4 support.</para>
297 </listitem>
298 </varlistentry>
299 <varlistentry>
300 <term><varname>Address=</varname></term>
301 <listitem>
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
304 be as described in
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>
307 </listitem>
308 </varlistentry>
309 <varlistentry>
310 <term><varname>Gateway=</varname></term>
311 <listitem>
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>
315 </listitem>
316 </varlistentry>
317 <varlistentry>
318 <term><varname>DNS=</varname></term>
319 <listitem>
320 <para>A DNS server address, which must be in the format described in
321 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>
322 .</para>
323 </listitem>
324 </varlistentry>
325 <varlistentry>
326 <term><varname>Bridge=</varname></term>
327 <listitem>
328 <para>The name of the bridge to add the link to.</para>
329 </listitem>
330 </varlistentry>
331 <varlistentry>
332 <term><varname>Bond=</varname></term>
333 <listitem>
334 <para>The name of the bond to add the link to.</para>
335 </listitem>
336 </varlistentry>
337 <varlistentry>
338 <term><varname>VLAN=</varname></term>
339 <listitem>
340 <para>The name of a VLAN to create on the link. This option
341 may be specified more than once.</para>
342 </listitem>
343 </varlistentry>
344 </variablelist>
345
346 <para>The <literal>[Address]</literal> section accepts the following keys:</para>
347
348 <variablelist class='network-directives'>
349 <varlistentry>
350 <term><varname>Address=</varname></term>
351 <listitem>
352 <para>As in the <literal>[Network]</literal> section. This key is mandatory.</para>
353 </listitem>
354 </varlistentry>
355 <varlistentry>
356 <term><varname>Broadcast=</varname></term>
357 <listitem>
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>
362 </listitem>
363 </varlistentry>
364 <varlistentry>
365 <term><varname>Label=</varname></term>
366 <listitem>
367 <para>An address label.</para>
368 </listitem>
369 </varlistentry>
370 </variablelist>
371
372 <para>The <literal>[Route]</literal> section accepts the following keys:</para>
373
374 <variablelist class='network-directives'>
375 <varlistentry>
376 <term><varname>Gateway=</varname></term>
377 <listitem>
378 <para>As in the <literal>[Network]</literal> section. This key is mandatory.</para>
379 </listitem>
380 </varlistentry>
381 <varlistentry>
382 <term><varname>Destination=</varname></term>
383 <listitem>
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>
386 </listitem>
387 </varlistentry>
388 </variablelist>
389
390 <para>The <literal>[DHCPv4]</literal> section accepts the following keys:</para>
391
392 <variablelist class='network-directives'>
393 <varlistentry>
394 <term><varname>UseDNS=</varname></term>
395 <listitem>
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>
398 </listitem>
399 </varlistentry>
400 <varlistentry>
401 <term><varname>UseMTU=</varname></term>
402 <listitem>
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>
405 </listitem>
406 </varlistentry>
407 <varlistentry>
408 <term><varname>UseHostname=</varname></term>
409 <listitem>
410 <para>When true (the default), the hostname received from the DHCP server
411 will be used as the transient hostname.</para>
412 </listitem>
413 </varlistentry>
414 <varlistentry>
415 <term><varname>CriticalConnection=</varname></term>
416 <listitem>
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>
420 </listitem>
421 </varlistentry>
422 </variablelist>
423
424 </refsect2>
425 </refsect1>
426
427 <refsect1>
428 <title>See Also</title>
429 <para>
430 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
431 <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>
432 </para>
433 </refsect1>
434
435 </refentry>