chiark / gitweb /
memfd: internalize functions, drop sd_memfd type
[elogind.git] / man / systemd.netdev.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.netdev" 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.netdev</refentrytitle>
42                 <manvolnum>5</manvolnum>
43         </refmeta>
44
45         <refnamediv>
46                 <refname>systemd.netdev</refname>
47                 <refpurpose>Virtual Network Device configuration</refpurpose>
48         </refnamediv>
49
50         <refsynopsisdiv>
51                 <para><filename><replaceable>netdev</replaceable>.netdev</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>Virtual Network Device files must have the extension
62                 <filename>.netdev</filename>; other extensions are ignored. Virtual
63                 network devices are created as soon as networkd is started. If a netdev
64                 with the specified name already exists, networkd will use that as-is
65                 rather than create its own. Note that the settings of the pre-existing
66                 netdev will not be changed by networkd.</para>
67
68                 <para>The <filename>.netdev</filename> files are read from the files located in the
69                 system network directory <filename>/usr/lib/systemd/network</filename>,
70                 the volatile runtime network directory
71                 <filename>/run/systemd/network</filename> and the local administration
72                 network directory <filename>/etc/systemd/network</filename>.
73                 All configuration files are collectively sorted and processed in lexical order,
74                 regardless of the directories in which they live. However, files with
75                 identical filenames replace each other. Files in
76                 <filename>/etc</filename> have the highest priority, files in
77                 <filename>/run</filename> take precedence over files with the same
78                 name in <filename>/usr/lib</filename>. This can be used to override a
79                 system-supplied configuration file with a local file if needed; a symlink in
80                 <filename>/etc</filename> with the same name as a configuration file in
81                 <filename>/usr/lib</filename>, pointing to <filename>/dev/null</filename>,
82                 disables the configuration file entirely.</para>
83
84         </refsect1>
85
86         <refsect1>
87                 <title>[Match] Section Options</title>
88
89                 <para>A virtual network device is only created if the
90                 <literal>[Match]</literal> section matches the current
91                 environment, or if the section is empty. The following keys are accepted:</para>
92
93                         <variablelist class='network-directives'>
94                                 <varlistentry>
95                                         <term><varname>Host=</varname></term>
96                                         <listitem>
97                                                 <para>Matches against the hostname or machine ID of the
98                                                 host. See <literal>ConditionHost=</literal> in
99                                                 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
100                                                 for details.
101                                                 </para>
102                                         </listitem>
103                                 </varlistentry>
104                                 <varlistentry>
105                                         <term><varname>Virtualization=</varname></term>
106                                         <listitem>
107                                                 <para>Checks whether the system is executed in a virtualized
108                                                 environment and optionally test whether it is a specific
109                                                 implementation. See <literal>ConditionVirtualization=</literal> in
110                                                 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
111                                                 for details.
112                                                 </para>
113                                         </listitem>
114                                 </varlistentry>
115                                 <varlistentry>
116                                         <term><varname>KernelCommandLine=</varname></term>
117                                         <listitem>
118                                                 <para>Checks whether a specific kernel command line option is
119                                                 set (or if prefixed with the exclamation mark unset). See
120                                                 <literal>ConditionKernelCommandLine=</literal> in
121                                                 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
122                                                 for details.
123                                                 </para>
124                                         </listitem>
125                                 </varlistentry>
126                                 <varlistentry>
127                                         <term><varname>Architecture=</varname></term>
128                                         <listitem>
129                                                 <para>Checks whether the system is running on a specific
130                                                 architecture. See <literal>ConditionArchitecture=</literal> in
131                                                 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
132                                                 for details.
133                                                 </para>
134                                         </listitem>
135                                 </varlistentry>
136                         </variablelist>
137
138         </refsect1>
139
140         <refsect1>
141                 <title>[NetDev] Section Options</title>
142
143                         <para>The <literal>[NetDev]</literal> section accepts the following
144                         keys:</para>
145
146                         <variablelist class='network-directives'>
147                                 <varlistentry>
148                                         <term><varname>Description=</varname></term>
149                                         <listitem>
150                                                 <para>A free-form description of the netdev.
151                                                 </para>
152                                         </listitem>
153                                 </varlistentry>
154                                 <varlistentry>
155                                         <term><varname>Name=</varname></term>
156                                         <listitem>
157                                                 <para>The interface name used when creating the
158                                                 netdev. This option is compulsory.</para>
159                                         </listitem>
160                                 </varlistentry>
161                                 <varlistentry>
162                                         <term><varname>Kind=</varname></term>
163                                         <listitem>
164                                                 <para>The netdev kind. Currently, <literal>bridge</literal>,
165                                                 <literal>bond</literal>, <literal>vlan</literal>,
166                                                 <literal>macvlan</literal>, <literal>vxlan</literal>,
167                                                 <literal>ipip</literal>, <literal>gre</literal>,
168                                                 <literal>sit</literal>, <literal>vti</literal>,
169                                                 <literal>veth</literal>, <literal>tun</literal>,
170                                                 <literal>tap</literal> and <literal>dummy</literal>
171                                                 are supported. This option is compulsory.</para>
172                                         </listitem>
173                                 </varlistentry>
174                                 <varlistentry>
175                                         <term><varname>MTUBytes=</varname></term>
176                                         <listitem>
177                                                 <para>The maximum transmission unit in bytes to
178                                                 set for the device. The usual suffixes K, M, G,
179                                                 are supported and are understood to the base of
180                                                 1024.</para>
181                                         </listitem>
182                                 </varlistentry>
183                                 <varlistentry>
184                                         <term><varname>MACAddress=</varname></term>
185                                         <listitem>
186                                                 <para>The MAC address to use for the device.
187                                                 If none is given, one is generated based on
188                                                 the interface name and the
189                                                 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
190                                                 </para>
191                                         </listitem>
192                                 </varlistentry>
193                         </variablelist>
194         </refsect1>
195
196         <refsect1>
197                 <title>[VLAN] Section Options</title>
198
199                         <para>The <literal>[VLAN]</literal> section only applies for netdevs of kind <literal>vlan</literal>,
200                         and accepts the following key:</para>
201
202                         <variablelist class='network-directives'>
203                                 <varlistentry>
204                                         <term><varname>Id=</varname></term>
205                                         <listitem>
206                                                 <para>The VLAN ID to use. An integer in the range 0–4094.
207                                                 This option is compulsory.</para>
208                                         </listitem>
209                                 </varlistentry>
210                         </variablelist>
211
212         </refsect1>
213
214         <refsect1>
215                 <title>[MACVLAN] Section Options</title>
216
217                         <para>The <literal>[MACVLAN]</literal> section only applies for netdevs of kind
218                         <literal>macvlan</literal>, and accepts the following key:</para>
219
220                         <variablelist class='network-directives'>
221                                 <varlistentry>
222                                         <term><varname>Mode=</varname></term>
223                                         <listitem>
224                                                 <para>The MACVLAN mode to use. The supported options are
225                                                 <literal>private</literal>, <literal>vepa</literal>,
226                                                 <literal>bridge</literal> and <literal>passthru</literal>.
227                                                 </para>
228                                         </listitem>
229                                 </varlistentry>
230                         </variablelist>
231
232         </refsect1>
233         <refsect1>
234                 <title>[VXLAN] Section Options</title>
235                         <para>The <literal>[VXLAN]</literal> section only applies for netdevs of kind
236                         <literal>vxlan</literal>, and accepts the following key:</para>
237
238                         <variablelist class='network-directives'>
239                                 <varlistentry>
240                                         <term><varname>Id=</varname></term>
241                                         <listitem>
242                                                 <para>The VXLAN ID to use.</para>
243                                         </listitem>
244                                 </varlistentry>
245                                 <varlistentry>
246                                         <term><varname>Group=</varname></term>
247                                         <listitem>
248                                                 <para>An assigned multicast group IP address.</para>
249                                         </listitem>
250                                 </varlistentry>
251                                 <varlistentry>
252                                         <term><varname>TOS=</varname></term>
253                                         <listitem>
254                                                 <para>The Type Of Service byte value for a vxlan interface.</para>
255                                         </listitem>
256                                 </varlistentry>
257                                 <varlistentry>
258                                         <term><varname>TTL=</varname></term>
259                                         <listitem>
260                                                 <para>A fixed Time To Live N on Virtual eXtensible Local Area Network packets.
261                                                 N is a number in the range 1-255. 0 is a special value meaning that packets
262                                                 inherit the TTL value.</para>
263                                         </listitem>
264                                 </varlistentry>
265                                 <varlistentry>
266                                         <term><varname>MacLearning=</varname></term>
267                                         <listitem>
268                                                 <para>A boolean. When true, enables dynamic MAC learning
269                                                 to discover remote MAC addresses.</para>
270                                         </listitem>
271                                 </varlistentry>
272                         </variablelist>
273         </refsect1>
274         <refsect1>
275                 <title>[Tunnel] Section Options</title>
276
277                         <para>The <literal>[Tunnel]</literal> section only applies for netdevs of kind
278                         <literal>ipip</literal>, <literal>sit</literal>, <literal>gre</literal> and
279                         <literal>vti</literal> and accepts the following keys:</para>
280
281                         <variablelist class='network-directives'>
282                                 <varlistentry>
283                                         <term><varname>Local=</varname></term>
284                                         <listitem>
285                                                 <para>A static local address for tunneled packets.
286                                                 It must be an address on another interface of this host.</para>
287                                         </listitem>
288                                 </varlistentry>
289                                 <varlistentry>
290                                         <term><varname>Remote=</varname></term>
291                                         <listitem>
292                                                 <para>The remote endpoint of the tunnel.</para>
293                                         </listitem>
294                                 </varlistentry>
295                                 <varlistentry>
296                                         <term><varname>TOS=</varname></term>
297                                         <listitem>
298                                                 <para>The Type Of Service byte value for a tunnel interface.
299                                                 For details about the TOS see the
300                                                 <ulink url="http://tools.ietf.org/html/rfc1349">
301                                                 Type of Service in the Internet Protocol Suite
302                                                 </ulink> document.
303                                                 </para>
304                                         </listitem>
305                                 </varlistentry>
306                                 <varlistentry>
307                                         <term><varname>TTL=</varname></term>
308                                         <listitem>
309                                                 <para>A fixed Time To Live N on tunneled packets.
310                                                 N is a number in the range 1-255. 0 is a special value meaning that packets
311                                                 inherit the TTL value. The default value for IPv4 tunnels is: inherit.
312                                                 The default value for IPv6 tunnels is: 64.</para>
313                                         </listitem>
314                                 </varlistentry>
315                                 <varlistentry>
316                                         <term><varname>DiscoverPathMTU=</varname></term>
317                                         <listitem>
318                                                 <para>A boolean. When true, enables Path MTU Discovery on the tunnel.</para>
319                                         </listitem>
320                                 </varlistentry>
321                         </variablelist>
322         </refsect1>
323         <refsect1>
324                 <title>[Peer] Section Options</title>
325
326                         <para>The <literal>[Peer]</literal> section only applies for netdevs of kind <literal>veth</literal>
327                         and accepts the following key:</para>
328
329                         <variablelist class='network-directives'>
330                                 <varlistentry>
331                                         <term><varname>Name=</varname></term>
332                                         <listitem>
333                                                 <para>The interface name used when creating the netdev.
334                                                 This option is compulsory.</para>
335                                         </listitem>
336                                 </varlistentry>
337                                 <varlistentry>
338                                         <term><varname>MACAddress=</varname></term>
339                                         <listitem>
340                                                 <para>The peer MACAddress, if not set it is generated in the same
341                                                 way as the MAC address of the main interface.</para>
342                                         </listitem>
343                                 </varlistentry>
344                         </variablelist>
345         </refsect1>
346         <refsect1>
347                 <title>[Tun] Section Options</title>
348
349                         <para>The <literal>[Tun]</literal> section only applies for netdevs of kind
350                         <literal>tun</literal>, and accepts the following keys:</para>
351
352                         <variablelist class='network-directives'>
353                                 <varlistentry>
354                                         <term><varname>OneQueue=</varname></term>
355                                         <listitem><para>Takes a boolean argument. Configures whether
356                                         all packets are queued at the device (enabled), or a fixed number
357                                         of packets are queued at the device and the rest at the
358                                         <literal>qdisc</literal>. Defaults to <literal>no</literal>.</para>
359                                         </listitem>
360                                 </varlistentry>
361                                 <varlistentry>
362                                         <term><varname>MultiQueue=</varname></term>
363                                         <listitem><para>Takes a boolean argument. Configures whether to
364                                         use multiple file descriptors (queues) to parallelize packets
365                                         sending and receiving. Defaults to <literal>no</literal>.</para>
366                                         </listitem>
367                                 </varlistentry>
368                                 <varlistentry>
369                                         <term><varname>PacketInfo=</varname></term>
370                                         <listitem><para>Takes a boolean argument. Configures whether packets
371                                         should be prepened with four extra bytes (two flag bytes and two
372                                         protocol bytes). If disabled it indicates that the packets will be
373                                         pure IP packets. Defaults to <literal>no</literal>.</para>
374                                         </listitem>
375                                 </varlistentry>
376                                 <varlistentry>
377                                         <term><varname>User=</varname></term>
378                                         <listitem><para>User to grant access to the <filename>/dev/net/tun</filename>
379                                         device.</para>
380                                         </listitem>
381                                 </varlistentry>
382                                 <varlistentry>
383                                         <term><varname>Group=</varname></term>
384                                         <listitem><para>Group to grant access to the <filename>/dev/net/tun</filename>
385                                         device.</para>
386                                         </listitem>
387                                 </varlistentry>
388
389                         </variablelist>
390
391         </refsect1>
392
393         <refsect1>
394                 <title>[Tap] Section Options</title>
395
396                         <para>The <literal>[Tap]</literal> section only applies for netdevs of kind
397                         <literal>tap</literal>, and accepts the same keys as the
398                         <literal>[Tun]</literal> section.</para>
399         </refsect1>
400
401         <refsect1>
402                 <title>[Bond] Section Options</title>
403
404                         <para>The <literal>[Bond]</literal> section accepts the following
405                         key:</para>
406
407                         <variablelist class='network-directives'>
408                                 <varlistentry>
409                                         <term><varname>Mode=</varname></term>
410                                         <listitem>
411                                           <para>Specifies one of the bonding policies. The default is
412                                           <literal>balance-rr</literal> (round robin). Possible values are
413                                                 <literal>balance-rr</literal>,
414                                                 <literal>active-backup</literal>,
415                                                 <literal>balance-xor</literal>,
416                                                 <literal>broadcast</literal>,
417                                                 <literal>802.3ad</literal>,
418                                                 <literal>balance-tlb</literal>, and
419                                                 <literal>balance-alb</literal>.
420                                           </para>
421                                         </listitem>
422                                 </varlistentry>
423
424                                 <varlistentry>
425                                   <term><varname>TransmitHashPolicy=</varname></term>
426                                   <listitem>
427                                     <para>Selects the transmit hash policy to use for slave selection in
428                                     balance-xor, 802.3ad, and tlb modes. Possible values are
429                                     <literal>layer2</literal>,
430                                     <literal>layer3+4</literal>,
431                                     <literal>layer2+3</literal>,
432                                     <literal>encap2+3</literal>,
433                                     <literal>802.3ad</literal>, and
434                                     <literal>encap3+4</literal>.
435                                     </para>
436                                   </listitem>
437                                 </varlistentry>
438
439                                 <varlistentry>
440                                   <term><varname>LACPTransmitRate=</varname></term>
441                                   <listitem>
442                                     <para>Specifies the rate with which link partner
443                                     transmits Link Aggregation Control Protocol Data Unit packets
444                                     in 802.3ad mode. Possible values are
445                                     <literal>slow</literal>, which requests partner to transmit LACPDUs every 30 seconds, and
446                                     <literal>fast</literal>, which requests partner to transmit LACPDUs every second.
447                                     The default value is <literal>slow</literal>.</para>
448                                   </listitem>
449                                 </varlistentry>
450
451                                 <varlistentry>
452                                   <term><varname>MIIMonitorSec=</varname></term>
453                                   <listitem>
454                                     <para>Specifies the frequency that Media Independent Interface link
455                                     monitoring will occur. A value of zero disables MII link monitoring.
456                                     This values is rounded down to the nearest millisecond. The default
457                                     value is 0.</para>
458                                   </listitem>
459                                 </varlistentry>
460
461                                 <varlistentry>
462                                   <term><varname>UpDelaySec=</varname></term>
463                                   <listitem>
464                                     <para>Specifies the delay before a link is enabled after a link up
465                                     status has been detected. This value is rounded down to a multiple of
466                                     MIIMonitorSec. The default value is 0.</para>
467                                   </listitem>
468                                 </varlistentry>
469
470                                 <varlistentry>
471                                   <term><varname>DownDelaySec=</varname></term>
472                                   <listitem>
473                                     <para>Specifies the delay before a link is disabled after a link down
474                                     status has been detected. This value is rounded down to a multiple of
475                                     MIIMonitorSec. The default value is 0.</para>
476                                   </listitem>
477                                 </varlistentry>
478
479                         </variablelist>
480         </refsect1>
481
482         <refsect1>
483                 <title>Example</title>
484                 <example>
485                         <title>/etc/systemd/network/bridge.netdev</title>
486
487                         <programlisting>[NetDev]
488 Name=bridge0
489 Kind=bridge</programlisting>
490                 </example>
491
492                 <example>
493                         <title>/etc/systemd/network/vlan1.netdev</title>
494
495                         <programlisting>[Match]
496 Virtualization=no
497
498 [NetDev]
499 Name=vlan1
500 Kind=vlan
501
502 [VLAN]
503 Id=1</programlisting>
504                 </example>
505                 <example>
506                         <title>/etc/systemd/network/ipip.netdev</title>
507                         <programlisting>[NetDev]
508 Name=ipip-tun
509 Kind=ipip
510 MTUBytes=1480
511
512 [Tunnel]
513 Local=192.168.223.238
514 Remote=192.169.224.239
515 TTL=64</programlisting>
516                 </example>
517                 <example>
518                   <title>/etc/systemd/network/tap.netdev</title>
519                   <programlisting>[NetDev]
520 Name=tap-test
521 Kind=tap
522
523 [Tap]
524 MultiQueue=true
525 PacketInfo=true</programlisting> </example>
526
527                 <example>
528                         <title>/etc/systemd/network/sit.netdev</title>
529                         <programlisting>[NetDev]
530 Name=sit-tun
531 Kind=sit
532 MTUBytes=1480
533
534 [Tunnel]
535 Local=10.65.223.238
536 Remote=10.65.223.239</programlisting>
537                 </example>
538
539                 <example>
540                         <title>/etc/systemd/network/gre.netdev</title>
541                         <programlisting>[NetDev]
542 Name=gre-tun
543 Kind=gre
544 MTUBytes=1480
545
546 [Tunnel]
547 Local=10.65.223.238
548 Remote=10.65.223.239</programlisting>
549                 </example>
550
551                 <example>
552                         <title>/etc/systemd/network/vti.netdev</title>
553
554                         <programlisting>[NetDev]
555 Name=vti-tun
556 Kind=vti
557 MTUBytes=1480
558
559 [Tunnel]
560 Local=10.65.223.238
561 Remote=10.65.223.239</programlisting>
562                 </example>
563
564                 <example>
565                         <title>/etc/systemd/network/veth.netdev</title>
566                         <programlisting>[NetDev]
567 Name=veth-test
568 Kind=veth
569
570 [Peer]
571 Name=veth-peer</programlisting>
572                 </example>
573
574                 <example>
575                         <title>/etc/systemd/network/dummy.netdev</title>
576                         <programlisting>[NetDev]
577 Name=dummy-test
578 Kind=dummy
579 MACAddress=12:34:56:78:9a:bc</programlisting>
580                 </example>
581
582         </refsect1>
583         <refsect1>
584                 <title>See Also</title>
585                 <para>
586                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
587                         <citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
588                         <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>
589                 </para>
590         </refsect1>
591
592 </refentry>