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">
6 This file is part of systemd.
8 Copyright 2013 Tom Gundersen
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.
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.
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/>.
24 <refentry id="systemd.netdev" conditional='ENABLE_NETWORKD'>
27 <title>systemd.network</title>
28 <productname>systemd</productname>
32 <contrib>Developer</contrib>
33 <firstname>Tom</firstname>
34 <surname>Gundersen</surname>
35 <email>teg@jklm.no</email>
41 <refentrytitle>systemd.netdev</refentrytitle>
42 <manvolnum>5</manvolnum>
46 <refname>systemd.netdev</refname>
47 <refpurpose>Virtual Network Device configuration</refpurpose>
51 <para><filename><replaceable>netdev</replaceable>.netdev</filename></para>
55 <title>Description</title>
57 <para>Network setup is performed by
58 <citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
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>
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>
84 <title>[Match] Section Options</title>
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>
90 <variablelist class='network-directives'>
92 <term><varname>Host=</varname></term>
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>
102 <term><varname>Virtualization=</varname></term>
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>
113 <term><varname>KernelCommandLine=</varname></term>
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>
124 <term><varname>Architecture=</varname></term>
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>
138 <title>[NetDev] Section Options</title>
140 <para>The <literal>[NetDev]</literal> section accepts the following
143 <variablelist class='network-directives'>
145 <term><varname>Description=</varname></term>
147 <para>A free-form description of the netdev.
152 <term><varname>Name=</varname></term>
154 <para>The interface name used when creating the
155 netdev. This option is compulsory.</para>
159 <term><varname>Kind=</varname></term>
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>
171 <term><varname>MTUBytes=</varname></term>
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
180 <term><varname>MACAddress=</varname></term>
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>.
193 <title>[VLAN] Section Options</title>
195 <para>The <literal>[VLAN]</literal> section only applies for netdevs of kind <literal>vlan</literal>,
196 and accepts the following key:</para>
198 <variablelist class='network-directives'>
200 <term><varname>Id=</varname></term>
202 <para>The VLAN ID to use. An integer in the range 0–4094.
203 This option is compulsory.</para>
211 <title>[MACVLAN] Section Options</title>
213 <para>The <literal>[MACVLAN]</literal> section only applies for netdevs of kind
214 <literal>macvlan</literal>, and accepts the following key:</para>
216 <variablelist class='network-directives'>
218 <term><varname>Mode=</varname></term>
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>.
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>
234 <variablelist class='network-directives'>
236 <term><varname>Id=</varname></term>
238 <para>The VXLAN ID to use.</para>
242 <term><varname>Group=</varname></term>
244 <para>An assigned multicast group IP address.</para>
248 <term><varname>TOS=</varname></term>
250 <para>The Type Of Service byte value for a vxlan interface.</para>
254 <term><varname>TTL=</varname></term>
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>
262 <term><varname>MacLearning=</varname></term>
264 <para>A boolean. When true, enables dynamic MAC learning
265 to discover remote MAC addresses.</para>
271 <title>[Tunnel] Section Options</title>
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>
277 <variablelist class='network-directives'>
279 <term><varname>Local=</varname></term>
281 <para>A static local address for tunneled packets.
282 It must be an address on another interface of this host.</para>
286 <term><varname>Remote=</varname></term>
288 <para>The remote endpoint of the tunnel.</para>
292 <term><varname>TOS=</varname></term>
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
303 <term><varname>TTL=</varname></term>
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>
312 <term><varname>DiscoverPathMTU=</varname></term>
314 <para>A boolean. When true, enables Path MTU Discovery on the tunnel.</para>
320 <title>[Peer] Section Options</title>
322 <para>The <literal>[Peer]</literal> section only applies for netdevs of kind <literal>veth</literal>
323 and accepts the following key:</para>
325 <variablelist class='network-directives'>
327 <term><varname>Name=</varname></term>
329 <para>The interface name used when creating the netdev.
330 This option is compulsory.</para>
334 <term><varname>MACAddress=</varname></term>
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>
343 <title>[Tun] Section Options</title>
345 <para>The <literal>[Tun]</literal> section only applies for netdevs of kind
346 <literal>tun</literal>, and accepts the following keys:</para>
348 <variablelist class='network-directives'>
350 <term><varname>OneQueue=</varname></term>
351 <listitem><para>Takes a boolean argument. Configures whether
352 all packets are queued at the device (enabled), or a fixed number
353 of packets are queued at the device and the rest at the
354 <literal>qdisc</literal>. Defaults to <literal>no</literal>.</para>
358 <term><varname>MultiQueue=</varname></term>
359 <listitem><para>Takes a boolean argument. Configures whether to
360 use multiple file descriptors (queues) to parallelize packets
361 sending and receiving. Defaults to <literal>no</literal>.</para>
365 <term><varname>PacketInfo=</varname></term>
366 <listitem><para>Takes a boolean argument. Configures whether packets
367 should be prepened with four extra bytes (two flag bytes and two
368 protocol bytes). If disabled it indicates that the packets will be
369 pure IP packets. Defaults to <literal>no</literal>.</para>
373 <term><varname>User=</varname></term>
374 <listitem><para>User to grant access to the <filename>/dev/net/tun</filename>
379 <term><varname>Group=</varname></term>
380 <listitem><para>Group to grant access to the <filename>/dev/net/tun</filename>
390 <title>[Tap] Section Options</title>
392 <para>The <literal>[Tap]</literal> section only applies for netdevs of kind
393 <literal>tap</literal>, and accepts the same keys as the
394 <literal>[Tun]</literal> section.</para>
398 <title>Example</title>
400 <title>/etc/systemd/network/bridge.netdev</title>
402 <programlisting>[NetDev]
404 Kind=bridge</programlisting>
408 <title>/etc/systemd/network/vlan1.netdev</title>
410 <programlisting>[Match]
418 Id=1</programlisting>
421 <title>/etc/systemd/network/ipip.netdev</title>
422 <programlisting>[NetDev]
428 Local=192.168.223.238
429 Remote=192.169.224.239
430 TTL=64</programlisting>
433 <title>/etc/systemd/network/tap.netdev</title>
434 <programlisting>[NetDev]
440 PacketInfo=true</programlisting> </example>
443 <title>/etc/systemd/network/sit.netdev</title>
444 <programlisting>[NetDev]
451 Remote=10.65.223.239</programlisting>
455 <title>/etc/systemd/network/gre.netdev</title>
456 <programlisting>[NetDev]
463 Remote=10.65.223.239</programlisting>
467 <title>/etc/systemd/network/vti.netdev</title>
469 <programlisting>[NetDev]
476 Remote=10.65.223.239</programlisting>
480 <title>/etc/systemd/network/veth.netdev</title>
481 <programlisting>[NetDev]
486 Name=veth-peer</programlisting>
490 <title>/etc/systemd/network/dummy.netdev</title>
491 <programlisting>[NetDev]
494 MACAddress=12:34:56:78:9a:bc</programlisting>
499 <title>See Also</title>
501 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
502 <citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
503 <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>