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