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. 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>
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>
87 <title>Supported netdev kinds</title>
89 <para>The following kinds of virtual network devices may be configured in <filename>.netdev</filename> files:</para>
92 <title>Supported kinds of virtual network devices</title>
95 <colspec colname='kind' />
96 <colspec colname='explanation' />
99 <entry>Description</entry>
102 <row><entry><varname>bond</varname></entry>
103 <entry>A bond device is an aggregation of all its slave devices. See <ulink url="https://www.kernel.org/doc/Documentation/networking/bonding.txt">Linux Ethernet Bonding Driver HOWTO</ulink> for details.Local configuration</entry></row>
105 <row><entry><varname>bridge</varname></entry>
106 <entry>A bridge devcie is a software switch, each of its slave devices and the bridge itself are ports of the switch.</entry></row>
108 <row><entry><varname>dummy</varname></entry>
109 <entry>A dummy device drops all packets sent to it.</entry></row>
111 <row><entry><varname>gre</varname></entry>
112 <entry>A Level 3 GRE tunnel over IPv4. See <ulink url="https://tools.ietf.org/html/rfc2784">RFC 2784</ulink> for details.</entry></row>
114 <row><entry><varname>gretap</varname></entry>
115 <entry>A Level 2 GRE tunnel over IPv4.</entry></row>
117 <row><entry><varname>ip6gre</varname></entry>
118 <entry>A Level 3 GRE tunnel over IPv6.</entry></row>
120 <row><entry><varname>ip6tnl</varname></entry>
121 <entry>An IPv4 or IPv6 tunnel over IPv6</entry></row>
123 <row><entry><varname>ip6gretap</varname></entry>
124 <entry>An Level 2 GRE tunnel over IPv6.</entry></row>
126 <row><entry><varname>ipip</varname></entry>
127 <entry>An IPv4 over IPv4 tunnel.</entry></row>
129 <row><entry><varname>ipvlan</varname></entry>
130 <entry>An ipvlan device is a stacked device which receives packets from its underlying device based on IP address filtering.</entry></row>
132 <row><entry><varname>macvlan</varname></entry>
133 <entry>A macvlan device is a stacked device which receives packets from its underlying device based on MAC address filtering.</entry></row>
135 <row><entry><varname>sit</varname></entry>
136 <entry>An IPv6 over IPv4 tunnel.</entry></row>
138 <row><entry><varname>tap</varname></entry>
139 <entry>A persistent Level 2 tunnel between a network device and a device node.</entry></row>
141 <row><entry><varname>tun</varname></entry>
142 <entry>A persistent Level 3 tunnel between a network device and a device node.</entry></row>
144 <row><entry><varname>veth</varname></entry>
145 <entry>An ethernet tunnel between a pair of network devices.</entry></row>
147 <row><entry><varname>vlan</varname></entry>
148 <entry>A VLAN is a stacked device which receives packets from its underlying device based on VLAN tagging. See <ulink url="http://www.ieee802.org/1/pages/802.1Q.html">IEEE 802.1Q</ulink> for details.</entry></row>
150 <row><entry><varname>vti</varname></entry>
151 <entry>An IPv4 over IPSec tunnel.</entry></row>
153 <row><entry><varname>vxlan</varname></entry>
154 <entry>A virtual extensible LAN (vxlan), for connecting Cloud computing deployments.</entry></row>
162 <title>[Match] Section Options</title>
164 <para>A virtual network device is only created if the
165 <literal>[Match]</literal> section matches the current
166 environment, or if the section is empty. The following keys are accepted:</para>
168 <variablelist class='network-directives'>
170 <term><varname>Host=</varname></term>
172 <para>Matches against the hostname or machine ID of the
173 host. See <literal>ConditionHost=</literal> in
174 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
180 <term><varname>Virtualization=</varname></term>
182 <para>Checks whether the system is executed in a virtualized
183 environment and optionally test whether it is a specific
184 implementation. See <literal>ConditionVirtualization=</literal> in
185 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
191 <term><varname>KernelCommandLine=</varname></term>
193 <para>Checks whether a specific kernel command line option is
194 set (or if prefixed with the exclamation mark unset). See
195 <literal>ConditionKernelCommandLine=</literal> in
196 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
202 <term><varname>Architecture=</varname></term>
204 <para>Checks whether the system is running on a specific
205 architecture. See <literal>ConditionArchitecture=</literal> in
206 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
216 <title>[NetDev] Section Options</title>
218 <para>The <literal>[NetDev]</literal> section accepts the following
221 <variablelist class='network-directives'>
223 <term><varname>Description=</varname></term>
225 <para>A free-form description of the netdev.
230 <term><varname>Name=</varname></term>
232 <para>The interface name used when creating the
233 netdev. This option is compulsory.</para>
237 <term><varname>Kind=</varname></term>
239 <para>The netdev kind. This option is compulsory. See the <literal>Supported netdev kinds</literal> section
240 for the valid keys.</para>
244 <term><varname>MTUBytes=</varname></term>
246 <para>The maximum transmission unit in bytes to
247 set for the device. The usual suffixes K, M, G,
248 are supported and are understood to the base of
249 1024. This key is not currently suported for
250 <literal>tun</literal> or <literal>tap</literal> devices.
255 <term><varname>MACAddress=</varname></term>
257 <para>The MAC address to use for the device.
258 If none is given, one is generated based on
259 the interface name and the
260 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
261 This key is not currently suported for <literal>tun</literal> or <literal>tap</literal> devices.
269 <title>[VLAN] Section Options</title>
271 <para>The <literal>[VLAN]</literal> section only applies for netdevs of kind <literal>vlan</literal>,
272 and accepts the following key:</para>
274 <variablelist class='network-directives'>
276 <term><varname>Id=</varname></term>
278 <para>The VLAN ID to use. An integer in the range 0–4094.
279 This option is compulsory.</para>
287 <title>[MACVLAN] Section Options</title>
289 <para>The <literal>[MACVLAN]</literal> section only applies for netdevs of kind
290 <literal>macvlan</literal>, and accepts the following key:</para>
292 <variablelist class='network-directives'>
294 <term><varname>Mode=</varname></term>
296 <para>The MACVLAN mode to use. The supported options are
297 <literal>private</literal>, <literal>vepa</literal>,
298 <literal>bridge</literal> and <literal>passthru</literal>.
307 <title>[IPVLAN] Section Options</title>
309 <para>The <literal>[IPVLAN]</literal> section only applies for netdevs of kind
310 <literal>ipvlan</literal>, and accepts the following key:</para>
312 <variablelist class='network-directives'>
314 <term><varname>Mode=</varname></term>
316 <para>The IPVLAN mode to use. The supported options are
317 <literal>L2</literal> and <literal>L3</literal>.
326 <title>[VXLAN] Section Options</title>
327 <para>The <literal>[VXLAN]</literal> section only applies for netdevs of kind
328 <literal>vxlan</literal>, and accepts the following key:</para>
330 <variablelist class='network-directives'>
332 <term><varname>Id=</varname></term>
334 <para>The VXLAN ID to use.</para>
338 <term><varname>Group=</varname></term>
340 <para>An assigned multicast group IP address.</para>
344 <term><varname>TOS=</varname></term>
346 <para>The Type Of Service byte value for a vxlan interface.</para>
350 <term><varname>TTL=</varname></term>
352 <para>A fixed Time To Live N on Virtual eXtensible Local Area Network packets.
353 N is a number in the range 1-255. 0 is a special value meaning that packets
354 inherit the TTL value.</para>
358 <term><varname>MacLearning=</varname></term>
360 <para>A boolean. When true, enables dynamic MAC learning
361 to discover remote MAC addresses.</para>
365 <term><varname>FDBAgeingSec=</varname></term>
367 <para>The lifetime of Forwarding Database entry learnt by the kernel in seconds.</para>
371 <term><varname>ARPProxy=</varname></term>
373 <para>A boolean. When true, enables ARP proxy.</para>
377 <term><varname>L2MissNotification=</varname></term>
379 <para>A boolean. When true, enables netlink LLADDR miss notifications.</para>
383 <term><varname>L3MissNotification=</varname></term>
385 <para>A boolean. When true, enables netlink IP ADDR miss notifications.</para>
389 <term><varname>RouteShortCircuit=</varname></term>
391 <para>A boolean. When true route short circuit is turned on.</para>
397 <title>[Tunnel] Section Options</title>
399 <para>The <literal>[Tunnel]</literal> section only applies for netdevs of kind
400 <literal>ipip</literal>, <literal>sit</literal>, <literal>gre</literal>, <literal>gretap</literal>,
401 <literal>ip6gre</literal>, <literal>ip6gretap</literal>, <literal>vti</literal> and <literal>ip6tnl</literal>
402 and accepts the following keys:</para>
404 <variablelist class='network-directives'>
406 <term><varname>Local=</varname></term>
408 <para>A static local address for tunneled packets.
409 It must be an address on another interface of this host.</para>
413 <term><varname>Remote=</varname></term>
415 <para>The remote endpoint of the tunnel.</para>
419 <term><varname>TOS=</varname></term>
421 <para>The Type Of Service byte value for a tunnel interface.
422 For details about the TOS see the
423 <ulink url="http://tools.ietf.org/html/rfc1349">
424 Type of Service in the Internet Protocol Suite
430 <term><varname>TTL=</varname></term>
432 <para>A fixed Time To Live N on tunneled packets.
433 N is a number in the range 1-255. 0 is a special value meaning that packets
434 inherit the TTL value. The default value for IPv4 tunnels is: inherit.
435 The default value for IPv6 tunnels is: 64.</para>
439 <term><varname>DiscoverPathMTU=</varname></term>
441 <para>A boolean. When true, enables Path MTU Discovery on the tunnel.</para>
445 <term><varname>Mode=</varname></term>
447 <para>An <literal>ip6tnl</literal> tunnels can have three modes
448 <literal>ip6ip6</literal> for IPv6 over IPv6,
449 <literal>ipip6</literal> for IPv4 over IPv6 or
450 <literal>any</literal> for either.
457 <title>[Peer] Section Options</title>
459 <para>The <literal>[Peer]</literal> section only applies for netdevs of kind <literal>veth</literal>
460 and accepts the following key:</para>
462 <variablelist class='network-directives'>
464 <term><varname>Name=</varname></term>
466 <para>The interface name used when creating the netdev.
467 This option is compulsory.</para>
471 <term><varname>MACAddress=</varname></term>
473 <para>The peer MACAddress, if not set it is generated in the same
474 way as the MAC address of the main interface.</para>
480 <title>[Tun] Section Options</title>
482 <para>The <literal>[Tun]</literal> section only applies for netdevs of kind
483 <literal>tun</literal>, and accepts the following keys:</para>
485 <variablelist class='network-directives'>
487 <term><varname>OneQueue=</varname></term>
488 <listitem><para>Takes a boolean argument. Configures whether
489 all packets are queued at the device (enabled), or a fixed number
490 of packets are queued at the device and the rest at the
491 <literal>qdisc</literal>. Defaults to <literal>no</literal>.</para>
495 <term><varname>MultiQueue=</varname></term>
496 <listitem><para>Takes a boolean argument. Configures whether to
497 use multiple file descriptors (queues) to parallelize packets
498 sending and receiving. Defaults to <literal>no</literal>.</para>
502 <term><varname>PacketInfo=</varname></term>
503 <listitem><para>Takes a boolean argument. Configures whether packets
504 should be prepened with four extra bytes (two flag bytes and two
505 protocol bytes). If disabled it indicates that the packets will be
506 pure IP packets. Defaults to <literal>no</literal>.</para>
510 <term><varname>User=</varname></term>
511 <listitem><para>User to grant access to the <filename>/dev/net/tun</filename>
516 <term><varname>Group=</varname></term>
517 <listitem><para>Group to grant access to the <filename>/dev/net/tun</filename>
527 <title>[Tap] Section Options</title>
529 <para>The <literal>[Tap]</literal> section only applies for netdevs of kind
530 <literal>tap</literal>, and accepts the same keys as the
531 <literal>[Tun]</literal> section.</para>
535 <title>[Bond] Section Options</title>
537 <para>The <literal>[Bond]</literal> section accepts the following
540 <variablelist class='network-directives'>
542 <term><varname>Mode=</varname></term>
544 <para>Specifies one of the bonding policies. The default is
545 <literal>balance-rr</literal> (round robin). Possible values are
546 <literal>balance-rr</literal>,
547 <literal>active-backup</literal>,
548 <literal>balance-xor</literal>,
549 <literal>broadcast</literal>,
550 <literal>802.3ad</literal>,
551 <literal>balance-tlb</literal>, and
552 <literal>balance-alb</literal>.
558 <term><varname>TransmitHashPolicy=</varname></term>
560 <para>Selects the transmit hash policy to use for slave selection in
561 balance-xor, 802.3ad, and tlb modes. Possible values are
562 <literal>layer2</literal>,
563 <literal>layer3+4</literal>,
564 <literal>layer2+3</literal>,
565 <literal>encap2+3</literal>,
566 <literal>802.3ad</literal>, and
567 <literal>encap3+4</literal>.
573 <term><varname>LACPTransmitRate=</varname></term>
575 <para>Specifies the rate with which link partner
576 transmits Link Aggregation Control Protocol Data Unit packets
577 in 802.3ad mode. Possible values are
578 <literal>slow</literal>, which requests partner to transmit LACPDUs every 30 seconds, and
579 <literal>fast</literal>, which requests partner to transmit LACPDUs every second.
580 The default value is <literal>slow</literal>.</para>
585 <term><varname>MIIMonitorSec=</varname></term>
587 <para>Specifies the frequency that Media Independent Interface link
588 monitoring will occur. A value of zero disables MII link monitoring.
589 This values is rounded down to the nearest millisecond. The default
595 <term><varname>UpDelaySec=</varname></term>
597 <para>Specifies the delay before a link is enabled after a link up
598 status has been detected. This value is rounded down to a multiple of
599 MIIMonitorSec. The default value is 0.</para>
604 <term><varname>DownDelaySec=</varname></term>
606 <para>Specifies the delay before a link is disabled after a link down
607 status has been detected. This value is rounded down to a multiple of
608 MIIMonitorSec. The default value is 0.</para>
616 <title>Example</title>
618 <title>/etc/systemd/network/bridge.netdev</title>
620 <programlisting>[NetDev]
622 Kind=bridge</programlisting>
626 <title>/etc/systemd/network/vlan1.netdev</title>
628 <programlisting>[Match]
636 Id=1</programlisting>
639 <title>/etc/systemd/network/ipip.netdev</title>
640 <programlisting>[NetDev]
646 Local=192.168.223.238
647 Remote=192.169.224.239
648 TTL=64</programlisting>
651 <title>/etc/systemd/network/tap.netdev</title>
652 <programlisting>[NetDev]
658 PacketInfo=true</programlisting> </example>
661 <title>/etc/systemd/network/sit.netdev</title>
662 <programlisting>[NetDev]
669 Remote=10.65.223.239</programlisting>
673 <title>/etc/systemd/network/gre.netdev</title>
674 <programlisting>[NetDev]
681 Remote=10.65.223.239</programlisting>
685 <title>/etc/systemd/network/vti.netdev</title>
687 <programlisting>[NetDev]
694 Remote=10.65.223.239</programlisting>
698 <title>/etc/systemd/network/veth.netdev</title>
699 <programlisting>[NetDev]
704 Name=veth-peer</programlisting>
708 <title>/etc/systemd/network/dummy.netdev</title>
709 <programlisting>[NetDev]
712 MACAddress=12:34:56:78:9a:bc</programlisting>
717 <title>See Also</title>
719 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
720 <citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
721 <citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
722 <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>