]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.network.xml
treewide: use log_*_errno whenever %m is in the format string
[thirdparty/systemd.git] / man / systemd.network.xml
CommitLineData
eac684ef
TG
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.network" conditional='ENABLE_NETWORKD'>
25
26 <refentryinfo>
27 <title>systemd.network</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.network</refentrytitle>
42 <manvolnum>5</manvolnum>
43 </refmeta>
44
45 <refnamediv>
46 <refname>systemd.network</refname>
47 <refpurpose>Network configuration</refpurpose>
48 </refnamediv>
49
50 <refsynopsisdiv>
51 <para><filename><replaceable>network</replaceable>.network</filename></para>
52 </refsynopsisdiv>
53
54 <refsect1>
55 <title>Description</title>
56
57 <para>Network setup is performed by
58 <citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
59 </para>
60
61 <para>Network files must have the extension <filename>.network</filename>;
62 other extensions are ignored. Networks are applied to links whenever the links
63 appear.</para>
64
65 <para>The <filename>.network</filename> files are read from the files located in the
66 system network directory <filename>/usr/lib/systemd/network</filename>,
67 the volatile runtime network directory
68 <filename>/run/systemd/network</filename> and the local administration
69 network directory <filename>/etc/systemd/network</filename>.
70 All configuration files are collectively sorted and processed in lexical order,
71 regardless of the directories in which they live. However, files with
72 identical filenames replace each other. Files in
73 <filename>/etc</filename> have the highest priority, files in
74 <filename>/run</filename> take precedence over files with the same
75 name in <filename>/usr/lib</filename>. This can be used to override a
76 system-supplied configuration file with a local file if needed; a symlink in
77 <filename>/etc</filename> with the same name as a configuration file in
78 <filename>/usr/lib</filename>, pointing to <filename>/dev/null</filename>,
79 disables the configuration file entirely.</para>
80
102bd40e
LP
81 </refsect1>
82
83 <refsect1>
84 <title>[Match] Section Options</title>
85
eac684ef
TG
86 <para>The network file contains a <literal>[Match]</literal> section,
87 which determines if a given network file may be applied to a given device;
88 and a <literal>[Network]</literal> section specifying how the device should
89 be configured. The first (in lexical order) of the network files that
90 matches a given device is applied.</para>
91
92 <para>A network file is said to match a device if each of the entries in the
93 <literal>[Match]</literal> section matches, or if the section is empty.
94 The following keys are accepted:</para>
95
96 <variablelist class='network-directives'>
97 <varlistentry>
98 <term><varname>MACAddress=</varname></term>
99 <listitem>
100 <para>The hardware address.</para>
101 </listitem>
102 </varlistentry>
103 <varlistentry>
104 <term><varname>Path=</varname></term>
105 <listitem>
106 <para>The persistent path, as exposed by the udev
107 property <literal>ID_PATH</literal>. May contain shell
108 style globs.</para>
109 </listitem>
110 </varlistentry>
111 <varlistentry>
112 <term><varname>Driver=</varname></term>
113 <listitem>
114 <para>The driver currently bound to the device, as
115 exposed by the udev property <literal>DRIVER</literal>
116 of its parent device, or if that is not set the driver
117 as exposed by <literal>ethtool -i</literal> of the
118 device itself.</para>
119 </listitem>
120 </varlistentry>
121 <varlistentry>
122 <term><varname>Type=</varname></term>
123 <listitem>
124 <para>The device type, as exposed by the udev property
125 <literal>DEVTYPE</literal>.</para>
126 </listitem>
127 </varlistentry>
128 <varlistentry>
129 <term><varname>Name=</varname></term>
130 <listitem>
131 <para>The device name, as exposed by the udev property
132 <literal>INTERFACE</literal>. May contain shell style
133 globs.</para>
134 </listitem>
135 </varlistentry>
136 <varlistentry>
137 <term><varname>Host=</varname></term>
138 <listitem>
139 <para>Matches against the hostname or machine ID of the
140 host. See <literal>ConditionHost=</literal> in
141 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
142 for details.
143 </para>
144 </listitem>
145 </varlistentry>
146 <varlistentry>
147 <term><varname>Virtualization=</varname></term>
148 <listitem>
149 <para>Checks whether the system is executed in a virtualized
150 environment and optionally test whether it is a specific
151 implementation. See <literal>ConditionVirtualization=</literal> in
152 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
153 for details.
154 </para>
155 </listitem>
156 </varlistentry>
157 <varlistentry>
158 <term><varname>KernelCommandLine=</varname></term>
159 <listitem>
160 <para>Checks whether a specific kernel command line option is
161 set (or if prefixed with the exclamation mark unset). See
162 <literal>ConditionKernelCommandLine=</literal> in
163 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
164 for details.
165 </para>
166 </listitem>
167 </varlistentry>
168 <varlistentry>
169 <term><varname>Architecture=</varname></term>
170 <listitem>
171 <para>Checks whether the system is running on a specific
172 architecture. See <literal>ConditionArchitecture=</literal> in
173 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
174 for details.
175 </para>
176 </listitem>
177 </varlistentry>
178 </variablelist>
179
102bd40e
LP
180 </refsect1>
181
182 <refsect1>
183 <title>[Network] Section Options</title>
184
eac684ef
TG
185 <para>The <literal>[Network]</literal> section accepts the following keys:</para>
186
187 <variablelist class='network-directives'>
188 <varlistentry>
189 <term><varname>Description=</varname></term>
190 <listitem>
191 <para>A description of the device. This is only used for
192 presentation purposes.</para>
193 </listitem>
194 </varlistentry>
195 <varlistentry>
196 <term><varname>DHCP=</varname></term>
197 <listitem>
ed942a9e
TG
198 <para>Enables DHCPv4 and/or DHCPv6 support. Accepts
199 <literal>both</literal>, <literal>none</literal>,
200 <literal>v4</literal> or <literal>v6</literal>.</para>
eac684ef
TG
201 </listitem>
202 </varlistentry>
0a8a0fad
TG
203 <varlistentry>
204 <term><varname>DHCPServer=</varname></term>
205 <listitem>
206 <para>A boolean. Enables a basic DHCPv4 server on the
207 device. Mostly useful for handing out leases to container
208 instances.</para>
209 </listitem>
210 </varlistentry>
848e3e24
UTL
211 <varlistentry>
212 <term><varname>IPv4LL=</varname></term>
213 <listitem>
214 <para>A boolean. When true, enables IPv4 link-local support.
848e3e24
UTL
215 </para>
216 </listitem>
217 </varlistentry>
bfa695b5
TG
218 <varlistentry>
219 <term><varname>IPv4LLRoute=</varname></term>
220 <listitem>
221 <para>A boolean. When true, sets up the route needed for
222 non-IPv4LL hosts to communicate with IPv4LL-only hosts. Defaults
ccf1c029 223 to false.
bfa695b5
TG
224 </para>
225 </listitem>
226 </varlistentry>
bd8f6538
TG
227 <varlistentry>
228 <term><varname>LLMNR=</varname></term>
229 <listitem>
230 <para>A boolean or <literal>resolve</literal>. When true, enables
231 Link-Local Multicast Name Resolution on the link, when set to
232 <literal>resolve</literal> only resolution is enabled, but not
233 announcement. Defaults to true.</para>
234 </listitem>
235 </varlistentry>
eac684ef
TG
236 <varlistentry>
237 <term><varname>Address=</varname></term>
238 <listitem>
239 <para>A static IPv4 or IPv6 address and its prefix length,
240 separated by a <literal>/</literal> character. Specify this
241 key more than once to configure several addresses.
242 The format of the address must be as described in
cb44f25c
TG
243 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
244 This is a short-hand for an [Address] section only containing
245 an Address key (see below). This option may be specified
246 more than once.
eac684ef 247 </para>
4bb278e5
LP
248
249 <para>If the specified
250 address is 0.0.0.0
251 (for IPv4) or [::]
8d0e0ddd 252 (for IPv6), a new
4bb278e5
LP
253 address range of the
254 requested size is
255 automatically
256 allocated from a
257 system-wide pool of
258 unused ranges. The
259 allocated range is
260 checked against all
261 current network
262 interfaces and all
263 known network
264 configuration files to
45df8656 265 avoid address range
4bb278e5
LP
266 conflicts. The default
267 system-wide pool
268 consists of
269 192.168.0.0/16,
270 172.16.0.0/12 and
271 10.0.0.0/8 for IPv4,
45df8656 272 and fc00::/7 for
4bb278e5
LP
273 IPv6. This
274 functionality is
275 useful to manage a
276 large number of
277 dynamically created
278 network interfaces
279 with the same network
280 configuration and
281 automatic address
282 range
283 assignment.</para>
284
eac684ef
TG
285 </listitem>
286 </varlistentry>
287 <varlistentry>
288 <term><varname>Gateway=</varname></term>
289 <listitem>
290 <para>The gateway address, which must be in the format described in
cb44f25c
TG
291 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
292 This is a short-hand for a [Route] section only containing a Gateway
293 key. This option may be specified more than once.</para>
eac684ef
TG
294 </listitem>
295 </varlistentry>
296 <varlistentry>
297 <term><varname>DNS=</varname></term>
298 <listitem>
299 <para>A DNS server address, which must be in the format described in
06f021a8 300 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
cb44f25c 301 This option may be specified more than once.</para>
eac684ef
TG
302 </listitem>
303 </varlistentry>
6192b846
TG
304 <varlistentry>
305 <term><varname>Domains=</varname></term>
306 <listitem>
307 <para>The domains used for DNS resolution over this link.</para>
308 </listitem>
309 </varlistentry>
310 <varlistentry>
311 <term><varname>NTP=</varname></term>
312 <listitem>
313 <para>An NTP server address. This option may be specified more than once.</para>
314 </listitem>
315 </varlistentry>
eac684ef
TG
316 <varlistentry>
317 <term><varname>Bridge=</varname></term>
318 <listitem>
319 <para>The name of the bridge to add the link to.</para>
320 </listitem>
321 </varlistentry>
322 <varlistentry>
323 <term><varname>Bond=</varname></term>
324 <listitem>
325 <para>The name of the bond to add the link to.</para>
326 </listitem>
327 </varlistentry>
328 <varlistentry>
329 <term><varname>VLAN=</varname></term>
330 <listitem>
331 <para>The name of a VLAN to create on the link. This option
332 may be specified more than once.</para>
333 </listitem>
334 </varlistentry>
fe6b2d55
TG
335 <varlistentry>
336 <term><varname>MACVLAN=</varname></term>
337 <listitem>
338 <para>The name of a MACVLAN to create on the link. This option
339 may be specified more than once.</para>
340 </listitem>
341 </varlistentry>
0a8a0fad
TG
342 <varlistentry>
343 <term><varname>VXLAN=</varname></term>
344 <listitem>
345 <para>The name of a VXLAN to create on the link. This option
346 may be specified more than once.</para>
347 </listitem>
348 </varlistentry>
349 <varlistentry>
350 <term><varname>Tunnel=</varname></term>
351 <listitem>
352 <para>The name of a Tunnel to create on the link. This option
353 may be specified more than once.</para>
354 </listitem>
355 </varlistentry>
eac684ef
TG
356 </variablelist>
357
102bd40e
LP
358 </refsect1>
359
360 <refsect1>
361 <title>[Address] Section Options</title>
362
eac684ef
TG
363 <para>An <literal>[Address]</literal> section accepts the following keys.
364 Specify several <literal>[Address]</literal> sections to configure several
365 addresses.</para>
366
367 <variablelist class='network-directives'>
368 <varlistentry>
369 <term><varname>Address=</varname></term>
370 <listitem>
371 <para>As in the <literal>[Network]</literal> section. This key is mandatory.</para>
372 </listitem>
373 </varlistentry>
1a43ddc8
TG
374 <varlistentry>
375 <term><varname>Peer=</varname></term>
376 <listitem>
377 <para>The peer address in a point-to-point connection. Accepts the same format as
378 the <literal>Address</literal> key.</para>
379 </listitem>
380 </varlistentry>
eac684ef
TG
381 <varlistentry>
382 <term><varname>Broadcast=</varname></term>
383 <listitem>
384 <para>The broadcast address, which must be in the format described in
70a44afe
JE
385 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
386 This key only applies to IPv4 addresses. If it is not given, it is
eac684ef
TG
387 derived from the <literal>Address</literal> key.</para>
388 </listitem>
389 </varlistentry>
390 <varlistentry>
391 <term><varname>Label=</varname></term>
392 <listitem>
393 <para>An address label.</para>
394 </listitem>
395 </varlistentry>
396 </variablelist>
102bd40e 397 </refsect1>
eac684ef 398
102bd40e
LP
399 <refsect1>
400 <title>[Route] Section Options</title>
eac684ef
TG
401 <para>The <literal>[Route]</literal> section accepts the following keys. Specify
402 several <literal>[Route]</literal> sections to configure several routes.</para>
403
404 <variablelist class='network-directives'>
405 <varlistentry>
406 <term><varname>Gateway=</varname></term>
407 <listitem>
408 <para>As in the <literal>[Network]</literal> section. This key is mandatory.</para>
409 </listitem>
410 </varlistentry>
411 <varlistentry>
412 <term><varname>Destination=</varname></term>
413 <listitem>
414 <para>The destination prefix of the route. Possibly followed by a slash and the
0566ef68 415 prefixlength. If omitted, a full-length host route is assumed.</para>
eac684ef 416 </listitem>
5d8e593d
SS
417 </varlistentry>
418 <varlistentry>
419 <term><varname>Metric=</varname></term>
420 <listitem>
421 <para>The metric of the route. An unsigned integer</para>
422 </listitem>
eac684ef
TG
423 </varlistentry>
424 </variablelist>
102bd40e 425 </refsect1>
eac684ef 426
102bd40e 427 <refsect1>
ed942a9e
TG
428 <title>[DHCP] Section Options</title>
429 <para>The <literal>[DHCP]</literal> section accepts the following keys:</para>
eac684ef
TG
430
431 <variablelist class='network-directives'>
432 <varlistentry>
433 <term><varname>UseDNS=</varname></term>
434 <listitem>
435 <para>When true (the default), the DNS servers received from the DHCP server will
436 be used and take precedence over any statically configured ones.</para>
437 </listitem>
438 </varlistentry>
439 <varlistentry>
440 <term><varname>UseMTU=</varname></term>
441 <listitem>
442 <para>When true, the interface maximum transmission unit from the DHCP server will
443 be used on the current link. Defaults to false.</para>
444 </listitem>
445 </varlistentry>
4cc7a82c
EY
446 <varlistentry>
447 <term><varname>SendHostname=</varname></term>
448 <listitem>
449 <para>When true (the default), the machine's hostname will be sent to the DHCP
450 server</para>
451 </listitem>
452 </varlistentry>
eac684ef
TG
453 <varlistentry>
454 <term><varname>UseHostname=</varname></term>
455 <listitem>
456 <para>When true (the default), the hostname received from the DHCP server
457 will be used as the transient hostname.</para>
458 </listitem>
1bd27a45
TG
459 </varlistentry>
460 <varlistentry>
ad0734e8 461 <term><varname>UseDomains=</varname></term>
1bd27a45
TG
462 <listitem>
463 <para>When true (not the default), the domain name received from the DHCP server
464 will be used for DNS resolution over this link.</para>
465 </listitem>
eac684ef 466 </varlistentry>
e1ea665e
EY
467 <varlistentry>
468 <term><varname>UseRoutes=</varname></term>
469 <listitem>
470 <para>When true (the default), the static routes will be requested from the DHCP server
471 and added to the routing table with metric of 1024.</para>
472 </listitem>
473 </varlistentry>
eac684ef
TG
474 <varlistentry>
475 <term><varname>CriticalConnection=</varname></term>
476 <listitem>
477 <para>When true, the connection will never be torn down even if the DHCP lease
478 expires. This is contrary to the DHCP specification, but may be the best choice
479 if, say, the root filesystem relies on this connection. Defaults to false.</para>
480 </listitem>
481 </varlistentry>
f5de5b00 482 <varlistentry>
edb85f0d
SS
483 <term><varname>VendorClassIdentifier=</varname></term>
484 <listitem>
485 <para>The vendor class identifier used to identify vendor type and configuration.</para>
486 </listitem>
487 </varlistentry>
f5de5b00
TG
488 <varlistentry>
489 <term><varname>RequestBroadcast=</varname></term>
490 <listitem>
491 <para>Request the server to use broadcast messages before the IP address has been
492 configured. This is necessary for devices that cannot receive RAW packets, or that
493 cannot receive packets at all before an IP address has been configured. On the other
494 hand, this must not be enabled on networks where broadcasts are filtered out.</para>
495 </listitem>
496 </varlistentry>
84b5b79a
AG
497 <varlistentry>
498 <term><varname>RouteMetric=</varname></term>
499 <listitem>
500 <para>Set the routing metric for routes specified by the DHCP server.</para>
501 </listitem>
502 </varlistentry>
eac684ef
TG
503 </variablelist>
504
505 </refsect1>
506
507 <refsect1>
508 <title>Example</title>
509 <example>
510 <title>/etc/systemd/network/50-static.network</title>
511
512 <programlisting>[Match]
513Name=enp2s0
514
515[Network]
516Address=192.168.0.15/24
517Gateway=192.168.0.1</programlisting>
518 </example>
519
520 <example>
521 <title>/etc/systemd/network/80-dhcp.network</title>
522
523 <programlisting>[Match]
524Name=en*
525
526[Network]
b85595b5 527DHCP=both</programlisting>
eac684ef
TG
528 </example>
529
f47c5c47 530 <example>
531 <title>/etc/systemd/network/bridge-static.network</title>
532
533 <programlisting>[Match]
534Name=bridge0
535
536[Network]
537Address=192.168.0.15/24
538Gateway=192.168.0.1
539DNS=192.168.0.1</programlisting>
540 </example>
541
542 <example>
543 <title>/etc/systemd/network/bridge-slave-interface.network</title>
544
545 <programlisting>[Match]
546Name=enp2s0
547
548[Network]
549Bridge=bridge0</programlisting>
550 </example>
0a8a0fad
TG
551 <example>
552 <title>/etc/systemd/network/ipip.network</title>
553
554 <programlisting>[Match]
555Name=em1
556
557[Network]
558Tunnel=ipip-tun</programlisting>
559 </example>
560
561 <example>
562 <title>/etc/systemd/network/sit.network</title>
563
564 <programlisting>[Match]
565Name=em1
566
567[Network]
568Tunnel=sit-tun</programlisting>
569 </example>
570
571 <example>
572 <title>/etc/systemd/network/gre.network</title>
573
574 <programlisting>[Match]
575Name=em1
576
577[Network]
578Tunnel=gre-tun</programlisting>
579 </example>
580
581 <example>
582 <title>/etc/systemd/network/vti.network</title>
583
584 <programlisting>[Match]
585Name=em1
586
587[Network]
588Tunnel=vti-tun</programlisting>
589 </example>
eac684ef
TG
590 </refsect1>
591
592 <refsect1>
593 <title>See Also</title>
594 <para>
595 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
f47c5c47 596 <citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
597 <citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry>
eac684ef
TG
598 </para>
599 </refsect1>
600
601</refentry>