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