chiark / gitweb /
networkd: ipv4ll - configure link-local address independently of DHCPv4
[elogind.git] / man / systemd.network.xml
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
81         </refsect1>
82
83         <refsect1>
84                 <title>[Match] Section Options</title>
85
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
180         </refsect1>
181
182         <refsect1>
183                 <title>[Network] Section Options</title>
184
185                         <para>The <literal>[Network]</literal> section accepts the following keys:</para>
186
187                         <variablelist class='network-directives'>
188                                 <varlistentry>
189                                         <term><varname>Description=</varname></term>
190                                         <listitem>
191                                                 <para>A description of the device. This is only used for
192                                                 presentation purposes.</para>
193                                         </listitem>
194                                 </varlistentry>
195                                 <varlistentry>
196                                         <term><varname>DHCP=</varname></term>
197                                         <listitem>
198                                                 <para>Enables DHCPv4 and/or DHCPv6 support. Accepts
199                                                 <literal>both</literal>, <literal>none</literal>,
200                                                 <literal>v4</literal> or <literal>v6</literal>.</para>
201                                         </listitem>
202                                 </varlistentry>
203                                 <varlistentry>
204                                         <term><varname>DHCPServer=</varname></term>
205                                         <listitem>
206                                                 <para>A boolean. Enables a basic DHCPv4 server on the
207                                                 device. Mostly useful for handing out leases to container
208                                                 instances.</para>
209                                         </listitem>
210                                 </varlistentry>
211                                 <varlistentry>
212                                         <term><varname>IPv4LL=</varname></term>
213                                         <listitem>
214                                                 <para>A boolean. When true, enables IPv4 link-local support.
215                                                 </para>
216                                         </listitem>
217                                 </varlistentry>
218                                 <varlistentry>
219                                         <term><varname>IPv4LLRoute=</varname></term>
220                                         <listitem>
221                                                 <para>A boolean. When true, sets up the route needed for
222                                                 non-IPv4LL hosts to communicate with IPv4LL-only hosts. Defaults
223                                                 to true.
224                                                 </para>
225                                         </listitem>
226                                 </varlistentry>
227                                 <varlistentry>
228                                         <term><varname>Address=</varname></term>
229                                         <listitem>
230                                                 <para>A static IPv4 or IPv6 address and its prefix length,
231                                                 separated by a <literal>/</literal> character. Specify this
232                                                 key more than once to configure several addresses.
233                                                 The format of the address must be as described in
234                                                 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
235                                                 This is a short-hand for an [Address] section only containing
236                                                 an Address key (see below). This option may be specified
237                                                 more than once.
238                                                 </para>
239
240                                                 <para>If the specified
241                                                 address is 0.0.0.0
242                                                 (for IPv4) or [::]
243                                                 (for IPv6), a new
244                                                 address range of the
245                                                 requested size is
246                                                 automatically
247                                                 allocated from a
248                                                 system-wide pool of
249                                                 unused ranges. The
250                                                 allocated range is
251                                                 checked against all
252                                                 current network
253                                                 interfaces and all
254                                                 known network
255                                                 configuration files to
256                                                 avoid address range
257                                                 conflicts. The default
258                                                 system-wide pool
259                                                 consists of
260                                                 192.168.0.0/16,
261                                                 172.16.0.0/12 and
262                                                 10.0.0.0/8 for IPv4,
263                                                 and fc00::/7 for
264                                                 IPv6. This
265                                                 functionality is
266                                                 useful to manage a
267                                                 large number of
268                                                 dynamically created
269                                                 network interfaces
270                                                 with the same network
271                                                 configuration and
272                                                 automatic address
273                                                 range
274                                                 assignment.</para>
275
276                                         </listitem>
277                                 </varlistentry>
278                                 <varlistentry>
279                                         <term><varname>Gateway=</varname></term>
280                                         <listitem>
281                                                 <para>The gateway address, which must be in the format described in
282                                                 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
283                                                 This is a short-hand for a [Route] section only containing a Gateway
284                                                 key. This option may be specified more than once.</para>
285                                         </listitem>
286                                 </varlistentry>
287                                 <varlistentry>
288                                         <term><varname>DNS=</varname></term>
289                                         <listitem>
290                                                 <para>A DNS server address, which must be in the format described in
291                                                 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
292                                                 This option may be specified more than once.</para>
293                                         </listitem>
294                                 </varlistentry>
295 <!-- TODO: document NTP= option when it is actually used somewhere -->
296                                 <varlistentry>
297                                         <term><varname>Bridge=</varname></term>
298                                         <listitem>
299                                                 <para>The name of the bridge to add the link to.</para>
300                                         </listitem>
301                                 </varlistentry>
302                                 <varlistentry>
303                                         <term><varname>Bond=</varname></term>
304                                         <listitem>
305                                                 <para>The name of the bond to add the link to.</para>
306                                         </listitem>
307                                 </varlistentry>
308                                 <varlistentry>
309                                         <term><varname>VLAN=</varname></term>
310                                         <listitem>
311                                                 <para>The name of a VLAN to create on the link. This option
312                                                 may be specified more than once.</para>
313                                         </listitem>
314                                 </varlistentry>
315                                 <varlistentry>
316                                         <term><varname>MACVLAN=</varname></term>
317                                         <listitem>
318                                                 <para>The name of a MACVLAN to create on the link. This option
319                                                 may be specified more than once.</para>
320                                         </listitem>
321                                 </varlistentry>
322                                 <varlistentry>
323                                         <term><varname>VXLAN=</varname></term>
324                                         <listitem>
325                                                 <para>The name of a VXLAN to create on the link. This option
326                                                 may be specified more than once.</para>
327                                         </listitem>
328                                 </varlistentry>
329                                 <varlistentry>
330                                         <term><varname>Tunnel=</varname></term>
331                                         <listitem>
332                                                 <para>The name of a Tunnel to create on the link. This option
333                                                 may be specified more than once.</para>
334                                         </listitem>
335                                 </varlistentry>
336                         </variablelist>
337
338         </refsect1>
339
340         <refsect1>
341                 <title>[Address] Section Options</title>
342
343                         <para>An <literal>[Address]</literal> section accepts the following keys.
344                         Specify several <literal>[Address]</literal> sections to configure several
345                         addresses.</para>
346
347                         <variablelist class='network-directives'>
348                                 <varlistentry>
349                                         <term><varname>Address=</varname></term>
350                                         <listitem>
351                                                 <para>As in the <literal>[Network]</literal> section. This key is mandatory.</para>
352                                         </listitem>
353                                 </varlistentry>
354                                 <varlistentry>
355                                         <term><varname>Peer=</varname></term>
356                                         <listitem>
357                                                 <para>The peer address in a point-to-point connection. Accepts the same format as
358                                                 the <literal>Address</literal> key.</para>
359                                         </listitem>
360                                 </varlistentry>
361                                 <varlistentry>
362                                         <term><varname>Broadcast=</varname></term>
363                                         <listitem>
364                                                 <para>The broadcast address, which must be in the format described in
365                                                 <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
366                                                 This key only applies to IPv4 addresses. If it is not given, it is
367                                                 derived from the <literal>Address</literal> key.</para>
368                                         </listitem>
369                                 </varlistentry>
370                                 <varlistentry>
371                                         <term><varname>Label=</varname></term>
372                                         <listitem>
373                                                 <para>An address label.</para>
374                                         </listitem>
375                                 </varlistentry>
376                         </variablelist>
377         </refsect1>
378
379         <refsect1>
380                 <title>[Route] Section Options</title>
381                         <para>The <literal>[Route]</literal> section accepts the following keys. Specify
382                         several <literal>[Route]</literal> sections to configure several routes.</para>
383
384                         <variablelist class='network-directives'>
385                                 <varlistentry>
386                                         <term><varname>Gateway=</varname></term>
387                                         <listitem>
388                                                 <para>As in the <literal>[Network]</literal> section. This key is mandatory.</para>
389                                         </listitem>
390                                 </varlistentry>
391                                 <varlistentry>
392                                         <term><varname>Destination=</varname></term>
393                                         <listitem>
394                                                 <para>The destination prefix of the route. Possibly followed by a slash and the
395                                                 prefixlength. If ommitted, a full-length host route is assumed.</para>
396                                         </listitem>
397                                 </varlistentry>
398                                 <varlistentry>
399                                         <term><varname>Metric=</varname></term>
400                                         <listitem>
401                                                 <para>The metric of the route. An unsigned integer</para>
402                                         </listitem>
403                                 </varlistentry>
404                         </variablelist>
405         </refsect1>
406
407         <refsect1>
408                 <title>[DHCP] Section Options</title>
409                         <para>The <literal>[DHCP]</literal> section accepts the following keys:</para>
410
411                         <variablelist class='network-directives'>
412                                 <varlistentry>
413                                         <term><varname>UseDNS=</varname></term>
414                                         <listitem>
415                                                 <para>When true (the default), the DNS servers received from the DHCP server will
416                                                 be used and take precedence over any statically configured ones.</para>
417                                         </listitem>
418                                 </varlistentry>
419                                 <varlistentry>
420                                         <term><varname>UseMTU=</varname></term>
421                                         <listitem>
422                                                 <para>When true, the interface maximum transmission unit from the DHCP server will
423                                                 be used on the current link. Defaults to false.</para>
424                                         </listitem>
425                                 </varlistentry>
426                                 <varlistentry>
427                                         <term><varname>SendHostname=</varname></term>
428                                         <listitem>
429                                                 <para>When true (the default), the machine's hostname will be sent to the DHCP
430                                                 server</para>
431                                         </listitem>
432                                 </varlistentry>
433                                 <varlistentry>
434                                         <term><varname>UseHostname=</varname></term>
435                                         <listitem>
436                                                 <para>When true (the default), the hostname received from the DHCP server
437                                                 will be used as the transient hostname.</para>
438                                         </listitem>
439                                 </varlistentry>
440                                 <varlistentry>
441                                         <term><varname>UseRoutes=</varname></term>
442                                         <listitem>
443                                                 <para>When true (the default), the static routes will be requested from the DHCP server
444                                                 and added to the routing table with metric of 1024.</para>
445                                         </listitem>
446                                 </varlistentry>
447                                 <varlistentry>
448                                         <term><varname>CriticalConnection=</varname></term>
449                                         <listitem>
450                                                 <para>When true, the connection will never be torn down even if the DHCP lease
451                                                 expires. This is contrary to the DHCP specification, but may be the best choice
452                                                 if, say, the root filesystem relies on this connection. Defaults to false.</para>
453                                         </listitem>
454                                 </varlistentry>
455                                 <varlistentry>
456                                         <term><varname>VendorClassIdentifier=</varname></term>
457                                         <listitem>
458                                                 <para>The vendor class identifier used to identify vendor type and configuration.</para>
459                                         </listitem>
460                                 </varlistentry>
461                                 <varlistentry>
462                                         <term><varname>RequestBroadcast=</varname></term>
463                                         <listitem>
464                                                 <para>Request the server to use broadcast messages before the IP address has been
465                                                 configured. This is necessary for devices that cannot receive RAW packets, or that
466                                                 cannot receive packets at all before an IP address has been configured. On the other
467                                                 hand, this must not be enabled on networks where broadcasts are filtered out.</para>
468                                         </listitem>
469                                 </varlistentry>
470                        </variablelist>
471
472         </refsect1>
473
474         <refsect1>
475                 <title>Example</title>
476                 <example>
477                         <title>/etc/systemd/network/50-static.network</title>
478
479                         <programlisting>[Match]
480 Name=enp2s0
481
482 [Network]
483 Address=192.168.0.15/24
484 Gateway=192.168.0.1</programlisting>
485                 </example>
486
487                 <example>
488                         <title>/etc/systemd/network/80-dhcp.network</title>
489
490                         <programlisting>[Match]
491 Name=en*
492
493 [Network]
494 DHCP=yes</programlisting>
495                 </example>
496
497                 <example>
498                         <title>/etc/systemd/network/bridge-static.network</title>
499
500                         <programlisting>[Match]
501 Name=bridge0
502
503 [Network]
504 Address=192.168.0.15/24
505 Gateway=192.168.0.1
506 DNS=192.168.0.1</programlisting>
507                 </example>
508
509                 <example>
510                         <title>/etc/systemd/network/bridge-slave-interface.network</title>
511
512                         <programlisting>[Match]
513 Name=enp2s0
514
515 [Network]
516 Bridge=bridge0</programlisting>
517                 </example>
518                 <example>
519                         <title>/etc/systemd/network/ipip.network</title>
520
521                         <programlisting>[Match]
522 Name=em1
523
524 [Network]
525 Tunnel=ipip-tun</programlisting>
526                 </example>
527
528                 <example>
529                         <title>/etc/systemd/network/sit.network</title>
530
531                         <programlisting>[Match]
532 Name=em1
533
534 [Network]
535 Tunnel=sit-tun</programlisting>
536                 </example>
537
538                 <example>
539                         <title>/etc/systemd/network/gre.network</title>
540
541                         <programlisting>[Match]
542 Name=em1
543
544 [Network]
545 Tunnel=gre-tun</programlisting>
546                 </example>
547
548                 <example>
549                         <title>/etc/systemd/network/vti.network</title>
550
551                         <programlisting>[Match]
552 Name=em1
553
554 [Network]
555 Tunnel=vti-tun</programlisting>
556                 </example>
557         </refsect1>
558
559         <refsect1>
560                 <title>See Also</title>
561                 <para>
562                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
563                         <citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
564                         <citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry>
565                 </para>
566         </refsect1>
567
568 </refentry>