]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.network.xml
networkd: add FDB support
[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
c106cc36
TG
182 <refsect1>
183 <title>[Link] Section Options</title>
184
185 <para> The <literal>[Link]</literal> section accepts the following keys:</para>
186
187 <variablelist class='network-directives'>
188 <varlistentry>
189 <term><varname>MACAddress=</varname></term>
190 <listitem>
191 <para>The hardware address.</para>
192 </listitem>
193 </varlistentry>
194 <varlistentry>
195 <term><varname>MTUBytes=</varname></term>
196 <listitem>
197 <para>The maximum transmission unit in bytes to
198 set for the device. The usual suffixes K, M, G,
199 are supported and are understood to the base of
200 1024.</para>
201 </listitem>
202 </varlistentry>
203 </variablelist>
204 </refsect1>
205
102bd40e
LP
206 <refsect1>
207 <title>[Network] Section Options</title>
208
eac684ef
TG
209 <para>The <literal>[Network]</literal> section accepts the following keys:</para>
210
211 <variablelist class='network-directives'>
212 <varlistentry>
213 <term><varname>Description=</varname></term>
214 <listitem>
215 <para>A description of the device. This is only used for
216 presentation purposes.</para>
217 </listitem>
218 </varlistentry>
219 <varlistentry>
220 <term><varname>DHCP=</varname></term>
221 <listitem>
ed942a9e
TG
222 <para>Enables DHCPv4 and/or DHCPv6 support. Accepts
223 <literal>both</literal>, <literal>none</literal>,
224 <literal>v4</literal> or <literal>v6</literal>.</para>
eac684ef
TG
225 </listitem>
226 </varlistentry>
0a8a0fad
TG
227 <varlistentry>
228 <term><varname>DHCPServer=</varname></term>
229 <listitem>
230 <para>A boolean. Enables a basic DHCPv4 server on the
231 device. Mostly useful for handing out leases to container
232 instances.</para>
233 </listitem>
234 </varlistentry>
848e3e24
UTL
235 <varlistentry>
236 <term><varname>IPv4LL=</varname></term>
237 <listitem>
238 <para>A boolean. When true, enables IPv4 link-local support.
848e3e24
UTL
239 </para>
240 </listitem>
241 </varlistentry>
bfa695b5
TG
242 <varlistentry>
243 <term><varname>IPv4LLRoute=</varname></term>
244 <listitem>
245 <para>A boolean. When true, sets up the route needed for
246 non-IPv4LL hosts to communicate with IPv4LL-only hosts. Defaults
ccf1c029 247 to false.
bfa695b5
TG
248 </para>
249 </listitem>
250 </varlistentry>
bd8f6538
TG
251 <varlistentry>
252 <term><varname>LLMNR=</varname></term>
253 <listitem>
254 <para>A boolean or <literal>resolve</literal>. When true, enables
255 Link-Local Multicast Name Resolution on the link, when set to
256 <literal>resolve</literal> only resolution is enabled, but not
257 announcement. Defaults to true.</para>
258 </listitem>
259 </varlistentry>
eac684ef
TG
260 <varlistentry>
261 <term><varname>Address=</varname></term>
262 <listitem>
263 <para>A static IPv4 or IPv6 address and its prefix length,
264 separated by a <literal>/</literal> character. Specify this
265 key more than once to configure several addresses.
266 The format of the address must be as described in
cb44f25c
TG
267 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
268 This is a short-hand for an [Address] section only containing
269 an Address key (see below). This option may be specified
270 more than once.
eac684ef 271 </para>
4bb278e5
LP
272
273 <para>If the specified
274 address is 0.0.0.0
275 (for IPv4) or [::]
8d0e0ddd 276 (for IPv6), a new
4bb278e5
LP
277 address range of the
278 requested size is
279 automatically
280 allocated from a
281 system-wide pool of
282 unused ranges. The
283 allocated range is
284 checked against all
285 current network
286 interfaces and all
287 known network
288 configuration files to
45df8656 289 avoid address range
4bb278e5
LP
290 conflicts. The default
291 system-wide pool
292 consists of
293 192.168.0.0/16,
294 172.16.0.0/12 and
295 10.0.0.0/8 for IPv4,
45df8656 296 and fc00::/7 for
4bb278e5
LP
297 IPv6. This
298 functionality is
299 useful to manage a
300 large number of
301 dynamically created
302 network interfaces
303 with the same network
304 configuration and
305 automatic address
306 range
307 assignment.</para>
308
eac684ef
TG
309 </listitem>
310 </varlistentry>
311 <varlistentry>
312 <term><varname>Gateway=</varname></term>
313 <listitem>
314 <para>The gateway address, which must be in the format described in
cb44f25c
TG
315 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
316 This is a short-hand for a [Route] section only containing a Gateway
317 key. This option may be specified more than once.</para>
eac684ef
TG
318 </listitem>
319 </varlistentry>
320 <varlistentry>
321 <term><varname>DNS=</varname></term>
322 <listitem>
323 <para>A DNS server address, which must be in the format described in
06f021a8 324 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
cb44f25c 325 This option may be specified more than once.</para>
eac684ef
TG
326 </listitem>
327 </varlistentry>
6192b846
TG
328 <varlistentry>
329 <term><varname>Domains=</varname></term>
330 <listitem>
331 <para>The domains used for DNS resolution over this link.</para>
332 </listitem>
333 </varlistentry>
334 <varlistentry>
335 <term><varname>NTP=</varname></term>
336 <listitem>
337 <para>An NTP server address. This option may be specified more than once.</para>
338 </listitem>
339 </varlistentry>
eac684ef
TG
340 <varlistentry>
341 <term><varname>Bridge=</varname></term>
342 <listitem>
343 <para>The name of the bridge to add the link to.</para>
344 </listitem>
345 </varlistentry>
346 <varlistentry>
347 <term><varname>Bond=</varname></term>
348 <listitem>
349 <para>The name of the bond to add the link to.</para>
350 </listitem>
351 </varlistentry>
352 <varlistentry>
353 <term><varname>VLAN=</varname></term>
354 <listitem>
355 <para>The name of a VLAN to create on the link. This option
356 may be specified more than once.</para>
357 </listitem>
358 </varlistentry>
fe6b2d55
TG
359 <varlistentry>
360 <term><varname>MACVLAN=</varname></term>
361 <listitem>
362 <para>The name of a MACVLAN to create on the link. This option
363 may be specified more than once.</para>
364 </listitem>
365 </varlistentry>
0a8a0fad
TG
366 <varlistentry>
367 <term><varname>VXLAN=</varname></term>
368 <listitem>
369 <para>The name of a VXLAN to create on the link. This option
370 may be specified more than once.</para>
371 </listitem>
372 </varlistentry>
373 <varlistentry>
374 <term><varname>Tunnel=</varname></term>
375 <listitem>
376 <para>The name of a Tunnel to create on the link. This option
377 may be specified more than once.</para>
378 </listitem>
379 </varlistentry>
eac684ef
TG
380 </variablelist>
381
102bd40e
LP
382 </refsect1>
383
384 <refsect1>
385 <title>[Address] Section Options</title>
386
eac684ef
TG
387 <para>An <literal>[Address]</literal> section accepts the following keys.
388 Specify several <literal>[Address]</literal> sections to configure several
389 addresses.</para>
390
391 <variablelist class='network-directives'>
392 <varlistentry>
393 <term><varname>Address=</varname></term>
394 <listitem>
395 <para>As in the <literal>[Network]</literal> section. This key is mandatory.</para>
396 </listitem>
397 </varlistentry>
1a43ddc8
TG
398 <varlistentry>
399 <term><varname>Peer=</varname></term>
400 <listitem>
401 <para>The peer address in a point-to-point connection. Accepts the same format as
402 the <literal>Address</literal> key.</para>
403 </listitem>
404 </varlistentry>
eac684ef
TG
405 <varlistentry>
406 <term><varname>Broadcast=</varname></term>
407 <listitem>
408 <para>The broadcast address, which must be in the format described in
70a44afe
JE
409 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
410 This key only applies to IPv4 addresses. If it is not given, it is
eac684ef
TG
411 derived from the <literal>Address</literal> key.</para>
412 </listitem>
413 </varlistentry>
414 <varlistentry>
415 <term><varname>Label=</varname></term>
416 <listitem>
417 <para>An address label.</para>
418 </listitem>
419 </varlistentry>
420 </variablelist>
102bd40e 421 </refsect1>
eac684ef 422
102bd40e
LP
423 <refsect1>
424 <title>[Route] Section Options</title>
eac684ef
TG
425 <para>The <literal>[Route]</literal> section accepts the following keys. Specify
426 several <literal>[Route]</literal> sections to configure several routes.</para>
427
428 <variablelist class='network-directives'>
429 <varlistentry>
430 <term><varname>Gateway=</varname></term>
431 <listitem>
8c12bb07 432 <para>As in the <literal>[Network]</literal> section.</para>
eac684ef
TG
433 </listitem>
434 </varlistentry>
435 <varlistentry>
436 <term><varname>Destination=</varname></term>
437 <listitem>
438 <para>The destination prefix of the route. Possibly followed by a slash and the
0566ef68 439 prefixlength. If omitted, a full-length host route is assumed.</para>
eac684ef 440 </listitem>
5d8e593d 441 </varlistentry>
9e7e4408
TG
442 <varlistentry>
443 <term><varname>Source=</varname></term>
444 <listitem>
445 <para>The source prefix of the route. Possibly followed by a slash and the
446 prefixlength. If omitted, a full-length host route is assumed.</para>
447 </listitem>
448 </varlistentry>
5d8e593d
SS
449 <varlistentry>
450 <term><varname>Metric=</varname></term>
451 <listitem>
452 <para>The metric of the route. An unsigned integer</para>
453 </listitem>
eac684ef
TG
454 </varlistentry>
455 </variablelist>
102bd40e 456 </refsect1>
eac684ef 457
102bd40e 458 <refsect1>
ed942a9e
TG
459 <title>[DHCP] Section Options</title>
460 <para>The <literal>[DHCP]</literal> section accepts the following keys:</para>
eac684ef
TG
461
462 <variablelist class='network-directives'>
463 <varlistentry>
464 <term><varname>UseDNS=</varname></term>
465 <listitem>
466 <para>When true (the default), the DNS servers received from the DHCP server will
467 be used and take precedence over any statically configured ones.</para>
468 </listitem>
469 </varlistentry>
470 <varlistentry>
471 <term><varname>UseMTU=</varname></term>
472 <listitem>
473 <para>When true, the interface maximum transmission unit from the DHCP server will
474 be used on the current link. Defaults to false.</para>
475 </listitem>
476 </varlistentry>
4cc7a82c
EY
477 <varlistentry>
478 <term><varname>SendHostname=</varname></term>
479 <listitem>
480 <para>When true (the default), the machine's hostname will be sent to the DHCP
481 server</para>
482 </listitem>
483 </varlistentry>
eac684ef
TG
484 <varlistentry>
485 <term><varname>UseHostname=</varname></term>
486 <listitem>
487 <para>When true (the default), the hostname received from the DHCP server
488 will be used as the transient hostname.</para>
489 </listitem>
1bd27a45
TG
490 </varlistentry>
491 <varlistentry>
ad0734e8 492 <term><varname>UseDomains=</varname></term>
1bd27a45
TG
493 <listitem>
494 <para>When true (not the default), the domain name received from the DHCP server
495 will be used for DNS resolution over this link.</para>
496 </listitem>
eac684ef 497 </varlistentry>
e1ea665e
EY
498 <varlistentry>
499 <term><varname>UseRoutes=</varname></term>
500 <listitem>
501 <para>When true (the default), the static routes will be requested from the DHCP server
502 and added to the routing table with metric of 1024.</para>
503 </listitem>
504 </varlistentry>
eac684ef
TG
505 <varlistentry>
506 <term><varname>CriticalConnection=</varname></term>
507 <listitem>
508 <para>When true, the connection will never be torn down even if the DHCP lease
509 expires. This is contrary to the DHCP specification, but may be the best choice
510 if, say, the root filesystem relies on this connection. Defaults to false.</para>
511 </listitem>
512 </varlistentry>
f5de5b00 513 <varlistentry>
edb85f0d
SS
514 <term><varname>VendorClassIdentifier=</varname></term>
515 <listitem>
516 <para>The vendor class identifier used to identify vendor type and configuration.</para>
517 </listitem>
518 </varlistentry>
f5de5b00
TG
519 <varlistentry>
520 <term><varname>RequestBroadcast=</varname></term>
521 <listitem>
522 <para>Request the server to use broadcast messages before the IP address has been
523 configured. This is necessary for devices that cannot receive RAW packets, or that
524 cannot receive packets at all before an IP address has been configured. On the other
525 hand, this must not be enabled on networks where broadcasts are filtered out.</para>
526 </listitem>
527 </varlistentry>
84b5b79a
AG
528 <varlistentry>
529 <term><varname>RouteMetric=</varname></term>
530 <listitem>
531 <para>Set the routing metric for routes specified by the DHCP server.</para>
532 </listitem>
533 </varlistentry>
eac684ef
TG
534 </variablelist>
535
536 </refsect1>
537
e1853b00 538 <refsect1>
7303ec8f
LP
539 <title>[Bridge] Section Options</title>
540 <para>The <literal>[Bridge]</literal> section accepts the following keys.</para>
e1853b00
SS
541 <variablelist class='network-directives'>
542 <varlistentry>
543 <term><varname>Cost=</varname></term>
544 <listitem>
545 <para>Each port in a bridge may have different speed. Cost is used to decide which link to use. Faster interfaces should have lower costs</para>
546 </listitem>
547 </varlistentry>
548 </variablelist>
549 </refsect1>
550
b98b483b
AR
551 <refsect1>
552 <title>[BridgeFDB] Section Options</title>
553 <para>The <literal>[BridgeFDB]</literal> section manages the forwarding database table of a port and accepts the following keys. Specify
554 several <literal>[BridgeFDB]</literal> sections to configure several static MAC table entries.</para>
555
556 <variablelist class='network-directives'>
557 <varlistentry>
558 <term><varname>MACAddress=</varname></term>
559 <listitem>
560 <para>As in the <literal>[Network]</literal> section. This key is mandatory.</para>
561 </listitem>
562 </varlistentry>
563 <varlistentry>
564 <term><varname>VLANId=</varname></term>
565 <listitem>
566 <para>The VLAN Id for the new static MAC table entry.
567 If omitted, no VLAN Id info is appended to the new static MAC table entry.</para>
568 </listitem>
569 </varlistentry>
570 </variablelist>
571 </refsect1>
572
eac684ef
TG
573 <refsect1>
574 <title>Example</title>
575 <example>
576 <title>/etc/systemd/network/50-static.network</title>
577
578 <programlisting>[Match]
579Name=enp2s0
580
581[Network]
582Address=192.168.0.15/24
583Gateway=192.168.0.1</programlisting>
584 </example>
585
586 <example>
587 <title>/etc/systemd/network/80-dhcp.network</title>
588
589 <programlisting>[Match]
590Name=en*
591
592[Network]
b85595b5 593DHCP=both</programlisting>
eac684ef
TG
594 </example>
595
f47c5c47 596 <example>
597 <title>/etc/systemd/network/bridge-static.network</title>
598
599 <programlisting>[Match]
600Name=bridge0
601
602[Network]
603Address=192.168.0.15/24
604Gateway=192.168.0.1
605DNS=192.168.0.1</programlisting>
606 </example>
607
608 <example>
609 <title>/etc/systemd/network/bridge-slave-interface.network</title>
610
611 <programlisting>[Match]
612Name=enp2s0
613
614[Network]
615Bridge=bridge0</programlisting>
616 </example>
0a8a0fad
TG
617 <example>
618 <title>/etc/systemd/network/ipip.network</title>
619
620 <programlisting>[Match]
621Name=em1
622
623[Network]
624Tunnel=ipip-tun</programlisting>
625 </example>
626
627 <example>
628 <title>/etc/systemd/network/sit.network</title>
629
630 <programlisting>[Match]
631Name=em1
632
633[Network]
634Tunnel=sit-tun</programlisting>
635 </example>
636
637 <example>
638 <title>/etc/systemd/network/gre.network</title>
639
640 <programlisting>[Match]
641Name=em1
642
643[Network]
644Tunnel=gre-tun</programlisting>
645 </example>
646
647 <example>
648 <title>/etc/systemd/network/vti.network</title>
649
650 <programlisting>[Match]
651Name=em1
652
653[Network]
654Tunnel=vti-tun</programlisting>
655 </example>
eac684ef
TG
656 </refsect1>
657
658 <refsect1>
659 <title>See Also</title>
660 <para>
661 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
f47c5c47 662 <citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
663 <citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry>
eac684ef
TG
664 </para>
665 </refsect1>
666
667</refentry>