]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.network.xml
networkd: rearrange checks when to write something into sysctl a bit
[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
TG
230 <para>Note that DHCPv6 will by default be triggered by Router
231 Advertisment, if that is enabled, regardless of this parameter.
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>
280 <para>A boolean or <literal>resolve</literal>. When true, enables
b938cb90
JE
281 Link-Local Multicast Name Resolution on the link. When set to
282 <literal>resolve</literal>, only resolution is enabled, but not
798d3a52
ZJS
283 announcement. Defaults to true.</para>
284 </listitem>
285 </varlistentry>
286 <varlistentry>
287 <term><varname>LLDP=</varname></term>
288 <listitem>
289 <para>A boolean. When true, enables LLDP link receive support.
290 </para>
291 </listitem>
292 </varlistentry>
0d4ad91d
AR
293 <varlistentry>
294 <term><varname>BindCarrier=</varname></term>
295 <listitem>
296 <para>A port or a list of ports. When set, controls the
dd2b607b 297 behavior of the current interface. When all ports in the list
0d4ad91d
AR
298 are in an operational down state, the current interface is brought
299 down. When at least one port has carrier, the current interface
300 is brought up.
301 </para>
302 </listitem>
303 </varlistentry>
798d3a52
ZJS
304 <varlistentry>
305 <term><varname>Address=</varname></term>
306 <listitem>
307 <para>A static IPv4 or IPv6 address and its prefix length,
308 separated by a <literal>/</literal> character. Specify
309 this key more than once to configure several addresses.
310 The format of the address must be as described in
3ba3a79d 311 <citerefentry project='man-pages'><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
798d3a52
ZJS
312 This is a short-hand for an [Address] section only
313 containing an Address key (see below). This option may be
314 specified more than once.
315 </para>
316
317 <para>If the specified address is 0.0.0.0 (for IPv4) or
318 [::] (for IPv6), a new address range of the requested size
319 is automatically allocated from a system-wide pool of
320 unused ranges. The allocated range is checked against all
321 current network interfaces and all known network
322 configuration files to avoid address range conflicts. The
323 default system-wide pool consists of 192.168.0.0/16,
324 172.16.0.0/12 and 10.0.0.0/8 for IPv4, and fc00::/7 for
325 IPv6. This functionality is useful to manage a large
326 number of dynamically created network interfaces with the
327 same network configuration and automatic address range
328 assignment.</para>
329
330 </listitem>
331 </varlistentry>
332 <varlistentry>
333 <term><varname>Gateway=</varname></term>
334 <listitem>
335 <para>The gateway address, which must be in the format
336 described in
3ba3a79d 337 <citerefentry project='man-pages'><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
798d3a52
ZJS
338 This is a short-hand for a [Route] section only containing
339 a Gateway key. This option may be specified more than
340 once.</para>
341 </listitem>
342 </varlistentry>
343 <varlistentry>
344 <term><varname>DNS=</varname></term>
345 <listitem>
346 <para>A DNS server address, which must be in the format
347 described in
3ba3a79d 348 <citerefentry project='man-pages'><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
798d3a52
ZJS
349 This option may be specified more than once.</para>
350 </listitem>
351 </varlistentry>
352 <varlistentry>
353 <term><varname>Domains=</varname></term>
354 <listitem>
355 <para>The domains used for DNS resolution over this link.</para>
356 </listitem>
357 </varlistentry>
358 <varlistentry>
359 <term><varname>NTP=</varname></term>
360 <listitem>
361 <para>An NTP server address. This option may be specified more than once.</para>
362 </listitem>
363 </varlistentry>
364 <varlistentry>
365 <term><varname>IPForward=</varname></term>
366 <listitem><para>Configures IP forwarding for the network
b938cb90 367 interface. If enabled, incoming packets on the network
798d3a52
ZJS
368 interface will be forwarded to other interfaces according to
369 the routing table. Takes either a boolean argument, or the
370 values <literal>ipv4</literal> or <literal>ipv6</literal>,
371 which only enables IP forwarding for the specified address
2972cba1
NO
372 family, or <literal>kernel</literal>, which preserves existing sysctl settings.
373 This controls the
4046d836
LP
374 <filename>net.ipv4.conf.&lt;interface&gt;.forwarding</filename>
375 and
376 <filename>net.ipv6.conf.&lt;interface&gt;.forwarding</filename>
377 sysctl options of the network interface (see <ulink
378 url="https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt">ip-sysctl.txt</ulink>
379 for details about sysctl options). Defaults to
380 <literal>no</literal>.</para>
381
2972cba1
NO
382 <para>Note: unless this option is turned on, or set to <literal>kernel</literal>,
383 no IP forwarding is done on this interface, even if this is
4046d836 384 globally turned on in the kernel, with the
e2bccc9d
DH
385 <filename>net.ipv4.ip_forward</filename>,
386 <filename>net.ipv4.conf.all.forwarding</filename>, and
387 <filename>net.ipv6.conf.all.forwarding</filename> sysctl
505c5f6d 388 options.</para>
4046d836 389 </listitem>
798d3a52
ZJS
390 </varlistentry>
391 <varlistentry>
392 <term><varname>IPMasquerade=</varname></term>
393 <listitem><para>Configures IP masquerading for the network
b938cb90 394 interface. If enabled, packets forwarded from the network
798d3a52
ZJS
395 interface will be appear as coming from the local host.
396 Takes a boolean argument. Implies
5c82dd13 397 <varname>IPForward=ipv4</varname>. Defaults to
4046d836 398 <literal>no</literal>.</para></listitem>
798d3a52 399 </varlistentry>
a46e37cb
SS
400 <varlistentry>
401 <term><varname>IPv6PrivacyExtensions=</varname></term>
1f0d9695
LP
402 <listitem><para>Configures use of stateless temporary
403 addresses that change over time (see <ulink
404 url="https://tools.ietf.org/html/rfc4941">RFC 4941</ulink>,
405 Privacy Extensions for Stateless Address Autoconfiguration
406 in IPv6). Takes a boolean or the special values
407 <literal>prefer-public</literal> and
b938cb90 408 <literal>kernel</literal>. When true, enables the privacy
1f0d9695 409 extensions and prefers temporary addresses over public
b938cb90 410 addresses. When <literal>prefer-public</literal>, enables the
1f0d9695
LP
411 privacy extensions, but prefers public addresses over
412 temporary addresses. When false, the privacy extensions
b938cb90 413 remain disabled. When <literal>kernel</literal>, the kernel's
1f0d9695 414 default setting will be left in place. Defaults to
a46e37cb
SS
415 <literal>no</literal>.</para></listitem>
416 </varlistentry>
941d0aa8
SS
417 <varlistentry>
418 <term><varname>IPv6AcceptRouterAdvertisements=</varname></term>
a8eaaee7 419 <listitem><para>Force the setting of the <filename>accept_ra</filename>
ebf98081
ZJS
420 (router advertisements) setting for the interface.
421 When unset, the kernel default is used, and router
422 advertisements are accepted only when local forwarding
423 is disabled for that interface.
f5a8c43f
TG
424 When router advertisements are accepted, they will
425 trigger the start of the DHCPv6 client if the relevant
426 flags are passed, or if no routers are found on the link.
ebf98081
ZJS
427 Takes a boolean. If true, router advertisements are
428 accepted, when false, router advertisements are ignored,
429 independently of the local forwarding state.</para>
430
431 <para>See
432 <ulink url="https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt">ip-sysctl.txt</ulink>
433 in the kernel documentation, but note that systemd's
434 setting of <constant>1</constant> corresponds to
435 kernel's setting of <constant>2</constant>.</para>
436 </listitem>
941d0aa8 437 </varlistentry>
44de7fb1
SS
438 <varlistentry>
439 <term><varname>IPv6DuplicateAddressDetection=</varname></term>
a8eaaee7
JE
440 <listitem><para>Configures the amount of IPv6 Duplicate
441 Address Detection (DAD) probes to send. Defaults to unset.
44de7fb1
SS
442 </para></listitem>
443 </varlistentry>
a86cba89
SS
444 <varlistentry>
445 <term><varname>IPv6HopLimit=</varname></term>
446 <listitem><para>Configures IPv6 Hop Limit. For each router that
447 forwards the packet, the hop limit is decremented by 1. When the
448 hop limit field reaches zero, the packet is discarded.
449 Defaults to unset.
450 </para></listitem>
451 </varlistentry>
798d3a52
ZJS
452 <varlistentry>
453 <term><varname>Bridge=</varname></term>
454 <listitem>
455 <para>The name of the bridge to add the link to.</para>
456 </listitem>
457 </varlistentry>
458 <varlistentry>
459 <term><varname>Bond=</varname></term>
460 <listitem>
461 <para>The name of the bond to add the link to.</para>
462 </listitem>
463 </varlistentry>
464 <varlistentry>
465 <term><varname>VLAN=</varname></term>
466 <listitem>
467 <para>The name of a VLAN to create on the link. This
468 option may be specified more than once.</para>
469 </listitem>
470 </varlistentry>
471 <varlistentry>
472 <term><varname>MACVLAN=</varname></term>
473 <listitem>
474 <para>The name of a MACVLAN to create on the link. This
475 option may be specified more than once.</para>
476 </listitem>
477 </varlistentry>
478 <varlistentry>
479 <term><varname>VXLAN=</varname></term>
480 <listitem>
481 <para>The name of a VXLAN to create on the link. This
482 option may be specified more than once.</para>
483 </listitem>
484 </varlistentry>
485 <varlistentry>
486 <term><varname>Tunnel=</varname></term>
487 <listitem>
488 <para>The name of a Tunnel to create on the link. This
489 option may be specified more than once.</para>
490 </listitem>
491 </varlistentry>
492 </variablelist>
493
494 </refsect1>
495
496 <refsect1>
497 <title>[Address] Section Options</title>
498
499 <para>An <literal>[Address]</literal> section accepts the
500 following keys. Specify several <literal>[Address]</literal>
501 sections to configure several addresses.</para>
502
503 <variablelist class='network-directives'>
504 <varlistentry>
505 <term><varname>Address=</varname></term>
506 <listitem>
507 <para>As in the <literal>[Network]</literal> section. This
508 key is mandatory.</para>
509 </listitem>
510 </varlistentry>
511 <varlistentry>
512 <term><varname>Peer=</varname></term>
513 <listitem>
514 <para>The peer address in a point-to-point connection.
515 Accepts the same format as the <literal>Address</literal>
516 key.</para>
517 </listitem>
518 </varlistentry>
519 <varlistentry>
520 <term><varname>Broadcast=</varname></term>
521 <listitem>
522 <para>The broadcast address, which must be in the format
523 described in
3ba3a79d 524 <citerefentry project='man-pages'><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
798d3a52
ZJS
525 This key only applies to IPv4 addresses. If it is not
526 given, it is derived from the <literal>Address</literal>
527 key.</para>
528 </listitem>
529 </varlistentry>
530 <varlistentry>
531 <term><varname>Label=</varname></term>
532 <listitem>
533 <para>An address label.</para>
534 </listitem>
535 </varlistentry>
536 </variablelist>
537 </refsect1>
538
539 <refsect1>
540 <title>[Route] Section Options</title>
541 <para>The <literal>[Route]</literal> section accepts the
542 following keys. Specify several <literal>[Route]</literal>
543 sections to configure several routes.</para>
544
545 <variablelist class='network-directives'>
546 <varlistentry>
547 <term><varname>Gateway=</varname></term>
548 <listitem>
549 <para>As in the <literal>[Network]</literal> section.</para>
550 </listitem>
551 </varlistentry>
552 <varlistentry>
553 <term><varname>Destination=</varname></term>
554 <listitem>
555 <para>The destination prefix of the route. Possibly
b938cb90 556 followed by a slash and the prefix length. If omitted, a
798d3a52
ZJS
557 full-length host route is assumed.</para>
558 </listitem>
559 </varlistentry>
560 <varlistentry>
561 <term><varname>Source=</varname></term>
562 <listitem>
563 <para>The source prefix of the route. Possibly followed by
b938cb90 564 a slash and the prefix length. If omitted, a full-length
798d3a52
ZJS
565 host route is assumed.</para>
566 </listitem>
567 </varlistentry>
568 <varlistentry>
569 <term><varname>Metric=</varname></term>
570 <listitem>
b938cb90 571 <para>The metric of the route (an unsigned integer).</para>
798d3a52
ZJS
572 </listitem>
573 </varlistentry>
769b56a3
TG
574 <varlistentry>
575 <term><varname>Scope=</varname></term>
576 <listitem>
a8eaaee7 577 <para>The scope of the route, which can be <literal>global</literal>,
769b56a3
TG
578 <literal>link</literal> or <literal>host</literal>. Defaults to
579 <literal>global</literal>.</para>
580 </listitem>
0d07e595
JK
581 </varlistentry>
582 <varlistentry>
583 <term><varname>PreferredSource=</varname></term>
584 <listitem>
585 <para>The preferred source address of the route. The address
586 must be in the format described in
587 <citerefentry project='man-pages'><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
588 </listitem>
769b56a3 589 </varlistentry>
798d3a52
ZJS
590 </variablelist>
591 </refsect1>
592
593 <refsect1>
594 <title>[DHCP] Section Options</title>
ad943783
LP
595 <para>The <literal>[DHCP]</literal> section configures the
596 DHCPv4 and DHCP6 client, if it is enabled with the
597 <varname>DHCP=</varname> setting described above:</para>
798d3a52
ZJS
598
599 <variablelist class='network-directives'>
600 <varlistentry>
601 <term><varname>UseDNS=</varname></term>
602 <listitem>
603 <para>When true (the default), the DNS servers received
604 from the DHCP server will be used and take precedence over
605 any statically configured ones.</para>
e88d8021
ZJS
606
607 <para>This corresponds to the <option>nameserver</option>
ad943783
LP
608 option in <citerefentry
609 project='man-pages'><refentrytitle>resolv.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
798d3a52
ZJS
610 </listitem>
611 </varlistentry>
301f4073
MM
612 <varlistentry>
613 <term><varname>UseNTP=</varname></term>
614 <listitem>
615 <para>When true (the default), the NTP servers received
616 from the DHCP server will be used by systemd-timesyncd
617 and take precedence over any statically configured ones.</para>
618 </listitem>
619 </varlistentry>
798d3a52
ZJS
620 <varlistentry>
621 <term><varname>UseMTU=</varname></term>
622 <listitem>
623 <para>When true, the interface maximum transmission unit
624 from the DHCP server will be used on the current link.
625 Defaults to false.</para>
626 </listitem>
627 </varlistentry>
628 <varlistentry>
629 <term><varname>SendHostname=</varname></term>
630 <listitem>
d59be2cf
ZJS
631 <para>When true (the default), the machine's hostname will
632 be sent to the DHCP server.</para>
798d3a52
ZJS
633 </listitem>
634 </varlistentry>
635 <varlistentry>
636 <term><varname>UseHostname=</varname></term>
637 <listitem>
638 <para>When true (the default), the hostname received from
ad943783 639 the DHCP server will be set as the transient hostname of the system
d59be2cf 640 </para>
798d3a52
ZJS
641 </listitem>
642 </varlistentry>
1adc5d0b
SS
643 <varlistentry>
644 <term><varname>Hostname=</varname></term>
645 <listitem>
d59be2cf
ZJS
646 <para>Use this value for the hostname which is sent to the
647 DHCP server, instead of machine's hostname.</para>
1adc5d0b
SS
648 </listitem>
649 </varlistentry>
798d3a52
ZJS
650 <varlistentry>
651 <term><varname>UseDomains=</varname></term>
652 <listitem>
653 <para>When true (not the default), the domain name
654 received from the DHCP server will be used for DNS
e88d8021
ZJS
655 resolution over this link. When a name cannot be resolved
656 as specified, the domain name will be used a suffix and
657 name resolution of that will be attempted.</para>
658
659 <para>This corresponds to the <option>domain</option>
660 option in <citerefentry project='man-pages'><refentrytitle>resolv.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
661 and should not be enabled on untrusted networks.</para>
798d3a52
ZJS
662 </listitem>
663 </varlistentry>
664 <varlistentry>
665 <term><varname>UseRoutes=</varname></term>
666 <listitem>
667 <para>When true (the default), the static routes will be
668 requested from the DHCP server and added to the routing
a8eaaee7 669 table with a metric of 1024.</para>
798d3a52
ZJS
670 </listitem>
671 </varlistentry>
ad943783
LP
672
673 <varlistentry>
674 <term><varname>UseTimezone=</varname></term>
675
676 <listitem><para>When true, the timezone received from the
677 DHCP server will be set as as timezone of the local
678 system. Defaults to <literal>no</literal>.</para></listitem>
679 </varlistentry>
680
798d3a52
ZJS
681 <varlistentry>
682 <term><varname>CriticalConnection=</varname></term>
683 <listitem>
684 <para>When true, the connection will never be torn down
685 even if the DHCP lease expires. This is contrary to the
686 DHCP specification, but may be the best choice if, say,
687 the root filesystem relies on this connection. Defaults to
688 false.</para>
689 </listitem>
690 </varlistentry>
3e43b2cd
JJ
691 <varlistentry>
692 <term><varname>ClientIdentifier=</varname></term>
693 <listitem>
694 <para>DHCP client identifier to use. Either <literal>mac</literal>
695 to use the MAC address of the link or <literal>duid</literal>
4a6970c5 696 (the default) to use a RFC4361-compliant Client ID.</para>
3e43b2cd
JJ
697 </listitem>
698 </varlistentry>
798d3a52
ZJS
699 <varlistentry>
700 <term><varname>VendorClassIdentifier=</varname></term>
701 <listitem>
702 <para>The vendor class identifier used to identify vendor
703 type and configuration.</para>
704 </listitem>
705 </varlistentry>
706 <varlistentry>
707 <term><varname>RequestBroadcast=</varname></term>
708 <listitem>
709 <para>Request the server to use broadcast messages before
710 the IP address has been configured. This is necessary for
711 devices that cannot receive RAW packets, or that cannot
712 receive packets at all before an IP address has been
713 configured. On the other hand, this must not be enabled on
714 networks where broadcasts are filtered out.</para>
715 </listitem>
716 </varlistentry>
717 <varlistentry>
718 <term><varname>RouteMetric=</varname></term>
719 <listitem>
720 <para>Set the routing metric for routes specified by the
721 DHCP server.</para>
722 </listitem>
723 </varlistentry>
ad943783 724 </variablelist>
798d3a52
ZJS
725
726 </refsect1>
727
ad943783
LP
728 <refsect1>
729 <title>[DHCPServer] Section Options</title>
730 <para>The <literal>[DHCPServer]</literal> section contains
731 settings for the DHCP server, if enabled via the
732 <varname>DHCPServer=</varname> option described above:</para>
733
734 <variablelist class='network-directives'>
735
9b3a67c5
TG
736 <varlistentry>
737 <term><varname>PoolOffset=</varname></term>
738 <term><varname>PoolSize=</varname></term>
739
740 <listitem><para>Configures the pool of addresses to hand out. The pool
741 is a contiguous sequence of IP addresses in the subnet configured for
742 the server address, which does not include the subnet nor the broadcast
743 address. <varname>PoolOffset=</varname> takes the offset of the pool
744 from the start of subnet, or zero to use the default value.
745 <varname>PoolSize=</varname> takes the number of IP addresses in the
b938cb90 746 pool or zero to use the default value. By default, the pool starts at
9b3a67c5
TG
747 the first address after the subnet address and takes up the rest of
748 the subnet, excluding the broadcast address. If the pool includes
749 the server address (the default), this is reserved and not handed
750 out to clients.</para></listitem>
751 </varlistentry>
752
ad943783
LP
753 <varlistentry>
754 <term><varname>DefaultLeaseTimeSec=</varname></term>
755 <term><varname>MaxLeaseTimeSec=</varname></term>
756
757 <listitem><para>Control the default and maximum DHCP lease
758 time to pass to clients. These settings take time values in seconds or
759 another common time unit, depending on the suffix. The default
760 lease time is used for clients that did not ask for a specific
761 lease time. If a client asks for a lease time longer than the
b938cb90 762 maximum lease time, it is automatically shortened to the
ad943783
LP
763 specified time. The default lease time defaults to 1h, the
764 maximum lease time to 12h. Shorter lease times are beneficial
765 if the configuration data in DHCP leases changes frequently
766 and clients shall learn the new settings with shorter
767 latencies. Longer lease times reduce the generated DHCP
768 network traffic.</para></listitem>
769 </varlistentry>
770
771 <varlistentry>
772 <term><varname>EmitDNS=</varname></term>
773 <term><varname>DNS=</varname></term>
774
775 <listitem><para>Configures whether the DHCP leases handed out
776 to clients shall contain DNS server information. The
777 <varname>EmitDNS=</varname> setting takes a boolean argument
778 and defaults to <literal>yes</literal>. The DNS servers to
779 pass to clients may be configured with the
780 <varname>DNS=</varname> option, which takes a list of IPv4
781 addresses. If the <varname>EmitDNS=</varname> option is
b938cb90 782 enabled but no servers configured, the servers are
ad943783
LP
783 automatically propagated from an "uplink" interface that has
784 appropriate servers set. The "uplink" interface is determined
785 by the default route of the system with the highest
786 priority. Note that this information is acquired at the time
787 the lease is handed out, and does not take uplink interfaces
788 into account that acquire DNS or NTP server information at a
789 later point. DNS server propagation does not take
790 <filename>/etc/resolv.conf</filename> into account. Also, note
a8eaaee7 791 that the leases are not refreshed if the uplink network
ad943783 792 configuration changes. To ensure clients regularly acquire the
b938cb90 793 most current uplink DNS server information, it is thus
ad943783
LP
794 advisable to shorten the DHCP lease time via
795 <varname>MaxLeaseTimeSec=</varname> described
796 above.</para></listitem>
797 </varlistentry>
798
799 <varlistentry>
800 <term><varname>EmitNTP=</varname></term>
801 <term><varname>NTP=</varname></term>
802
803 <listitem><para>Similar to the <varname>EmitDNS=</varname> and
b938cb90 804 <varname>DNS=</varname> settings described above, these
ad943783
LP
805 settings configure whether and what NTP server information
806 shall be emitted as part of the DHCP lease. The same syntax,
807 propagation semantics and defaults apply as for
808 <varname>EmitDNS=</varname> and
809 <varname>DNS=</varname>.</para></listitem>
810 </varlistentry>
811
812 <varlistentry>
813 <term><varname>EmitTimezone=</varname></term>
814 <term><varname>Timezone=</varname></term>
815
816 <listitem><para>Configures whether the DHCP leases handed out
817 to clients shall contain timezone information. The
818 <varname>EmitTimezone=</varname> setting takes a boolean
819 argument and defaults to <literal>yes</literal>. The
820 <varname>Timezone=</varname> setting takes a timezone string
821 (such as <literal>Europe/Berlin</literal> or
822 <literal>UTC</literal>) to pass to clients. If no explicit
b938cb90 823 timezone is set, the system timezone of the local host is
ad943783
LP
824 propagated, as determined by the
825 <filename>/etc/localtime</filename> symlink.</para></listitem>
826 </varlistentry>
827
828 </variablelist>
829 </refsect1>
830
798d3a52
ZJS
831 <refsect1>
832 <title>[Bridge] Section Options</title>
833 <para>The <literal>[Bridge]</literal> section accepts the
834 following keys.</para>
835 <variablelist class='network-directives'>
165c41a9
SS
836 <varlistentry>
837 <term><varname>UnicastFlood=</varname></term>
838 <listitem>
072f9e4a
ZJS
839 <para>A boolean. Controls whether the bridge should flood
840 traffic for which an FDB entry is missing and the destination
841 is unknown through this port. Defaults to on.
47c7dfe2 842 </para>
165c41a9
SS
843 </listitem>
844 </varlistentry>
845 <varlistentry>
846 <term><varname>HairPin=</varname></term>
847 <listitem>
47c7dfe2
ZJS
848 <para>A boolean. Configures whether traffic may be sent back
849 out of the port on which it was received. By default, this
850 flag is false, and the bridge will not forward traffic back
851 out of the receiving port.</para>
165c41a9
SS
852 </listitem>
853 </varlistentry>
854 <varlistentry>
84c34096 855 <term><varname>UseBPDU=</varname></term>
165c41a9 856 <listitem>
47c7dfe2 857 <para>A boolean. Configures whether STP Bridge Protocol Data Units will be
84c34096 858 processed by the bridge port. Defaults to yes.</para>
165c41a9
SS
859 </listitem>
860 </varlistentry>
861 <varlistentry>
862 <term><varname>FastLeave=</varname></term>
863 <listitem>
47c7dfe2 864 <para>A boolean. This flag allows the bridge to immediately stop multicast
a8eaaee7 865 traffic on a port that receives an IGMP Leave message. It is only used with
47c7dfe2 866 IGMP snooping if enabled on the bridge. Defaults to off.</para>
165c41a9
SS
867 </listitem>
868 </varlistentry>
869 <varlistentry>
23da66bb 870 <term><varname>AllowPortToBeRoot=</varname></term>
165c41a9 871 <listitem>
47c7dfe2
ZJS
872 <para>A boolean. Configures whether a given port is allowed to
873 become a root port. Only used when STP is enabled on the bridge.
23da66bb 874 Defaults to on.</para>
165c41a9
SS
875 </listitem>
876 </varlistentry>
798d3a52
ZJS
877 <varlistentry>
878 <term><varname>Cost=</varname></term>
879 <listitem>
47c7dfe2 880 <para>Sets the "cost" of sending packets of this interface.
a8eaaee7 881 Each port in a bridge may have a different speed and the cost
798d3a52 882 is used to decide which link to use. Faster interfaces
47c7dfe2 883 should have lower costs.</para>
798d3a52
ZJS
884 </listitem>
885 </varlistentry>
886 </variablelist>
887 </refsect1>
798d3a52
ZJS
888 <refsect1>
889 <title>[BridgeFDB] Section Options</title>
890 <para>The <literal>[BridgeFDB]</literal> section manages the
891 forwarding database table of a port and accepts the following
892 keys. Specify several <literal>[BridgeFDB]</literal> sections to
893 configure several static MAC table entries.</para>
894
895 <variablelist class='network-directives'>
896 <varlistentry>
897 <term><varname>MACAddress=</varname></term>
898 <listitem>
899 <para>As in the <literal>[Network]</literal> section. This
900 key is mandatory.</para>
901 </listitem>
902 </varlistentry>
903 <varlistentry>
904 <term><varname>VLANId=</varname></term>
905 <listitem>
a8eaaee7
JE
906 <para>The VLAN ID for the new static MAC table entry. If
907 omitted, no VLAN ID info is appended to the new static MAC
798d3a52
ZJS
908 table entry.</para>
909 </listitem>
910 </varlistentry>
911 </variablelist>
912 </refsect1>
913
914 <refsect1>
915 <title>Example</title>
916 <example>
12b42c76 917 <title>/etc/systemd/network/50-static.network</title>
798d3a52
ZJS
918
919 <programlisting>[Match]
eac684ef
TG
920Name=enp2s0
921
922[Network]
923Address=192.168.0.15/24
924Gateway=192.168.0.1</programlisting>
798d3a52 925 </example>
eac684ef 926
798d3a52 927 <example>
12b42c76 928 <title>/etc/systemd/network/80-dhcp.network</title>
eac684ef 929
798d3a52 930 <programlisting>[Match]
eac684ef
TG
931Name=en*
932
933[Network]
9c8ca3f7 934DHCP=yes</programlisting>
798d3a52 935 </example>
eac684ef 936
798d3a52 937 <example>
6c1695be 938 <title>/etc/systemd/network/25-bridge-static.network</title>
f47c5c47 939
798d3a52 940 <programlisting>[Match]
f47c5c47 941Name=bridge0
942
943[Network]
944Address=192.168.0.15/24
945Gateway=192.168.0.1
946DNS=192.168.0.1</programlisting>
798d3a52 947 </example>
f47c5c47 948
798d3a52 949 <example>
6c1695be 950 <title>/etc/systemd/network/25-bridge-slave-interface.network</title>
f47c5c47 951
798d3a52 952 <programlisting>[Match]
f47c5c47 953Name=enp2s0
954
955[Network]
956Bridge=bridge0</programlisting>
798d3a52
ZJS
957 </example>
958 <example>
6c1695be 959 <title>/etc/systemd/network/25-ipip.network</title>
0a8a0fad 960
798d3a52 961 <programlisting>[Match]
0a8a0fad
TG
962Name=em1
963
964[Network]
965Tunnel=ipip-tun</programlisting>
798d3a52 966 </example>
0a8a0fad 967
798d3a52 968 <example>
6c1695be 969 <title>/etc/systemd/network/25-sit.network</title>
0a8a0fad 970
798d3a52 971 <programlisting>[Match]
0a8a0fad
TG
972Name=em1
973
974[Network]
975Tunnel=sit-tun</programlisting>
798d3a52 976 </example>
0a8a0fad 977
798d3a52 978 <example>
6c1695be 979 <title>/etc/systemd/network/25-gre.network</title>
0a8a0fad 980
798d3a52 981 <programlisting>[Match]
0a8a0fad
TG
982Name=em1
983
984[Network]
985Tunnel=gre-tun</programlisting>
798d3a52 986 </example>
0a8a0fad 987
798d3a52 988 <example>
6c1695be 989 <title>/etc/systemd/network/25-vti.network</title>
0a8a0fad 990
798d3a52 991 <programlisting>[Match]
0a8a0fad
TG
992Name=em1
993
994[Network]
995Tunnel=vti-tun</programlisting>
798d3a52 996 </example>
d94facdc
MH
997
998 <example>
6c1695be 999 <title>/etc/systemd/network/25-bond.network</title>
d94facdc
MH
1000
1001 <programlisting>[Match]
1002Name=bond1
1003
1004[Network]
1005DHCP=yes
1006</programlisting>
1007 </example>
1008
798d3a52
ZJS
1009 </refsect1>
1010
1011 <refsect1>
1012 <title>See Also</title>
1013 <para>
1014 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1015 <citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
1016 <citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1017 <citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry>
1018 </para>
1019 </refsect1>
eac684ef
TG
1020
1021</refentry>