chiark / gitweb /
a57ba7ad8cf1ecf9cd00d5e2da21d93c100efd7b
[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>, and <literal>dummy</literal>
167                                                 are supported. This option is compulsory.</para>
168                                         </listitem>
169                                 </varlistentry>
170                                 <varlistentry>
171                                         <term><varname>MTUBytes=</varname></term>
172                                         <listitem>
173                                                 <para>The maximum transmission unit in bytes to
174                                                 set for the device. The usual suffixes K, M, G,
175                                                 are supported and are understood to the base of
176                                                 1024.</para>
177                                         </listitem>
178                                 </varlistentry>
179                                 <varlistentry>
180                                         <term><varname>MACAddress=</varname></term>
181                                         <listitem>
182                                                 <para>The MAC address to use for the device.
183                                                 If none is given, one is generated based on
184                                                 the interface name and the
185                                                 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
186                                                 </para>
187                                         </listitem>
188                                 </varlistentry>
189                         </variablelist>
190         </refsect1>
191
192         <refsect1>
193                 <title>[VLAN] Section Options</title>
194
195                         <para>The <literal>[VLAN]</literal> section only applies for netdevs of kind <literal>vlan</literal>,
196                         and accepts the following key:</para>
197
198                         <variablelist class='network-directives'>
199                                 <varlistentry>
200                                         <term><varname>Id=</varname></term>
201                                         <listitem>
202                                                 <para>The VLAN ID to use. An integer in the range 0–4094.
203                                                 This option is compulsory.</para>
204                                         </listitem>
205                                 </varlistentry>
206                         </variablelist>
207
208         </refsect1>
209
210         <refsect1>
211                 <title>[MACVLAN] Section Options</title>
212
213                         <para>The <literal>[MACVLAN]</literal> section only applies for netdevs of kind
214                         <literal>macvlan</literal>, and accepts the following key:</para>
215
216                         <variablelist class='network-directives'>
217                                 <varlistentry>
218                                         <term><varname>Mode=</varname></term>
219                                         <listitem>
220                                                 <para>The MACVLAN mode to use. The supported options are
221                                                 <literal>private</literal>, <literal>vepa</literal>,
222                                                 <literal>bridge</literal> and <literal>passthru</literal>.
223                                                 </para>
224                                         </listitem>
225                                 </varlistentry>
226                         </variablelist>
227
228         </refsect1>
229         <refsect1>
230                 <title>[VXLAN] Section Options</title>
231                         <para>The <literal>[VXLAN]</literal> section only applies for netdevs of kind
232                         <literal>vxlan</literal>, and accepts the following key:</para>
233
234                         <variablelist class='network-directives'>
235                                 <varlistentry>
236                                         <term><varname>Id=</varname></term>
237                                         <listitem>
238                                                 <para>The VXLAN ID to use.</para>
239                                         </listitem>
240                                 </varlistentry>
241                                 <varlistentry>
242                                         <term><varname>Group=</varname></term>
243                                         <listitem>
244                                                 <para>An assigned multicast group IP address.</para>
245                                         </listitem>
246                                 </varlistentry>
247                                 <varlistentry>
248                                         <term><varname>TOS=</varname></term>
249                                         <listitem>
250                                                 <para>The Type Of Service byte value for a vxlan interface.</para>
251                                         </listitem>
252                                 </varlistentry>
253                                 <varlistentry>
254                                         <term><varname>TTL=</varname></term>
255                                         <listitem>
256                                                 <para>A fixed Time To Live N on Virtual eXtensible Local Area Network packets.
257                                                 N is a number in the range 1-255. 0 is a special value meaning that packets
258                                                 inherit the TTL value.</para>
259                                         </listitem>
260                                 </varlistentry>
261                                 <varlistentry>
262                                         <term><varname>MacLearning=</varname></term>
263                                         <listitem>
264                                                 <para>A boolean. When true, enables dynamic MAC learning
265                                                 to discover remote MAC addresses.</para>
266                                         </listitem>
267                                 </varlistentry>
268                         </variablelist>
269         </refsect1>
270         <refsect1>
271                 <title>[Tunnel] Section Options</title>
272
273                         <para>The <literal>[Tunnel]</literal> section only applies for netdevs of kind
274                         <literal>ipip</literal>, <literal>sit</literal>, <literal>gre</literal> and
275                         <literal>vti</literal> and accepts the following keys:</para>
276
277                         <variablelist class='network-directives'>
278                                 <varlistentry>
279                                         <term><varname>Local=</varname></term>
280                                         <listitem>
281                                                 <para>A static local address for tunneled packets.
282                                                 It must be an address on another interface of this host.</para>
283                                         </listitem>
284                                 </varlistentry>
285                                 <varlistentry>
286                                         <term><varname>Remote=</varname></term>
287                                         <listitem>
288                                                 <para>The remote endpoint of the tunnel.</para>
289                                         </listitem>
290                                 </varlistentry>
291                                 <varlistentry>
292                                         <term><varname>TOS=</varname></term>
293                                         <listitem>
294                                                 <para>The Type Of Service byte value for a tunnel interface.
295                                                 For details about the TOS see the
296                                                 <ulink url="http://tools.ietf.org/html/rfc1349">
297                                                 Type of Service in the Internet Protocol Suite
298                                                 </ulink> document.
299                                                 </para>
300                                         </listitem>
301                                 </varlistentry>
302                                 <varlistentry>
303                                         <term><varname>TTL=</varname></term>
304                                         <listitem>
305                                                 <para>A fixed Time To Live N on tunneled packets.
306                                                 N is a number in the range 1-255. 0 is a special value meaning that packets
307                                                 inherit the TTL value. The default value for IPv4 tunnels is: inherit.
308                                                 The default value for IPv6 tunnels is: 64.</para>
309                                         </listitem>
310                                 </varlistentry>
311                                 <varlistentry>
312                                         <term><varname>DiscoverPathMTU=</varname></term>
313                                         <listitem>
314                                                 <para>A boolean. When true, enables Path MTU Discovery on the tunnel.</para>
315                                         </listitem>
316                                 </varlistentry>
317                         </variablelist>
318         </refsect1>
319         <refsect1>
320                 <title>[Peer] Section Options</title>
321
322                         <para>The <literal>[Peer]</literal> section only applies for netdevs of kind <literal>veth</literal>
323                         and accepts the following key:</para>
324
325                         <variablelist class='network-directives'>
326                                 <varlistentry>
327                                         <term><varname>Name=</varname></term>
328                                         <listitem>
329                                                 <para>The interface name used when creating the netdev.
330                                                 This option is compulsory.</para>
331                                         </listitem>
332                                 </varlistentry>
333                                 <varlistentry>
334                                         <term><varname>MACAddress=</varname></term>
335                                         <listitem>
336                                                 <para>The peer MACAddress, if not set it is generated in the same
337                                                 way as the MAC address of the main interface.</para>
338                                         </listitem>
339                                 </varlistentry>
340                         </variablelist>
341         </refsect1>
342         <refsect1>
343                 <title>[TUN] Section Options</title>
344
345                         <para>The <literal>[TUN]</literal> section only applies for netdevs of kind
346                         <literal>tun</literal>, and accepts the following keys:</para>
347
348                         <variablelist class='network-directives'>
349                                 <varlistentry>
350                                         <term><varname>OneQueue=</varname></term>
351                                         <listitem><para>Takes a boolean argument. Configures whether
352                                         to enable disable one queue . it determines whether all packets
353                                         queue at the device (enabled), or a fixed number queue at the device and
354                                         the rest at the "qdisc". Defaults to <literal>no</literal>.</para>
355                                         </listitem>
356                                 </varlistentry>
357                                 <varlistentry>
358                                         <term><varname>MultiQueue=</varname></term>
359                                         <listitem><para>Takes a boolean argument. Configures whether the
360                                         to disable or disable . Linux supports multiqueue tuntap which can
361                                         uses multiple file descriptors (queues) to parallelize
362                                         packets sending or receiving. The device allocation is the same as before,
363                                         and if user wants to create multiple queues. Defaults to
364                                         <literal>no</literal>.</para>
365                                         </listitem>
366                                 </varlistentry>
367                                 <varlistentry>
368                                         <term><varname>PacketInfo=</varname></term>
369                                         <listitem><para>Takes a boolean argument. Configures whether the
370                                         to enable or disable . PacketInfo tells the kernel to not provide packet
371                                         information. The purpose of PacketInfo is to tell the kernel that packets
372                                         will be "pure" IP packets, with no added bytes. Otherwise (if PacketInfo is unset),
373                                         4 extra bytes are added to the beginning of the packet (2 flag bytes and 2 protocol bytes).
374                                         Defaults to <literal>no</literal>.</para>
375                                         </listitem>
376                                 </varlistentry>
377                                 <varlistentry>
378                                         <term><varname>User=</varname></term>
379                                         <listitem><para>User to be allowed to access this device. Give ownership to unprivileged users,
380                                         so that /dev/net/tun device to be usable by this user.
381                                       </para>
382                                         </listitem>
383                                 </varlistentry>
384                                 <varlistentry>
385                                         <term><varname>Group=</varname></term>
386                                         <listitem><para>Group to be allowed to access this device. Give ownership to unprivileged group,
387                                         so that /dev/net/tun device to be usable by this group.</para>
388                                         </listitem>
389                                 </varlistentry>
390
391                         </variablelist>
392
393         </refsect1>
394
395         <refsect1>
396                 <title>[TAP] Section Options</title>
397
398                         <para>The <literal>[TAP]</literal> section only applies for netdevs of kind
399                         <literal>tap</literal>, and accepts the following keys:</para>
400         </refsect1>
401
402                         <variablelist class='network-directives'>
403                                 <varlistentry>
404                                         <term><varname>OneQueue=</varname></term>
405                                         <listitem><para>Takes a boolean argument. Configures whether
406                                         to enable disable one queue . it determines whether all packets
407                                         queue at the device (enabled), or a fixed number queue at the device and
408                                         the rest at the "qdisc". Defaults to <literal>no</literal>.</para>
409                                         </listitem>
410                                 </varlistentry>
411                                 <varlistentry>
412                                         <term><varname>MultiQueue=</varname></term>
413                                         <listitem><para>Takes a boolean argument. Configures whether the
414                                         to disable or disable . From version 3.8, Linux supports multiqueue
415                                         tuntap which can uses multiple file descriptors (queues) to parallelize
416                                         packets sending or receiving. The device allocation is the same as before,
417                                         and if user wants to create multiple queues. Defaults to
418                                         <literal>no</literal>.</para>
419                                         </listitem>
420                                 </varlistentry>
421                                 <varlistentry>
422                                         <term><varname>PacketInfo=</varname></term>
423                                         <listitem><para>Takes a boolean argument. Configures whether the
424                                         to enable or disable . PacketInfo tells the kernel to not provide packet
425                                         information. The purpose of PacketInfo is to tell the kernel that packets
426                                         will be "pure" IP packets, with no added bytes. Otherwise (if PacketInfo is unset),
427                                         4 extra bytes are added to the beginning of the packet (2 flag bytes and 2 protocol bytes).
428                                         Defaults to <literal>no</literal>.</para>
429                                         </listitem>
430                                 </varlistentry>
431                                 <varlistentry>
432                                         <term><varname>User=</varname></term>
433                                         <listitem><para>User to be allowed to access this device. Give ownership to unprivileged users,
434                                         so that /dev/net/tun device to be usable by this user.
435                                       </para>
436                                         </listitem>
437                                 </varlistentry>
438                                 <varlistentry>
439                                         <term><varname>Group=</varname></term>
440                                         <listitem><para>Group to be allowed to access this device. Give ownership to unprivileged group,
441                                         so that /dev/net/tun device to be usable by this group.</para>
442                                         </listitem>
443                                 </varlistentry>
444
445                         </variablelist>
446
447
448         <refsect1>
449                 <title>Example</title>
450                 <example>
451                         <title>/etc/systemd/network/bridge.netdev</title>
452
453                         <programlisting>[NetDev]
454 Name=bridge0
455 Kind=bridge</programlisting>
456                 </example>
457
458                 <example>
459                         <title>/etc/systemd/network/vlan1.netdev</title>
460
461                         <programlisting>[Match]
462 Virtualization=no
463
464 [NetDev]
465 Name=vlan1
466 Kind=vlan
467
468 [VLAN]
469 Id=1</programlisting>
470                 </example>
471                 <example>
472                         <title>/etc/systemd/network/ipip.netdev</title>
473                         <programlisting>[NetDev]
474 Name=ipip-tun
475 Kind=ipip
476 MTUBytes=1480
477
478 [Tunnel]
479 Local=192.168.223.238
480 Remote=192.169.224.239
481 TTL=64</programlisting>
482                 </example>
483                 <example>
484                   <title>/etc/systemd/network/tap.netdev</title>
485                   <programlisting>[NetDev]
486 Name=tap-test
487 Kind=tap
488
489 [Tap]
490 MultiQueue=true
491 PacketInfo=true</programlisting> </example>
492
493                 <example>
494                         <title>/etc/systemd/network/sit.netdev</title>
495                         <programlisting>[NetDev]
496 Name=sit-tun
497 Kind=sit
498 MTUBytes=1480
499
500 [Tunnel]
501 Local=10.65.223.238
502 Remote=10.65.223.239</programlisting>
503                 </example>
504
505                 <example>
506                         <title>/etc/systemd/network/gre.netdev</title>
507                         <programlisting>[NetDev]
508 Name=gre-tun
509 Kind=gre
510 MTUBytes=1480
511
512 [Tunnel]
513 Local=10.65.223.238
514 Remote=10.65.223.239</programlisting>
515                 </example>
516
517                 <example>
518                         <title>/etc/systemd/network/vti.netdev</title>
519
520                         <programlisting>[NetDev]
521 Name=vti-tun
522 Kind=vti
523 MTUBytes=1480
524
525 [Tunnel]
526 Local=10.65.223.238
527 Remote=10.65.223.239</programlisting>
528                 </example>
529
530                 <example>
531                         <title>/etc/systemd/network/veth.netdev</title>
532                         <programlisting>[NetDev]
533 Name=veth-test
534 Kind=veth
535
536 [Peer]
537 Name=veth-peer</programlisting>
538                 </example>
539
540                 <example>
541                         <title>/etc/systemd/network/dummy.netdev</title>
542                         <programlisting>[NetDev]
543 Name=dummy-test
544 Kind=dummy
545 MACAddress=12:34:56:78:9a:bc</programlisting>
546                 </example>
547
548         </refsect1>
549         <refsect1>
550                 <title>See Also</title>
551                 <para>
552                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
553                         <citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
554                         <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>
555                 </para>
556         </refsect1>
557
558 </refentry>