]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.network.xml
resolved: make MulticastDNS support configurable in resolved.conf
[thirdparty/systemd.git] / man / systemd.network.xml
CommitLineData
ad943783 1<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
eac684ef 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 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
12b42c76 67 <filename>/usr/lib/systemd/network</filename>, the volatile
798d3a52
ZJS
68 runtime network directory
69 <filename>/run/systemd/network</filename> and the local
70 administration network directory
12b42c76 71 <filename>/etc/systemd/network</filename>. All configuration files
798d3a52
ZJS
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
12b42c76 77 name in <filename>/usr/lib</filename>. This can be used to
798d3a52 78 override a system-supplied configuration file with a local file if
57e27ec0 79 needed. As a special case, an empty file (file size 0) or symlink
b938cb90 80 with the same name pointing to <filename>/dev/null</filename>
a8eaaee7 81 disables the configuration file entirely (it is "masked").</para>
798d3a52
ZJS
82 </refsect1>
83
84 <refsect1>
85 <title>[Match] Section Options</title>
86
87 <para>The network file contains a <literal>[Match]</literal>
88 section, which determines if a given network file may be applied
89 to a given device; and a <literal>[Network]</literal> section
90 specifying how the device should be configured. The first (in
91 lexical order) of the network files that matches a given device
a22e1850
LP
92 is applied, all later files are ignored, even if they match as
93 well.</para>
798d3a52
ZJS
94
95 <para>A network file is said to match a device if each of the
96 entries in the <literal>[Match]</literal> section matches, or if
97 the section is empty. The following keys are accepted:</para>
98
99 <variablelist class='network-directives'>
100 <varlistentry>
101 <term><varname>MACAddress=</varname></term>
102 <listitem>
103 <para>The hardware address.</para>
104 </listitem>
105 </varlistentry>
106 <varlistentry>
107 <term><varname>Path=</varname></term>
108 <listitem>
5256e00e
TG
109 <para>A whitespace-separated list of shell-style globs
110 matching the persistent path, as exposed by the udev
111 property <literal>ID_PATH</literal>.</para>
798d3a52
ZJS
112 </listitem>
113 </varlistentry>
114 <varlistentry>
115 <term><varname>Driver=</varname></term>
116 <listitem>
5256e00e
TG
117 <para>A whitespace-separated list of shell-style globs
118 matching the driver currently bound to the device, as
798d3a52
ZJS
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>
5256e00e
TG
128 <para>A whitespace-separated list of shell-style globs
129 matching the device type, as exposed by the udev property
798d3a52
ZJS
130 <literal>DEVTYPE</literal>.</para>
131 </listitem>
132 </varlistentry>
133 <varlistentry>
134 <term><varname>Name=</varname></term>
135 <listitem>
5256e00e
TG
136 <para>A whitespace-separated list of shell-style globs
137 matching the device name, as exposed by the udev property
138 <literal>INTERFACE</literal>.</para>
798d3a52
ZJS
139 </listitem>
140 </varlistentry>
141 <varlistentry>
142 <term><varname>Host=</varname></term>
143 <listitem>
144 <para>Matches against the hostname or machine ID of the
145 host. See <literal>ConditionHost=</literal> in
146 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
147 for details.
148 </para>
149 </listitem>
150 </varlistentry>
151 <varlistentry>
152 <term><varname>Virtualization=</varname></term>
153 <listitem>
154 <para>Checks whether the system is executed in a virtualized
155 environment and optionally test whether it is a specific
156 implementation. See <literal>ConditionVirtualization=</literal> in
157 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
158 for details.
159 </para>
160 </listitem>
161 </varlistentry>
162 <varlistentry>
163 <term><varname>KernelCommandLine=</varname></term>
164 <listitem>
165 <para>Checks whether a specific kernel command line option is
166 set (or if prefixed with the exclamation mark unset). See
167 <literal>ConditionKernelCommandLine=</literal> in
168 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
169 for details.
170 </para>
171 </listitem>
172 </varlistentry>
173 <varlistentry>
174 <term><varname>Architecture=</varname></term>
175 <listitem>
176 <para>Checks whether the system is running on a specific
177 architecture. See <literal>ConditionArchitecture=</literal> in
178 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
179 for details.
180 </para>
181 </listitem>
182 </varlistentry>
183 </variablelist>
184
185 </refsect1>
186
187 <refsect1>
188 <title>[Link] Section Options</title>
189
190 <para> The <literal>[Link]</literal> section accepts the following keys:</para>
191
192 <variablelist class='network-directives'>
193 <varlistentry>
194 <term><varname>MACAddress=</varname></term>
195 <listitem>
196 <para>The hardware address.</para>
197 </listitem>
198 </varlistentry>
199 <varlistentry>
200 <term><varname>MTUBytes=</varname></term>
201 <listitem>
202 <para>The maximum transmission unit in bytes to set for the
203 device. The usual suffixes K, M, G, are supported and are
204 understood to the base of 1024.</para>
205 </listitem>
206 </varlistentry>
207 </variablelist>
208 </refsect1>
209
210 <refsect1>
211 <title>[Network] Section Options</title>
212
213 <para>The <literal>[Network]</literal> section accepts the following keys:</para>
214
215 <variablelist class='network-directives'>
216 <varlistentry>
217 <term><varname>Description=</varname></term>
218 <listitem>
219 <para>A description of the device. This is only used for
220 presentation purposes.</para>
221 </listitem>
222 </varlistentry>
223 <varlistentry>
224 <term><varname>DHCP=</varname></term>
225 <listitem>
ad943783 226 <para>Enables DHCPv4 and/or DHCPv6 client support. Accepts
798d3a52
ZJS
227 <literal>yes</literal>, <literal>no</literal>,
228 <literal>ipv4</literal>, or <literal>ipv6</literal>.</para>
e88d8021 229
f5a8c43f 230 <para>Note that DHCPv6 will by default be triggered by Router
7f3fdb7f 231 Advertisement, if that is enabled, regardless of this parameter.
f5a8c43f
TG
232 By enabling DHCPv6 support explicitly, the DHCPv6 client will
233 be started regardless of the presence of routers on the link,
234 or what flags the routers pass. See
235 <literal>IPv6AcceptRouterAdvertisements=</literal>.</para>
236
237 <para>Furthermore, note that by default the domain name
e88d8021
ZJS
238 specified through DHCP is not used for name resolution.
239 See option <option>UseDomains=</option> below.</para>
798d3a52
ZJS
240 </listitem>
241 </varlistentry>
242 <varlistentry>
243 <term><varname>DHCPServer=</varname></term>
244 <listitem>
ad943783
LP
245 <para>A boolean. Enables DHCPv4 server support. Defaults
246 to <literal>no</literal>. Further settings for the DHCP
247 server may be set in the <literal>[DHCPServer]</literal>
248 section described below.</para>
798d3a52
ZJS
249 </listitem>
250 </varlistentry>
251 <varlistentry>
56fd6bf7 252 <term><varname>LinkLocalAddressing=</varname></term>
798d3a52 253 <listitem>
d0d6a4cd
TG
254 <para>Enables link-local address autoconfiguration. Accepts
255 <literal>yes</literal>, <literal>no</literal>,
256 <literal>ipv4</literal>, or <literal>ipv6</literal>. Defaults to
257 <literal>ipv6</literal>.</para>
798d3a52
ZJS
258 </listitem>
259 </varlistentry>
260 <varlistentry>
261 <term><varname>IPv4LLRoute=</varname></term>
262 <listitem>
263 <para>A boolean. When true, sets up the route needed for
264 non-IPv4LL hosts to communicate with IPv4LL-only hosts. Defaults
265 to false.
266 </para>
267 </listitem>
268 </varlistentry>
269 <varlistentry>
113bfde1
TG
270 <term><varname>IPv6Token=</varname></term>
271 <listitem>
272 <para>An IPv6 address with the top 64 bits unset. When set, indicates the
a8eaaee7 273 64-bit interface part of SLAAC IPv6 addresses for this link. By default,
113bfde1
TG
274 it is autogenerated.</para>
275 </listitem>
276 </varlistentry>
277 <varlistentry>
798d3a52
ZJS
278 <term><varname>LLMNR=</varname></term>
279 <listitem>
aaa297d4
LP
280 <para>A boolean or <literal>resolve</literal>. When true,
281 enables <ulink
282 url="https://tools.ietf.org/html/rfc4795">Link-Local
283 Multicast Name Resolution</ulink> on the link. When set to
284 <literal>resolve</literal>, only resolution is enabled,
285 but not host registration and announcement. Defaults to
286 true. This setting is read by
287 <citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
288 </listitem>
289 </varlistentry>
290 <varlistentry>
291 <term><varname>MulticastDNS=</varname></term>
292 <listitem>
293 <para>A boolean or <literal>resolve</literal>. When true,
294 enables <ulink
295 url="https://tools.ietf.org/html/rfc6762">Multicast
296 DNS</ulink> support on the link. When set to
297 <literal>resolve</literal>, only resolution is enabled,
298 but not host or service registration and
299 announcement. Defaults to false. This setting is read by
300 <citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
798d3a52
ZJS
301 </listitem>
302 </varlistentry>
303 <varlistentry>
304 <term><varname>LLDP=</varname></term>
305 <listitem>
306 <para>A boolean. When true, enables LLDP link receive support.
307 </para>
308 </listitem>
309 </varlistentry>
0d4ad91d
AR
310 <varlistentry>
311 <term><varname>BindCarrier=</varname></term>
312 <listitem>
313 <para>A port or a list of ports. When set, controls the
dd2b607b 314 behavior of the current interface. When all ports in the list
0d4ad91d
AR
315 are in an operational down state, the current interface is brought
316 down. When at least one port has carrier, the current interface
317 is brought up.
318 </para>
319 </listitem>
320 </varlistentry>
798d3a52
ZJS
321 <varlistentry>
322 <term><varname>Address=</varname></term>
323 <listitem>
324 <para>A static IPv4 or IPv6 address and its prefix length,
325 separated by a <literal>/</literal> character. Specify
326 this key more than once to configure several addresses.
327 The format of the address must be as described in
3ba3a79d 328 <citerefentry project='man-pages'><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
798d3a52
ZJS
329 This is a short-hand for an [Address] section only
330 containing an Address key (see below). This option may be
331 specified more than once.
332 </para>
333
334 <para>If the specified address is 0.0.0.0 (for IPv4) or
335 [::] (for IPv6), a new address range of the requested size
336 is automatically allocated from a system-wide pool of
337 unused ranges. The allocated range is checked against all
338 current network interfaces and all known network
339 configuration files to avoid address range conflicts. The
340 default system-wide pool consists of 192.168.0.0/16,
341 172.16.0.0/12 and 10.0.0.0/8 for IPv4, and fc00::/7 for
342 IPv6. This functionality is useful to manage a large
343 number of dynamically created network interfaces with the
344 same network configuration and automatic address range
345 assignment.</para>
346
347 </listitem>
348 </varlistentry>
349 <varlistentry>
350 <term><varname>Gateway=</varname></term>
351 <listitem>
352 <para>The gateway address, which must be in the format
353 described in
3ba3a79d 354 <citerefentry project='man-pages'><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
798d3a52
ZJS
355 This is a short-hand for a [Route] section only containing
356 a Gateway key. This option may be specified more than
357 once.</para>
358 </listitem>
359 </varlistentry>
360 <varlistentry>
361 <term><varname>DNS=</varname></term>
362 <listitem>
363 <para>A DNS server address, which must be in the format
364 described in
3ba3a79d 365 <citerefentry project='man-pages'><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
798d3a52
ZJS
366 This option may be specified more than once.</para>
367 </listitem>
368 </varlistentry>
369 <varlistentry>
370 <term><varname>Domains=</varname></term>
371 <listitem>
372 <para>The domains used for DNS resolution over this link.</para>
373 </listitem>
374 </varlistentry>
375 <varlistentry>
376 <term><varname>NTP=</varname></term>
377 <listitem>
378 <para>An NTP server address. This option may be specified more than once.</para>
379 </listitem>
380 </varlistentry>
381 <varlistentry>
382 <term><varname>IPForward=</varname></term>
765afd5c
LP
383 <listitem><para>Configures IP packet forwarding for the
384 system. If enabled, incoming packets on any network
385 interface will be forwarded to any other interfaces
386 according to the routing table. Takes either a boolean
387 argument, or the values <literal>ipv4</literal> or
388 <literal>ipv6</literal>, which only enable IP packet
389 forwarding for the specified address family. This controls
390 the <filename>net.ipv4.ip_forward</filename> and
391 <filename>net.ipv6.conf.all.forwarding</filename> sysctl
392 options of the network interface (see <ulink
4046d836
LP
393 url="https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt">ip-sysctl.txt</ulink>
394 for details about sysctl options). Defaults to
395 <literal>no</literal>.</para>
396
765afd5c
LP
397 <para>Note: this setting controls a global kernel option,
398 and does so one way only: if a network that has this setting
399 enabled is set up the global setting is turned on. However,
400 it is never turned off again, even after all networks with
401 this setting enabled are shut down again.</para>
402
403 <para>To allow IP packet forwarding only between specific
404 network interfaces use a firewall.</para>
4046d836 405 </listitem>
798d3a52
ZJS
406 </varlistentry>
407 <varlistentry>
408 <term><varname>IPMasquerade=</varname></term>
409 <listitem><para>Configures IP masquerading for the network
b938cb90 410 interface. If enabled, packets forwarded from the network
798d3a52
ZJS
411 interface will be appear as coming from the local host.
412 Takes a boolean argument. Implies
5c82dd13 413 <varname>IPForward=ipv4</varname>. Defaults to
4046d836 414 <literal>no</literal>.</para></listitem>
798d3a52 415 </varlistentry>
a46e37cb
SS
416 <varlistentry>
417 <term><varname>IPv6PrivacyExtensions=</varname></term>
1f0d9695
LP
418 <listitem><para>Configures use of stateless temporary
419 addresses that change over time (see <ulink
420 url="https://tools.ietf.org/html/rfc4941">RFC 4941</ulink>,
421 Privacy Extensions for Stateless Address Autoconfiguration
422 in IPv6). Takes a boolean or the special values
423 <literal>prefer-public</literal> and
b938cb90 424 <literal>kernel</literal>. When true, enables the privacy
1f0d9695 425 extensions and prefers temporary addresses over public
b938cb90 426 addresses. When <literal>prefer-public</literal>, enables the
1f0d9695
LP
427 privacy extensions, but prefers public addresses over
428 temporary addresses. When false, the privacy extensions
b938cb90 429 remain disabled. When <literal>kernel</literal>, the kernel's
1f0d9695 430 default setting will be left in place. Defaults to
a46e37cb
SS
431 <literal>no</literal>.</para></listitem>
432 </varlistentry>
941d0aa8
SS
433 <varlistentry>
434 <term><varname>IPv6AcceptRouterAdvertisements=</varname></term>
a8eaaee7 435 <listitem><para>Force the setting of the <filename>accept_ra</filename>
ebf98081
ZJS
436 (router advertisements) setting for the interface.
437 When unset, the kernel default is used, and router
438 advertisements are accepted only when local forwarding
439 is disabled for that interface.
f5a8c43f
TG
440 When router advertisements are accepted, they will
441 trigger the start of the DHCPv6 client if the relevant
442 flags are passed, or if no routers are found on the link.
ebf98081
ZJS
443 Takes a boolean. If true, router advertisements are
444 accepted, when false, router advertisements are ignored,
445 independently of the local forwarding state.</para>
446
447 <para>See
448 <ulink url="https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt">ip-sysctl.txt</ulink>
449 in the kernel documentation, but note that systemd's
450 setting of <constant>1</constant> corresponds to
451 kernel's setting of <constant>2</constant>.</para>
452 </listitem>
941d0aa8 453 </varlistentry>
44de7fb1
SS
454 <varlistentry>
455 <term><varname>IPv6DuplicateAddressDetection=</varname></term>
a8eaaee7
JE
456 <listitem><para>Configures the amount of IPv6 Duplicate
457 Address Detection (DAD) probes to send. Defaults to unset.
44de7fb1
SS
458 </para></listitem>
459 </varlistentry>
a86cba89
SS
460 <varlistentry>
461 <term><varname>IPv6HopLimit=</varname></term>
462 <listitem><para>Configures IPv6 Hop Limit. For each router that
463 forwards the packet, the hop limit is decremented by 1. When the
464 hop limit field reaches zero, the packet is discarded.
465 Defaults to unset.
466 </para></listitem>
467 </varlistentry>
798d3a52
ZJS
468 <varlistentry>
469 <term><varname>Bridge=</varname></term>
470 <listitem>
471 <para>The name of the bridge to add the link to.</para>
472 </listitem>
473 </varlistentry>
474 <varlistentry>
475 <term><varname>Bond=</varname></term>
476 <listitem>
477 <para>The name of the bond to add the link to.</para>
478 </listitem>
479 </varlistentry>
480 <varlistentry>
481 <term><varname>VLAN=</varname></term>
482 <listitem>
483 <para>The name of a VLAN to create on the link. This
484 option may be specified more than once.</para>
485 </listitem>
486 </varlistentry>
487 <varlistentry>
488 <term><varname>MACVLAN=</varname></term>
489 <listitem>
490 <para>The name of a MACVLAN to create on the link. This
491 option may be specified more than once.</para>
492 </listitem>
493 </varlistentry>
494 <varlistentry>
495 <term><varname>VXLAN=</varname></term>
496 <listitem>
497 <para>The name of a VXLAN to create on the link. This
498 option may be specified more than once.</para>
499 </listitem>
500 </varlistentry>
501 <varlistentry>
502 <term><varname>Tunnel=</varname></term>
503 <listitem>
504 <para>The name of a Tunnel to create on the link. This
505 option may be specified more than once.</para>
506 </listitem>
507 </varlistentry>
508 </variablelist>
509
510 </refsect1>
511
512 <refsect1>
513 <title>[Address] Section Options</title>
514
515 <para>An <literal>[Address]</literal> section accepts the
516 following keys. Specify several <literal>[Address]</literal>
517 sections to configure several addresses.</para>
518
519 <variablelist class='network-directives'>
520 <varlistentry>
521 <term><varname>Address=</varname></term>
522 <listitem>
523 <para>As in the <literal>[Network]</literal> section. This
524 key is mandatory.</para>
525 </listitem>
526 </varlistentry>
527 <varlistentry>
528 <term><varname>Peer=</varname></term>
529 <listitem>
530 <para>The peer address in a point-to-point connection.
531 Accepts the same format as the <literal>Address</literal>
532 key.</para>
533 </listitem>
534 </varlistentry>
535 <varlistentry>
536 <term><varname>Broadcast=</varname></term>
537 <listitem>
538 <para>The broadcast address, which must be in the format
539 described in
3ba3a79d 540 <citerefentry project='man-pages'><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
798d3a52
ZJS
541 This key only applies to IPv4 addresses. If it is not
542 given, it is derived from the <literal>Address</literal>
543 key.</para>
544 </listitem>
545 </varlistentry>
546 <varlistentry>
547 <term><varname>Label=</varname></term>
548 <listitem>
549 <para>An address label.</para>
550 </listitem>
551 </varlistentry>
552 </variablelist>
553 </refsect1>
554
555 <refsect1>
556 <title>[Route] Section Options</title>
557 <para>The <literal>[Route]</literal> section accepts the
558 following keys. Specify several <literal>[Route]</literal>
559 sections to configure several routes.</para>
560
561 <variablelist class='network-directives'>
562 <varlistentry>
563 <term><varname>Gateway=</varname></term>
564 <listitem>
565 <para>As in the <literal>[Network]</literal> section.</para>
566 </listitem>
567 </varlistentry>
568 <varlistentry>
569 <term><varname>Destination=</varname></term>
570 <listitem>
571 <para>The destination prefix of the route. Possibly
b938cb90 572 followed by a slash and the prefix length. If omitted, a
798d3a52
ZJS
573 full-length host route is assumed.</para>
574 </listitem>
575 </varlistentry>
576 <varlistentry>
577 <term><varname>Source=</varname></term>
578 <listitem>
579 <para>The source prefix of the route. Possibly followed by
b938cb90 580 a slash and the prefix length. If omitted, a full-length
798d3a52
ZJS
581 host route is assumed.</para>
582 </listitem>
583 </varlistentry>
584 <varlistentry>
585 <term><varname>Metric=</varname></term>
586 <listitem>
b938cb90 587 <para>The metric of the route (an unsigned integer).</para>
798d3a52
ZJS
588 </listitem>
589 </varlistentry>
769b56a3
TG
590 <varlistentry>
591 <term><varname>Scope=</varname></term>
592 <listitem>
a8eaaee7 593 <para>The scope of the route, which can be <literal>global</literal>,
769b56a3
TG
594 <literal>link</literal> or <literal>host</literal>. Defaults to
595 <literal>global</literal>.</para>
596 </listitem>
0d07e595
JK
597 </varlistentry>
598 <varlistentry>
599 <term><varname>PreferredSource=</varname></term>
600 <listitem>
601 <para>The preferred source address of the route. The address
602 must be in the format described in
603 <citerefentry project='man-pages'><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
604 </listitem>
769b56a3 605 </varlistentry>
798d3a52
ZJS
606 </variablelist>
607 </refsect1>
608
609 <refsect1>
610 <title>[DHCP] Section Options</title>
ad943783
LP
611 <para>The <literal>[DHCP]</literal> section configures the
612 DHCPv4 and DHCP6 client, if it is enabled with the
613 <varname>DHCP=</varname> setting described above:</para>
798d3a52
ZJS
614
615 <variablelist class='network-directives'>
616 <varlistentry>
617 <term><varname>UseDNS=</varname></term>
618 <listitem>
619 <para>When true (the default), the DNS servers received
620 from the DHCP server will be used and take precedence over
621 any statically configured ones.</para>
e88d8021
ZJS
622
623 <para>This corresponds to the <option>nameserver</option>
ad943783
LP
624 option in <citerefentry
625 project='man-pages'><refentrytitle>resolv.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
798d3a52
ZJS
626 </listitem>
627 </varlistentry>
301f4073
MM
628 <varlistentry>
629 <term><varname>UseNTP=</varname></term>
630 <listitem>
631 <para>When true (the default), the NTP servers received
632 from the DHCP server will be used by systemd-timesyncd
633 and take precedence over any statically configured ones.</para>
634 </listitem>
635 </varlistentry>
798d3a52
ZJS
636 <varlistentry>
637 <term><varname>UseMTU=</varname></term>
638 <listitem>
639 <para>When true, the interface maximum transmission unit
640 from the DHCP server will be used on the current link.
641 Defaults to false.</para>
642 </listitem>
643 </varlistentry>
644 <varlistentry>
645 <term><varname>SendHostname=</varname></term>
646 <listitem>
d59be2cf
ZJS
647 <para>When true (the default), the machine's hostname will
648 be sent to the DHCP server.</para>
798d3a52
ZJS
649 </listitem>
650 </varlistentry>
651 <varlistentry>
652 <term><varname>UseHostname=</varname></term>
653 <listitem>
654 <para>When true (the default), the hostname received from
ad943783 655 the DHCP server will be set as the transient hostname of the system
d59be2cf 656 </para>
798d3a52
ZJS
657 </listitem>
658 </varlistentry>
1adc5d0b
SS
659 <varlistentry>
660 <term><varname>Hostname=</varname></term>
661 <listitem>
d59be2cf
ZJS
662 <para>Use this value for the hostname which is sent to the
663 DHCP server, instead of machine's hostname.</para>
1adc5d0b
SS
664 </listitem>
665 </varlistentry>
798d3a52
ZJS
666 <varlistentry>
667 <term><varname>UseDomains=</varname></term>
668 <listitem>
669 <para>When true (not the default), the domain name
670 received from the DHCP server will be used for DNS
e88d8021
ZJS
671 resolution over this link. When a name cannot be resolved
672 as specified, the domain name will be used a suffix and
673 name resolution of that will be attempted.</para>
674
675 <para>This corresponds to the <option>domain</option>
676 option in <citerefentry project='man-pages'><refentrytitle>resolv.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
677 and should not be enabled on untrusted networks.</para>
798d3a52
ZJS
678 </listitem>
679 </varlistentry>
680 <varlistentry>
681 <term><varname>UseRoutes=</varname></term>
682 <listitem>
683 <para>When true (the default), the static routes will be
684 requested from the DHCP server and added to the routing
a8eaaee7 685 table with a metric of 1024.</para>
798d3a52
ZJS
686 </listitem>
687 </varlistentry>
ad943783
LP
688
689 <varlistentry>
690 <term><varname>UseTimezone=</varname></term>
691
692 <listitem><para>When true, the timezone received from the
7f3fdb7f 693 DHCP server will be set as timezone of the local
ad943783
LP
694 system. Defaults to <literal>no</literal>.</para></listitem>
695 </varlistentry>
696
798d3a52
ZJS
697 <varlistentry>
698 <term><varname>CriticalConnection=</varname></term>
699 <listitem>
700 <para>When true, the connection will never be torn down
701 even if the DHCP lease expires. This is contrary to the
702 DHCP specification, but may be the best choice if, say,
703 the root filesystem relies on this connection. Defaults to
704 false.</para>
705 </listitem>
706 </varlistentry>
3e43b2cd
JJ
707 <varlistentry>
708 <term><varname>ClientIdentifier=</varname></term>
709 <listitem>
710 <para>DHCP client identifier to use. Either <literal>mac</literal>
711 to use the MAC address of the link or <literal>duid</literal>
4a6970c5 712 (the default) to use a RFC4361-compliant Client ID.</para>
3e43b2cd
JJ
713 </listitem>
714 </varlistentry>
798d3a52
ZJS
715 <varlistentry>
716 <term><varname>VendorClassIdentifier=</varname></term>
717 <listitem>
718 <para>The vendor class identifier used to identify vendor
719 type and configuration.</para>
720 </listitem>
721 </varlistentry>
722 <varlistentry>
723 <term><varname>RequestBroadcast=</varname></term>
724 <listitem>
725 <para>Request the server to use broadcast messages before
726 the IP address has been configured. This is necessary for
727 devices that cannot receive RAW packets, or that cannot
728 receive packets at all before an IP address has been
729 configured. On the other hand, this must not be enabled on
730 networks where broadcasts are filtered out.</para>
731 </listitem>
732 </varlistentry>
733 <varlistentry>
734 <term><varname>RouteMetric=</varname></term>
735 <listitem>
736 <para>Set the routing metric for routes specified by the
737 DHCP server.</para>
738 </listitem>
739 </varlistentry>
ad943783 740 </variablelist>
798d3a52
ZJS
741
742 </refsect1>
743
ad943783
LP
744 <refsect1>
745 <title>[DHCPServer] Section Options</title>
746 <para>The <literal>[DHCPServer]</literal> section contains
747 settings for the DHCP server, if enabled via the
748 <varname>DHCPServer=</varname> option described above:</para>
749
750 <variablelist class='network-directives'>
751
9b3a67c5
TG
752 <varlistentry>
753 <term><varname>PoolOffset=</varname></term>
754 <term><varname>PoolSize=</varname></term>
755
756 <listitem><para>Configures the pool of addresses to hand out. The pool
757 is a contiguous sequence of IP addresses in the subnet configured for
758 the server address, which does not include the subnet nor the broadcast
759 address. <varname>PoolOffset=</varname> takes the offset of the pool
760 from the start of subnet, or zero to use the default value.
761 <varname>PoolSize=</varname> takes the number of IP addresses in the
b938cb90 762 pool or zero to use the default value. By default, the pool starts at
9b3a67c5
TG
763 the first address after the subnet address and takes up the rest of
764 the subnet, excluding the broadcast address. If the pool includes
765 the server address (the default), this is reserved and not handed
766 out to clients.</para></listitem>
767 </varlistentry>
768
ad943783
LP
769 <varlistentry>
770 <term><varname>DefaultLeaseTimeSec=</varname></term>
771 <term><varname>MaxLeaseTimeSec=</varname></term>
772
773 <listitem><para>Control the default and maximum DHCP lease
774 time to pass to clients. These settings take time values in seconds or
775 another common time unit, depending on the suffix. The default
776 lease time is used for clients that did not ask for a specific
777 lease time. If a client asks for a lease time longer than the
b938cb90 778 maximum lease time, it is automatically shortened to the
ad943783
LP
779 specified time. The default lease time defaults to 1h, the
780 maximum lease time to 12h. Shorter lease times are beneficial
781 if the configuration data in DHCP leases changes frequently
782 and clients shall learn the new settings with shorter
783 latencies. Longer lease times reduce the generated DHCP
784 network traffic.</para></listitem>
785 </varlistentry>
786
787 <varlistentry>
788 <term><varname>EmitDNS=</varname></term>
789 <term><varname>DNS=</varname></term>
790
791 <listitem><para>Configures whether the DHCP leases handed out
792 to clients shall contain DNS server information. The
793 <varname>EmitDNS=</varname> setting takes a boolean argument
794 and defaults to <literal>yes</literal>. The DNS servers to
795 pass to clients may be configured with the
796 <varname>DNS=</varname> option, which takes a list of IPv4
797 addresses. If the <varname>EmitDNS=</varname> option is
b938cb90 798 enabled but no servers configured, the servers are
ad943783
LP
799 automatically propagated from an "uplink" interface that has
800 appropriate servers set. The "uplink" interface is determined
801 by the default route of the system with the highest
802 priority. Note that this information is acquired at the time
803 the lease is handed out, and does not take uplink interfaces
804 into account that acquire DNS or NTP server information at a
805 later point. DNS server propagation does not take
806 <filename>/etc/resolv.conf</filename> into account. Also, note
a8eaaee7 807 that the leases are not refreshed if the uplink network
ad943783 808 configuration changes. To ensure clients regularly acquire the
b938cb90 809 most current uplink DNS server information, it is thus
ad943783
LP
810 advisable to shorten the DHCP lease time via
811 <varname>MaxLeaseTimeSec=</varname> described
812 above.</para></listitem>
813 </varlistentry>
814
815 <varlistentry>
816 <term><varname>EmitNTP=</varname></term>
817 <term><varname>NTP=</varname></term>
818
819 <listitem><para>Similar to the <varname>EmitDNS=</varname> and
b938cb90 820 <varname>DNS=</varname> settings described above, these
ad943783
LP
821 settings configure whether and what NTP server information
822 shall be emitted as part of the DHCP lease. The same syntax,
823 propagation semantics and defaults apply as for
824 <varname>EmitDNS=</varname> and
825 <varname>DNS=</varname>.</para></listitem>
826 </varlistentry>
827
828 <varlistentry>
829 <term><varname>EmitTimezone=</varname></term>
830 <term><varname>Timezone=</varname></term>
831
832 <listitem><para>Configures whether the DHCP leases handed out
833 to clients shall contain timezone information. The
834 <varname>EmitTimezone=</varname> setting takes a boolean
835 argument and defaults to <literal>yes</literal>. The
836 <varname>Timezone=</varname> setting takes a timezone string
837 (such as <literal>Europe/Berlin</literal> or
838 <literal>UTC</literal>) to pass to clients. If no explicit
b938cb90 839 timezone is set, the system timezone of the local host is
ad943783
LP
840 propagated, as determined by the
841 <filename>/etc/localtime</filename> symlink.</para></listitem>
842 </varlistentry>
843
844 </variablelist>
845 </refsect1>
846
798d3a52
ZJS
847 <refsect1>
848 <title>[Bridge] Section Options</title>
849 <para>The <literal>[Bridge]</literal> section accepts the
850 following keys.</para>
851 <variablelist class='network-directives'>
165c41a9
SS
852 <varlistentry>
853 <term><varname>UnicastFlood=</varname></term>
854 <listitem>
072f9e4a
ZJS
855 <para>A boolean. Controls whether the bridge should flood
856 traffic for which an FDB entry is missing and the destination
857 is unknown through this port. Defaults to on.
47c7dfe2 858 </para>
165c41a9
SS
859 </listitem>
860 </varlistentry>
861 <varlistentry>
862 <term><varname>HairPin=</varname></term>
863 <listitem>
47c7dfe2
ZJS
864 <para>A boolean. Configures whether traffic may be sent back
865 out of the port on which it was received. By default, this
866 flag is false, and the bridge will not forward traffic back
867 out of the receiving port.</para>
165c41a9
SS
868 </listitem>
869 </varlistentry>
870 <varlistentry>
84c34096 871 <term><varname>UseBPDU=</varname></term>
165c41a9 872 <listitem>
47c7dfe2 873 <para>A boolean. Configures whether STP Bridge Protocol Data Units will be
84c34096 874 processed by the bridge port. Defaults to yes.</para>
165c41a9
SS
875 </listitem>
876 </varlistentry>
877 <varlistentry>
878 <term><varname>FastLeave=</varname></term>
879 <listitem>
47c7dfe2 880 <para>A boolean. This flag allows the bridge to immediately stop multicast
a8eaaee7 881 traffic on a port that receives an IGMP Leave message. It is only used with
47c7dfe2 882 IGMP snooping if enabled on the bridge. Defaults to off.</para>
165c41a9
SS
883 </listitem>
884 </varlistentry>
885 <varlistentry>
23da66bb 886 <term><varname>AllowPortToBeRoot=</varname></term>
165c41a9 887 <listitem>
47c7dfe2
ZJS
888 <para>A boolean. Configures whether a given port is allowed to
889 become a root port. Only used when STP is enabled on the bridge.
23da66bb 890 Defaults to on.</para>
165c41a9
SS
891 </listitem>
892 </varlistentry>
798d3a52
ZJS
893 <varlistentry>
894 <term><varname>Cost=</varname></term>
895 <listitem>
47c7dfe2 896 <para>Sets the "cost" of sending packets of this interface.
a8eaaee7 897 Each port in a bridge may have a different speed and the cost
798d3a52 898 is used to decide which link to use. Faster interfaces
47c7dfe2 899 should have lower costs.</para>
798d3a52
ZJS
900 </listitem>
901 </varlistentry>
902 </variablelist>
903 </refsect1>
798d3a52
ZJS
904 <refsect1>
905 <title>[BridgeFDB] Section Options</title>
906 <para>The <literal>[BridgeFDB]</literal> section manages the
907 forwarding database table of a port and accepts the following
908 keys. Specify several <literal>[BridgeFDB]</literal> sections to
909 configure several static MAC table entries.</para>
910
911 <variablelist class='network-directives'>
912 <varlistentry>
913 <term><varname>MACAddress=</varname></term>
914 <listitem>
915 <para>As in the <literal>[Network]</literal> section. This
916 key is mandatory.</para>
917 </listitem>
918 </varlistentry>
919 <varlistentry>
920 <term><varname>VLANId=</varname></term>
921 <listitem>
a8eaaee7
JE
922 <para>The VLAN ID for the new static MAC table entry. If
923 omitted, no VLAN ID info is appended to the new static MAC
798d3a52
ZJS
924 table entry.</para>
925 </listitem>
926 </varlistentry>
927 </variablelist>
928 </refsect1>
929
930 <refsect1>
931 <title>Example</title>
932 <example>
12b42c76 933 <title>/etc/systemd/network/50-static.network</title>
798d3a52
ZJS
934
935 <programlisting>[Match]
eac684ef
TG
936Name=enp2s0
937
938[Network]
939Address=192.168.0.15/24
940Gateway=192.168.0.1</programlisting>
798d3a52 941 </example>
eac684ef 942
798d3a52 943 <example>
12b42c76 944 <title>/etc/systemd/network/80-dhcp.network</title>
eac684ef 945
798d3a52 946 <programlisting>[Match]
eac684ef
TG
947Name=en*
948
949[Network]
9c8ca3f7 950DHCP=yes</programlisting>
798d3a52 951 </example>
eac684ef 952
798d3a52 953 <example>
6c1695be 954 <title>/etc/systemd/network/25-bridge-static.network</title>
f47c5c47 955
798d3a52 956 <programlisting>[Match]
f47c5c47 957Name=bridge0
958
959[Network]
960Address=192.168.0.15/24
961Gateway=192.168.0.1
962DNS=192.168.0.1</programlisting>
798d3a52 963 </example>
f47c5c47 964
798d3a52 965 <example>
6c1695be 966 <title>/etc/systemd/network/25-bridge-slave-interface.network</title>
f47c5c47 967
798d3a52 968 <programlisting>[Match]
f47c5c47 969Name=enp2s0
970
971[Network]
972Bridge=bridge0</programlisting>
798d3a52
ZJS
973 </example>
974 <example>
6c1695be 975 <title>/etc/systemd/network/25-ipip.network</title>
0a8a0fad 976
798d3a52 977 <programlisting>[Match]
0a8a0fad
TG
978Name=em1
979
980[Network]
981Tunnel=ipip-tun</programlisting>
798d3a52 982 </example>
0a8a0fad 983
798d3a52 984 <example>
6c1695be 985 <title>/etc/systemd/network/25-sit.network</title>
0a8a0fad 986
798d3a52 987 <programlisting>[Match]
0a8a0fad
TG
988Name=em1
989
990[Network]
991Tunnel=sit-tun</programlisting>
798d3a52 992 </example>
0a8a0fad 993
798d3a52 994 <example>
6c1695be 995 <title>/etc/systemd/network/25-gre.network</title>
0a8a0fad 996
798d3a52 997 <programlisting>[Match]
0a8a0fad
TG
998Name=em1
999
1000[Network]
1001Tunnel=gre-tun</programlisting>
798d3a52 1002 </example>
0a8a0fad 1003
798d3a52 1004 <example>
6c1695be 1005 <title>/etc/systemd/network/25-vti.network</title>
0a8a0fad 1006
798d3a52 1007 <programlisting>[Match]
0a8a0fad
TG
1008Name=em1
1009
1010[Network]
1011Tunnel=vti-tun</programlisting>
798d3a52 1012 </example>
d94facdc
MH
1013
1014 <example>
6c1695be 1015 <title>/etc/systemd/network/25-bond.network</title>
d94facdc
MH
1016
1017 <programlisting>[Match]
1018Name=bond1
1019
1020[Network]
1021DHCP=yes
1022</programlisting>
1023 </example>
1024
798d3a52
ZJS
1025 </refsect1>
1026
1027 <refsect1>
1028 <title>See Also</title>
1029 <para>
1030 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1031 <citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
1032 <citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
aaa297d4
LP
1033 <citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1034 <citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
1035 </para>
1036 </refsect1>
eac684ef
TG
1037
1038</refentry>