chiark / gitweb /
man: netdev - mention tun and tap
[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.</para>
64
65                 <para>The <filename>.netdev</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>A virtual network device is only created if the
87                 <literal>[Match]</literal> section matches the current
88                 environment, or if the section is empty. The following keys are accepted:</para>
89
90                         <variablelist class='network-directives'>
91                                 <varlistentry>
92                                         <term><varname>Host=</varname></term>
93                                         <listitem>
94                                                 <para>Matches against the hostname or machine ID of the
95                                                 host. See <literal>ConditionHost=</literal> in
96                                                 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
97                                                 for details.
98                                                 </para>
99                                         </listitem>
100                                 </varlistentry>
101                                 <varlistentry>
102                                         <term><varname>Virtualization=</varname></term>
103                                         <listitem>
104                                                 <para>Checks whether the system is executed in a virtualized
105                                                 environment and optionally test whether it is a specific
106                                                 implementation. See <literal>ConditionVirtualization=</literal> in
107                                                 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
108                                                 for details.
109                                                 </para>
110                                         </listitem>
111                                 </varlistentry>
112                                 <varlistentry>
113                                         <term><varname>KernelCommandLine=</varname></term>
114                                         <listitem>
115                                                 <para>Checks whether a specific kernel command line option is
116                                                 set (or if prefixed with the exclamation mark unset). See
117                                                 <literal>ConditionKernelCommandLine=</literal> in
118                                                 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
119                                                 for details.
120                                                 </para>
121                                         </listitem>
122                                 </varlistentry>
123                                 <varlistentry>
124                                         <term><varname>Architecture=</varname></term>
125                                         <listitem>
126                                                 <para>Checks whether the system is running on a specific
127                                                 architecture. See <literal>ConditionArchitecture=</literal> in
128                                                 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
129                                                 for details.
130                                                 </para>
131                                         </listitem>
132                                 </varlistentry>
133                         </variablelist>
134
135         </refsect1>
136
137         <refsect1>
138                 <title>[NetDev] Section Options</title>
139
140                         <para>The <literal>[NetDev]</literal> section accepts the following
141                         keys:</para>
142
143                         <variablelist class='network-directives'>
144                                 <varlistentry>
145                                         <term><varname>Description=</varname></term>
146                                         <listitem>
147                                                 <para>A free-form description of the netdev.
148                                                 </para>
149                                         </listitem>
150                                 </varlistentry>
151                                 <varlistentry>
152                                         <term><varname>Name=</varname></term>
153                                         <listitem>
154                                                 <para>The interface name used when creating the
155                                                 netdev. This option is compulsory.</para>
156                                         </listitem>
157                                 </varlistentry>
158                                 <varlistentry>
159                                         <term><varname>Kind=</varname></term>
160                                         <listitem>
161                                                 <para>The netdev kind. Currently, <literal>bridge</literal>,
162                                                 <literal>bond</literal>, <literal>vlan</literal>,
163                                                 <literal>macvlan</literal>, <literal>vxlan</literal>,
164                                                 <literal>ipip</literal>, <literal>gre</literal>,
165                                                 <literal>sit</literal>, <literal>vti</literal>,
166                                                 <literal>veth</literal>, <literal>tun</literal>,
167                                                 <literal>tap</literal> and <literal>dummy</literal>
168                                                 are supported. This option is compulsory.</para>
169                                         </listitem>
170                                 </varlistentry>
171                                 <varlistentry>
172                                         <term><varname>MTUBytes=</varname></term>
173                                         <listitem>
174                                                 <para>The maximum transmission unit in bytes to
175                                                 set for the device. The usual suffixes K, M, G,
176                                                 are supported and are understood to the base of
177                                                 1024.</para>
178                                         </listitem>
179                                 </varlistentry>
180                                 <varlistentry>
181                                         <term><varname>MACAddress=</varname></term>
182                                         <listitem>
183                                                 <para>The MAC address to use for the device.
184                                                 If none is given, one is generated based on
185                                                 the interface name and the
186                                                 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
187                                                 </para>
188                                         </listitem>
189                                 </varlistentry>
190                         </variablelist>
191         </refsect1>
192
193         <refsect1>
194                 <title>[VLAN] Section Options</title>
195
196                         <para>The <literal>[VLAN]</literal> section only applies for netdevs of kind <literal>vlan</literal>,
197                         and accepts the following key:</para>
198
199                         <variablelist class='network-directives'>
200                                 <varlistentry>
201                                         <term><varname>Id=</varname></term>
202                                         <listitem>
203                                                 <para>The VLAN ID to use. An integer in the range 0–4094.
204                                                 This option is compulsory.</para>
205                                         </listitem>
206                                 </varlistentry>
207                         </variablelist>
208
209         </refsect1>
210
211         <refsect1>
212                 <title>[MACVLAN] Section Options</title>
213
214                         <para>The <literal>[MACVLAN]</literal> section only applies for netdevs of kind
215                         <literal>macvlan</literal>, and accepts the following key:</para>
216
217                         <variablelist class='network-directives'>
218                                 <varlistentry>
219                                         <term><varname>Mode=</varname></term>
220                                         <listitem>
221                                                 <para>The MACVLAN mode to use. The supported options are
222                                                 <literal>private</literal>, <literal>vepa</literal>,
223                                                 <literal>bridge</literal> and <literal>passthru</literal>.
224                                                 </para>
225                                         </listitem>
226                                 </varlistentry>
227                         </variablelist>
228
229         </refsect1>
230         <refsect1>
231                 <title>[VXLAN] Section Options</title>
232                         <para>The <literal>[VXLAN]</literal> section only applies for netdevs of kind
233                         <literal>vxlan</literal>, and accepts the following key:</para>
234
235                         <variablelist class='network-directives'>
236                                 <varlistentry>
237                                         <term><varname>Id=</varname></term>
238                                         <listitem>
239                                                 <para>The VXLAN ID to use.</para>
240                                         </listitem>
241                                 </varlistentry>
242                                 <varlistentry>
243                                         <term><varname>Group=</varname></term>
244                                         <listitem>
245                                                 <para>An assigned multicast group IP address.</para>
246                                         </listitem>
247                                 </varlistentry>
248                                 <varlistentry>
249                                         <term><varname>TOS=</varname></term>
250                                         <listitem>
251                                                 <para>The Type Of Service byte value for a vxlan interface.</para>
252                                         </listitem>
253                                 </varlistentry>
254                                 <varlistentry>
255                                         <term><varname>TTL=</varname></term>
256                                         <listitem>
257                                                 <para>A fixed Time To Live N on Virtual eXtensible Local Area Network packets.
258                                                 N is a number in the range 1-255. 0 is a special value meaning that packets
259                                                 inherit the TTL value.</para>
260                                         </listitem>
261                                 </varlistentry>
262                                 <varlistentry>
263                                         <term><varname>MacLearning=</varname></term>
264                                         <listitem>
265                                                 <para>A boolean. When true, enables dynamic MAC learning
266                                                 to discover remote MAC addresses.</para>
267                                         </listitem>
268                                 </varlistentry>
269                         </variablelist>
270         </refsect1>
271         <refsect1>
272                 <title>[Tunnel] Section Options</title>
273
274                         <para>The <literal>[Tunnel]</literal> section only applies for netdevs of kind
275                         <literal>ipip</literal>, <literal>sit</literal>, <literal>gre</literal> and
276                         <literal>vti</literal> and accepts the following keys:</para>
277
278                         <variablelist class='network-directives'>
279                                 <varlistentry>
280                                         <term><varname>Local=</varname></term>
281                                         <listitem>
282                                                 <para>A static local address for tunneled packets.
283                                                 It must be an address on another interface of this host.</para>
284                                         </listitem>
285                                 </varlistentry>
286                                 <varlistentry>
287                                         <term><varname>Remote=</varname></term>
288                                         <listitem>
289                                                 <para>The remote endpoint of the tunnel.</para>
290                                         </listitem>
291                                 </varlistentry>
292                                 <varlistentry>
293                                         <term><varname>TOS=</varname></term>
294                                         <listitem>
295                                                 <para>The Type Of Service byte value for a tunnel interface.
296                                                 For details about the TOS see the
297                                                 <ulink url="http://tools.ietf.org/html/rfc1349">
298                                                 Type of Service in the Internet Protocol Suite
299                                                 </ulink> document.
300                                                 </para>
301                                         </listitem>
302                                 </varlistentry>
303                                 <varlistentry>
304                                         <term><varname>TTL=</varname></term>
305                                         <listitem>
306                                                 <para>A fixed Time To Live N on tunneled packets.
307                                                 N is a number in the range 1-255. 0 is a special value meaning that packets
308                                                 inherit the TTL value. The default value for IPv4 tunnels is: inherit.
309                                                 The default value for IPv6 tunnels is: 64.</para>
310                                         </listitem>
311                                 </varlistentry>
312                                 <varlistentry>
313                                         <term><varname>DiscoverPathMTU=</varname></term>
314                                         <listitem>
315                                                 <para>A boolean. When true, enables Path MTU Discovery on the tunnel.</para>
316                                         </listitem>
317                                 </varlistentry>
318                         </variablelist>
319         </refsect1>
320         <refsect1>
321                 <title>[Peer] Section Options</title>
322
323                         <para>The <literal>[Peer]</literal> section only applies for netdevs of kind <literal>veth</literal>
324                         and accepts the following key:</para>
325
326                         <variablelist class='network-directives'>
327                                 <varlistentry>
328                                         <term><varname>Name=</varname></term>
329                                         <listitem>
330                                                 <para>The interface name used when creating the netdev.
331                                                 This option is compulsory.</para>
332                                         </listitem>
333                                 </varlistentry>
334                                 <varlistentry>
335                                         <term><varname>MACAddress=</varname></term>
336                                         <listitem>
337                                                 <para>The peer MACAddress, if not set it is generated in the same
338                                                 way as the MAC address of the main interface.</para>
339                                         </listitem>
340                                 </varlistentry>
341                         </variablelist>
342         </refsect1>
343         <refsect1>
344                 <title>[Tun] Section Options</title>
345
346                         <para>The <literal>[Tun]</literal> section only applies for netdevs of kind
347                         <literal>tun</literal>, and accepts the following keys:</para>
348
349                         <variablelist class='network-directives'>
350                                 <varlistentry>
351                                         <term><varname>OneQueue=</varname></term>
352                                         <listitem><para>Takes a boolean argument. Configures whether
353                                         all packets are queued at the device (enabled), or a fixed number
354                                         of packets are queued at the device and the rest at the
355                                         <literal>qdisc</literal>. Defaults to <literal>no</literal>.</para>
356                                         </listitem>
357                                 </varlistentry>
358                                 <varlistentry>
359                                         <term><varname>MultiQueue=</varname></term>
360                                         <listitem><para>Takes a boolean argument. Configures whether to
361                                         use multiple file descriptors (queues) to parallelize packets
362                                         sending and receiving. Defaults to <literal>no</literal>.</para>
363                                         </listitem>
364                                 </varlistentry>
365                                 <varlistentry>
366                                         <term><varname>PacketInfo=</varname></term>
367                                         <listitem><para>Takes a boolean argument. Configures whether packets
368                                         should be prepened with four extra bytes (two flag bytes and two
369                                         protocol bytes). If disabled it indicates that the packets will be
370                                         pure IP packets. Defaults to <literal>no</literal>.</para>
371                                         </listitem>
372                                 </varlistentry>
373                                 <varlistentry>
374                                         <term><varname>User=</varname></term>
375                                         <listitem><para>User to grant access to the <filename>/dev/net/tun</filename>
376                                         device.</para>
377                                         </listitem>
378                                 </varlistentry>
379                                 <varlistentry>
380                                         <term><varname>Group=</varname></term>
381                                         <listitem><para>Group to grant access to the <filename>/dev/net/tun</filename>
382                                         device.</para>
383                                         </listitem>
384                                 </varlistentry>
385
386                         </variablelist>
387
388         </refsect1>
389
390         <refsect1>
391                 <title>[Tap] Section Options</title>
392
393                         <para>The <literal>[Tap]</literal> section only applies for netdevs of kind
394                         <literal>tap</literal>, and accepts the same keys as the
395                         <literal>[Tun]</literal> section.</para>
396         </refsect1>
397
398         <refsect1>
399                 <title>Example</title>
400                 <example>
401                         <title>/etc/systemd/network/bridge.netdev</title>
402
403                         <programlisting>[NetDev]
404 Name=bridge0
405 Kind=bridge</programlisting>
406                 </example>
407
408                 <example>
409                         <title>/etc/systemd/network/vlan1.netdev</title>
410
411                         <programlisting>[Match]
412 Virtualization=no
413
414 [NetDev]
415 Name=vlan1
416 Kind=vlan
417
418 [VLAN]
419 Id=1</programlisting>
420                 </example>
421                 <example>
422                         <title>/etc/systemd/network/ipip.netdev</title>
423                         <programlisting>[NetDev]
424 Name=ipip-tun
425 Kind=ipip
426 MTUBytes=1480
427
428 [Tunnel]
429 Local=192.168.223.238
430 Remote=192.169.224.239
431 TTL=64</programlisting>
432                 </example>
433                 <example>
434                   <title>/etc/systemd/network/tap.netdev</title>
435                   <programlisting>[NetDev]
436 Name=tap-test
437 Kind=tap
438
439 [Tap]
440 MultiQueue=true
441 PacketInfo=true</programlisting> </example>
442
443                 <example>
444                         <title>/etc/systemd/network/sit.netdev</title>
445                         <programlisting>[NetDev]
446 Name=sit-tun
447 Kind=sit
448 MTUBytes=1480
449
450 [Tunnel]
451 Local=10.65.223.238
452 Remote=10.65.223.239</programlisting>
453                 </example>
454
455                 <example>
456                         <title>/etc/systemd/network/gre.netdev</title>
457                         <programlisting>[NetDev]
458 Name=gre-tun
459 Kind=gre
460 MTUBytes=1480
461
462 [Tunnel]
463 Local=10.65.223.238
464 Remote=10.65.223.239</programlisting>
465                 </example>
466
467                 <example>
468                         <title>/etc/systemd/network/vti.netdev</title>
469
470                         <programlisting>[NetDev]
471 Name=vti-tun
472 Kind=vti
473 MTUBytes=1480
474
475 [Tunnel]
476 Local=10.65.223.238
477 Remote=10.65.223.239</programlisting>
478                 </example>
479
480                 <example>
481                         <title>/etc/systemd/network/veth.netdev</title>
482                         <programlisting>[NetDev]
483 Name=veth-test
484 Kind=veth
485
486 [Peer]
487 Name=veth-peer</programlisting>
488                 </example>
489
490                 <example>
491                         <title>/etc/systemd/network/dummy.netdev</title>
492                         <programlisting>[NetDev]
493 Name=dummy-test
494 Kind=dummy
495 MACAddress=12:34:56:78:9a:bc</programlisting>
496                 </example>
497
498         </refsect1>
499         <refsect1>
500                 <title>See Also</title>
501                 <para>
502                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
503                         <citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
504                         <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>
505                 </para>
506         </refsect1>
507
508 </refentry>