chiark / gitweb /
man: sd_bus_path_encode - fix order of arguments
[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
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
67     <filename>/usr/lib/systemd/network</filename>, the volatile
68     runtime network directory
69     <filename>/run/systemd/network</filename> and the local
70     administration network directory
71     <filename>/etc/systemd/network</filename>. All configuration files
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
77     name in <filename>/usr/lib</filename>. This can be used to
78     override a system-supplied configuration file with a local file if
79     needed; a symlink in <filename>/etc</filename> with the same name
80     as a configuration file in <filename>/usr/lib</filename>, pointing
81     to <filename>/dev/null</filename>, disables the configuration file
82     entirely.</para>
83
84   </refsect1>
85
86   <refsect1>
87     <title>[Match] Section Options</title>
88
89       <para>The network file contains a <literal>[Match]</literal>
90       section, which determines if a given network file may be applied
91       to a given device; and a <literal>[Network]</literal> section
92       specifying how the device should be configured. The first (in
93       lexical order) of the network files that matches a given device
94       is applied.</para>
95
96       <para>A network file is said to match a device if each of the
97       entries in the <literal>[Match]</literal> section matches, or if
98       the section is empty. The following keys are accepted:</para>
99
100       <variablelist class='network-directives'>
101         <varlistentry>
102           <term><varname>MACAddress=</varname></term>
103           <listitem>
104             <para>The hardware address.</para>
105           </listitem>
106         </varlistentry>
107         <varlistentry>
108           <term><varname>Path=</varname></term>
109           <listitem>
110             <para>The persistent path, as exposed by the udev
111             property <literal>ID_PATH</literal>. May contain shell
112             style globs.</para>
113           </listitem>
114         </varlistentry>
115         <varlistentry>
116           <term><varname>Driver=</varname></term>
117           <listitem>
118             <para>The driver currently bound to the device, as
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>
128             <para>The device type, as exposed by the udev property
129             <literal>DEVTYPE</literal>.</para>
130           </listitem>
131         </varlistentry>
132         <varlistentry>
133           <term><varname>Name=</varname></term>
134           <listitem>
135             <para>The device name, as exposed by the udev property
136             <literal>INTERFACE</literal>. May contain shell style
137             globs.</para>
138           </listitem>
139         </varlistentry>
140         <varlistentry>
141           <term><varname>Host=</varname></term>
142           <listitem>
143             <para>Matches against the hostname or machine ID of the
144             host. See <literal>ConditionHost=</literal> in
145             <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
146             for details.
147             </para>
148           </listitem>
149         </varlistentry>
150         <varlistentry>
151           <term><varname>Virtualization=</varname></term>
152           <listitem>
153             <para>Checks whether the system is executed in a virtualized
154             environment and optionally test whether it is a specific
155             implementation. See <literal>ConditionVirtualization=</literal> in
156             <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
157             for details.
158             </para>
159           </listitem>
160         </varlistentry>
161         <varlistentry>
162           <term><varname>KernelCommandLine=</varname></term>
163           <listitem>
164             <para>Checks whether a specific kernel command line option is
165             set (or if prefixed with the exclamation mark unset). See
166             <literal>ConditionKernelCommandLine=</literal> in
167             <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
168             for details.
169             </para>
170           </listitem>
171         </varlistentry>
172         <varlistentry>
173           <term><varname>Architecture=</varname></term>
174           <listitem>
175             <para>Checks whether the system is running on a specific
176             architecture. See <literal>ConditionArchitecture=</literal> in
177             <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
178             for details.
179             </para>
180           </listitem>
181         </varlistentry>
182       </variablelist>
183
184   </refsect1>
185
186   <refsect1>
187     <title>[Link] Section Options</title>
188
189     <para> The <literal>[Link]</literal> section accepts the following keys:</para>
190
191     <variablelist class='network-directives'>
192       <varlistentry>
193         <term><varname>MACAddress=</varname></term>
194         <listitem>
195           <para>The hardware address.</para>
196         </listitem>
197       </varlistentry>
198       <varlistentry>
199         <term><varname>MTUBytes=</varname></term>
200         <listitem>
201           <para>The maximum transmission unit in bytes to set for the
202           device. The usual suffixes K, M, G, are supported and are
203           understood to the base of 1024.</para>
204         </listitem>
205       </varlistentry>
206     </variablelist>
207   </refsect1>
208
209   <refsect1>
210     <title>[Network] Section Options</title>
211
212       <para>The <literal>[Network]</literal> section accepts the following keys:</para>
213
214       <variablelist class='network-directives'>
215         <varlistentry>
216           <term><varname>Description=</varname></term>
217           <listitem>
218             <para>A description of the device. This is only used for
219             presentation purposes.</para>
220           </listitem>
221         </varlistentry>
222         <varlistentry>
223           <term><varname>DHCP=</varname></term>
224           <listitem>
225             <para>Enables DHCPv4 and/or DHCPv6 support. Accepts
226             <literal>yes</literal>, <literal>no</literal>,
227             <literal>ipv4</literal>, or <literal>ipv6</literal>.</para>
228           </listitem>
229         </varlistentry>
230         <varlistentry>
231           <term><varname>DHCPServer=</varname></term>
232           <listitem>
233             <para>A boolean. Enables a basic DHCPv4 server on the
234             device. Mostly useful for handing out leases to container
235             instances.</para>
236           </listitem>
237         </varlistentry>
238         <varlistentry>
239           <term><varname>LinkLocal=</varname></term>
240           <listitem>
241             <para>Enables link-local address autoconfiguration. Accepts
242             <literal>yes</literal>, <literal>no</literal>,
243             <literal>ipv4</literal>, or <literal>ipv6</literal>. Defaults to
244             <literal>ipv6</literal>.</para>
245           </listitem>
246         </varlistentry>
247         <varlistentry>
248           <term><varname>IPv4LLRoute=</varname></term>
249           <listitem>
250             <para>A boolean. When true, sets up the route needed for
251             non-IPv4LL hosts to communicate with IPv4LL-only hosts. Defaults
252             to false.
253             </para>
254           </listitem>
255         </varlistentry>
256         <varlistentry>
257           <term><varname>LLMNR=</varname></term>
258           <listitem>
259             <para>A boolean or <literal>resolve</literal>. When true, enables
260             Link-Local Multicast Name Resolution on the link, when set to
261             <literal>resolve</literal> only resolution is enabled, but not
262             announcement. Defaults to true.</para>
263           </listitem>
264         </varlistentry>
265         <varlistentry>
266           <term><varname>LLDP=</varname></term>
267           <listitem>
268             <para>A boolean. When true, enables LLDP link receive support.
269             </para>
270           </listitem>
271         </varlistentry>
272         <varlistentry>
273           <term><varname>Address=</varname></term>
274           <listitem>
275             <para>A static IPv4 or IPv6 address and its prefix length,
276             separated by a <literal>/</literal> character. Specify
277             this key more than once to configure several addresses.
278             The format of the address must be as described in
279             <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
280             This is a short-hand for an [Address] section only
281             containing an Address key (see below). This option may be
282             specified more than once.
283             </para>
284
285             <para>If the specified address is 0.0.0.0 (for IPv4) or
286             [::] (for IPv6), a new address range of the requested size
287             is automatically allocated from a system-wide pool of
288             unused ranges. The allocated range is checked against all
289             current network interfaces and all known network
290             configuration files to avoid address range conflicts. The
291             default system-wide pool consists of 192.168.0.0/16,
292             172.16.0.0/12 and 10.0.0.0/8 for IPv4, and fc00::/7 for
293             IPv6. This functionality is useful to manage a large
294             number of dynamically created network interfaces with the
295             same network configuration and automatic address range
296             assignment.</para>
297
298           </listitem>
299         </varlistentry>
300         <varlistentry>
301           <term><varname>Gateway=</varname></term>
302           <listitem>
303             <para>The gateway address, which must be in the format
304             described in
305             <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
306             This is a short-hand for a [Route] section only containing
307             a Gateway key. This option may be specified more than
308             once.</para>
309           </listitem>
310         </varlistentry>
311         <varlistentry>
312           <term><varname>DNS=</varname></term>
313           <listitem>
314             <para>A DNS server address, which must be in the format
315             described in
316             <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
317             This option may be specified more than once.</para>
318           </listitem>
319         </varlistentry>
320         <varlistentry>
321           <term><varname>Domains=</varname></term>
322           <listitem>
323             <para>The domains used for DNS resolution over this link.</para>
324           </listitem>
325         </varlistentry>
326         <varlistentry>
327           <term><varname>NTP=</varname></term>
328           <listitem>
329             <para>An NTP server address. This option may be specified more than once.</para>
330           </listitem>
331         </varlistentry>
332         <varlistentry>
333           <term><varname>IPForward=</varname></term>
334           <listitem><para>Configures IP forwarding for the network
335           interface. If enabled incoming packets on the network
336           interface will be forwarded to other interfaces according to
337           the routing table. Takes either a boolean argument, or the
338           values <literal>ipv4</literal> or <literal>ipv6</literal>,
339           which only enables IP forwarding for the specified address
340           family.</para></listitem>
341         </varlistentry>
342         <varlistentry>
343           <term><varname>IPMasquerade=</varname></term>
344           <listitem><para>Configures IP masquerading for the network
345           interface. If enabled packets forwarded from the network
346           interface will be appear as coming from the local host.
347           Takes a boolean argument. Implies
348           <varname>IPForward=yes</varname>.</para></listitem>
349         </varlistentry>
350         <varlistentry>
351           <term><varname>Bridge=</varname></term>
352           <listitem>
353             <para>The name of the bridge to add the link to.</para>
354           </listitem>
355         </varlistentry>
356         <varlistentry>
357           <term><varname>Bond=</varname></term>
358           <listitem>
359             <para>The name of the bond to add the link to.</para>
360           </listitem>
361         </varlistentry>
362         <varlistentry>
363           <term><varname>VLAN=</varname></term>
364           <listitem>
365             <para>The name of a VLAN to create on the link. This
366             option may be specified more than once.</para>
367           </listitem>
368         </varlistentry>
369         <varlistentry>
370           <term><varname>MACVLAN=</varname></term>
371           <listitem>
372             <para>The name of a MACVLAN to create on the link. This
373             option may be specified more than once.</para>
374           </listitem>
375         </varlistentry>
376         <varlistentry>
377           <term><varname>VXLAN=</varname></term>
378           <listitem>
379             <para>The name of a VXLAN to create on the link. This
380             option may be specified more than once.</para>
381           </listitem>
382         </varlistentry>
383         <varlistentry>
384           <term><varname>Tunnel=</varname></term>
385           <listitem>
386             <para>The name of a Tunnel to create on the link. This
387             option may be specified more than once.</para>
388           </listitem>
389         </varlistentry>
390       </variablelist>
391
392   </refsect1>
393
394   <refsect1>
395     <title>[Address] Section Options</title>
396
397       <para>An <literal>[Address]</literal> section accepts the
398       following keys. Specify several <literal>[Address]</literal>
399       sections to configure several addresses.</para>
400
401       <variablelist class='network-directives'>
402         <varlistentry>
403           <term><varname>Address=</varname></term>
404           <listitem>
405             <para>As in the <literal>[Network]</literal> section. This
406             key is mandatory.</para>
407           </listitem>
408         </varlistentry>
409         <varlistentry>
410           <term><varname>Peer=</varname></term>
411           <listitem>
412             <para>The peer address in a point-to-point connection.
413             Accepts the same format as the <literal>Address</literal>
414             key.</para>
415           </listitem>
416         </varlistentry>
417         <varlistentry>
418           <term><varname>Broadcast=</varname></term>
419           <listitem>
420             <para>The broadcast address, which must be in the format
421             described in
422             <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
423             This key only applies to IPv4 addresses. If it is not
424             given, it is derived from the <literal>Address</literal>
425             key.</para>
426           </listitem>
427         </varlistentry>
428         <varlistentry>
429           <term><varname>Label=</varname></term>
430           <listitem>
431             <para>An address label.</para>
432           </listitem>
433         </varlistentry>
434       </variablelist>
435   </refsect1>
436
437   <refsect1>
438     <title>[Route] Section Options</title>
439       <para>The <literal>[Route]</literal> section accepts the
440       following keys. Specify several <literal>[Route]</literal>
441       sections to configure several routes.</para>
442
443       <variablelist class='network-directives'>
444         <varlistentry>
445           <term><varname>Gateway=</varname></term>
446           <listitem>
447             <para>As in the <literal>[Network]</literal> section.</para>
448           </listitem>
449         </varlistentry>
450         <varlistentry>
451           <term><varname>Destination=</varname></term>
452           <listitem>
453             <para>The destination prefix of the route. Possibly
454             followed by a slash and the prefixlength. If omitted, a
455             full-length host route is assumed.</para>
456           </listitem>
457         </varlistentry>
458         <varlistentry>
459           <term><varname>Source=</varname></term>
460           <listitem>
461             <para>The source prefix of the route. Possibly followed by
462             a slash and the prefixlength. If omitted, a full-length
463             host route is assumed.</para>
464           </listitem>
465         </varlistentry>
466         <varlistentry>
467           <term><varname>Metric=</varname></term>
468           <listitem>
469             <para>The metric of the route. An unsigned integer</para>
470           </listitem>
471         </varlistentry>
472         <varlistentry>
473           <term><varname>Scope=</varname></term>
474           <listitem>
475             <para>The scope of the route. One of the values <literal>global</literal>,
476             <literal>link</literal> or <literal>host</literal>. Defaults to
477             <literal>global</literal>.</para>
478           </listitem>
479         </varlistentry>
480       </variablelist>
481   </refsect1>
482
483   <refsect1>
484     <title>[DHCP] Section Options</title>
485       <para>The <literal>[DHCP]</literal> section accepts the following keys:</para>
486
487       <variablelist class='network-directives'>
488         <varlistentry>
489           <term><varname>UseDNS=</varname></term>
490           <listitem>
491             <para>When true (the default), the DNS servers received
492             from the DHCP server will be used and take precedence over
493             any statically configured ones.</para>
494           </listitem>
495         </varlistentry>
496         <varlistentry>
497           <term><varname>UseMTU=</varname></term>
498           <listitem>
499             <para>When true, the interface maximum transmission unit
500             from the DHCP server will be used on the current link.
501             Defaults to false.</para>
502           </listitem>
503         </varlistentry>
504         <varlistentry>
505           <term><varname>SendHostname=</varname></term>
506           <listitem>
507             <para>When true (the default), the machine's hostname will be sent to the DHCP
508             server</para>
509           </listitem>
510         </varlistentry>
511         <varlistentry>
512           <term><varname>UseHostname=</varname></term>
513           <listitem>
514             <para>When true (the default), the hostname received from
515             the DHCP server will be used as the transient
516             hostname.</para>
517           </listitem>
518         </varlistentry>
519         <varlistentry>
520           <term><varname>UseDomains=</varname></term>
521           <listitem>
522             <para>When true (not the default), the domain name
523             received from the DHCP server will be used for DNS
524             resolution over this link.</para>
525           </listitem>
526         </varlistentry>
527         <varlistentry>
528           <term><varname>UseRoutes=</varname></term>
529           <listitem>
530             <para>When true (the default), the static routes will be
531             requested from the DHCP server and added to the routing
532             table with metric of 1024.</para>
533           </listitem>
534         </varlistentry>
535         <varlistentry>
536           <term><varname>CriticalConnection=</varname></term>
537           <listitem>
538             <para>When true, the connection will never be torn down
539             even if the DHCP lease expires. This is contrary to the
540             DHCP specification, but may be the best choice if, say,
541             the root filesystem relies on this connection. Defaults to
542             false.</para>
543           </listitem>
544         </varlistentry>
545         <varlistentry>
546           <term><varname>VendorClassIdentifier=</varname></term>
547           <listitem>
548             <para>The vendor class identifier used to identify vendor
549             type and configuration.</para>
550           </listitem>
551         </varlistentry>
552         <varlistentry>
553           <term><varname>RequestBroadcast=</varname></term>
554           <listitem>
555             <para>Request the server to use broadcast messages before
556             the IP address has been configured. This is necessary for
557             devices that cannot receive RAW packets, or that cannot
558             receive packets at all before an IP address has been
559             configured. On the other hand, this must not be enabled on
560             networks where broadcasts are filtered out.</para>
561           </listitem>
562         </varlistentry>
563         <varlistentry>
564           <term><varname>RouteMetric=</varname></term>
565           <listitem>
566             <para>Set the routing metric for routes specified by the
567             DHCP server.</para>
568           </listitem>
569         </varlistentry>
570            </variablelist>
571
572   </refsect1>
573
574   <refsect1>
575     <title>[Bridge] Section Options</title>
576       <para>The <literal>[Bridge]</literal> section accepts the
577       following keys.</para>
578       <variablelist class='network-directives'>
579         <varlistentry>
580           <term><varname>Cost=</varname></term>
581           <listitem>
582             <para>Each port in a bridge may have different speed. Cost
583             is used to decide which link to use. Faster interfaces
584             should have lower costs</para>
585           </listitem>
586         </varlistentry>
587       </variablelist>
588   </refsect1>
589
590   <refsect1>
591     <title>[BridgeFDB] Section Options</title>
592       <para>The <literal>[BridgeFDB]</literal> section manages the
593       forwarding database table of a port and accepts the following
594       keys. Specify several <literal>[BridgeFDB]</literal> sections to
595       configure several static MAC table entries.</para>
596
597       <variablelist class='network-directives'>
598         <varlistentry>
599           <term><varname>MACAddress=</varname></term>
600           <listitem>
601             <para>As in the <literal>[Network]</literal> section. This
602             key is mandatory.</para>
603           </listitem>
604         </varlistentry>
605         <varlistentry>
606           <term><varname>VLANId=</varname></term>
607           <listitem>
608             <para>The VLAN Id for the new static MAC table entry. If
609             omitted, no VLAN Id info is appended to the new static MAC
610             table entry.</para>
611           </listitem>
612         </varlistentry>
613       </variablelist>
614   </refsect1>
615
616   <refsect1>
617     <title>Example</title>
618     <example>
619       <title>/etc/systemd/network/50-static.network</title>
620
621       <programlisting>[Match]
622 Name=enp2s0
623
624 [Network]
625 Address=192.168.0.15/24
626 Gateway=192.168.0.1</programlisting>
627     </example>
628
629     <example>
630       <title>/etc/systemd/network/80-dhcp.network</title>
631
632       <programlisting>[Match]
633 Name=en*
634
635 [Network]
636 DHCP=both</programlisting>
637     </example>
638
639     <example>
640       <title>/etc/systemd/network/bridge-static.network</title>
641
642       <programlisting>[Match]
643 Name=bridge0
644
645 [Network]
646 Address=192.168.0.15/24
647 Gateway=192.168.0.1
648 DNS=192.168.0.1</programlisting>
649     </example>
650
651     <example>
652       <title>/etc/systemd/network/bridge-slave-interface.network</title>
653
654       <programlisting>[Match]
655 Name=enp2s0
656
657 [Network]
658 Bridge=bridge0</programlisting>
659     </example>
660     <example>
661       <title>/etc/systemd/network/ipip.network</title>
662
663       <programlisting>[Match]
664 Name=em1
665
666 [Network]
667 Tunnel=ipip-tun</programlisting>
668     </example>
669
670     <example>
671       <title>/etc/systemd/network/sit.network</title>
672
673       <programlisting>[Match]
674 Name=em1
675
676 [Network]
677 Tunnel=sit-tun</programlisting>
678     </example>
679
680     <example>
681       <title>/etc/systemd/network/gre.network</title>
682
683       <programlisting>[Match]
684 Name=em1
685
686 [Network]
687 Tunnel=gre-tun</programlisting>
688     </example>
689
690     <example>
691       <title>/etc/systemd/network/vti.network</title>
692
693       <programlisting>[Match]
694 Name=em1
695
696 [Network]
697 Tunnel=vti-tun</programlisting>
698     </example>
699   </refsect1>
700
701   <refsect1>
702     <title>See Also</title>
703     <para>
704       <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
705       <citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
706       <citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
707       <citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry>
708     </para>
709   </refsect1>
710
711 </refentry>