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>
93 <term><varname>bond</varname></term>
95 <para>A bond device is an aggregation of all its slave devices. See
96 <ulink url="https://www.kernel.org/doc/Documentation/networking/bonding.txt">
97 Linux Ethernet Bonding Driver HOWTO</ulink> for details.</para>
104 <term><varname>bridge</varname></term>
106 <para>A bridge devcie is a software switch, each of its slave devices and the bridge itself are ports of the switch.</para>
113 <term><varname>dummy</varname></term>
115 <para>A dummy device drops all packets sent to it.</para>
122 <term><varname>gre</varname></term>
124 <para>A Level 3 GRE tunnel over IPv4. See
125 <ulink url="https://tools.ietf.org/html/rfc2784">
126 RFC 2784</ulink> for details.</para>
133 <term><varname>gretap</varname></term>
135 <para>A Level 2 GRE tunnel over IPv4.</para>
142 <term><varname>ip6gre</varname></term>
144 <para>A Level 3 GRE tunnel over IPv6.</para>
151 <term><varname>ip6tnl</varname></term>
153 <para>An IPv4 or IPv6 tunnel over IPv6</para>
160 <term><varname>ip6gretap</varname></term>
162 <para>An Level 2 GRE tunnel over IPv6.</para>
169 <term><varname>ipip</varname></term>
171 <para>An IPv4 over IPv4 tunnel.</para>
178 <term><varname>ipvlan</varname></term>
180 <para>An ipvlan device is a stacked device which receives packets from its
181 underlying device based on IP address filtering.</para>
188 <term><varname>macvlan</varname></term>
190 <para>A macvlan device is a stacked device which receives packets from its
191 underlying device based on MAC address filtering.</para>
198 <term><varname>sit</varname></term>
200 <para>An IPv6 over IPv4 tunnel.</para>
207 <term><varname>tap</varname></term>
209 <para>A persistent Level 2 tunnel between a network device and a device node.</para>
216 <term><varname>tun</varname></term>
218 <para>A persistent Level 3 tunnel between a network device and a device node.</para>
225 <term><varname>veth</varname></term>
227 <para>An ethernet tunnel between a pair of network devices.</para>
234 <term><varname>vlan</varname></term>
236 <para>A vlan is a stacked device which receives packets from its underlying
237 device based on VLAN tagging. See
238 <ulink url="http://www.ieee802.org/1/pages/802.1Q.html">
239 IEEE 802.1Q</ulink> for details.</para>
246 <term><varname>vti</varname></term>
248 <para>An IPv4 over IPSec tunnel.</para>
255 <term><varname>vxlan</varname></term>
265 <title>[Match] Section Options</title>
267 <para>A virtual network device is only created if the
268 <literal>[Match]</literal> section matches the current
269 environment, or if the section is empty. The following keys are accepted:</para>
271 <variablelist class='network-directives'>
273 <term><varname>Host=</varname></term>
275 <para>Matches against the hostname or machine ID of the
276 host. See <literal>ConditionHost=</literal> in
277 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
283 <term><varname>Virtualization=</varname></term>
285 <para>Checks whether the system is executed in a virtualized
286 environment and optionally test whether it is a specific
287 implementation. See <literal>ConditionVirtualization=</literal> in
288 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
294 <term><varname>KernelCommandLine=</varname></term>
296 <para>Checks whether a specific kernel command line option is
297 set (or if prefixed with the exclamation mark unset). See
298 <literal>ConditionKernelCommandLine=</literal> in
299 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
305 <term><varname>Architecture=</varname></term>
307 <para>Checks whether the system is running on a specific
308 architecture. See <literal>ConditionArchitecture=</literal> in
309 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
319 <title>[NetDev] Section Options</title>
321 <para>The <literal>[NetDev]</literal> section accepts the following
324 <variablelist class='network-directives'>
326 <term><varname>Description=</varname></term>
328 <para>A free-form description of the netdev.
333 <term><varname>Name=</varname></term>
335 <para>The interface name used when creating the
336 netdev. This option is compulsory.</para>
340 <term><varname>Kind=</varname></term>
342 <para>The netdev kind. This option is compulsory. See the <literal>Supported netdev kinds</literal> section
343 for the valid keys.</para>
347 <term><varname>MTUBytes=</varname></term>
349 <para>The maximum transmission unit in bytes to
350 set for the device. The usual suffixes K, M, G,
351 are supported and are understood to the base of
352 1024. This key is not currently suported for
353 <literal>tun</literal> or <literal>tap</literal> devices.
358 <term><varname>MACAddress=</varname></term>
360 <para>The MAC address to use for the device.
361 If none is given, one is generated based on
362 the interface name and the
363 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
364 This key is not currently suported for <literal>tun</literal> or <literal>tap</literal> devices.
372 <title>[VLAN] Section Options</title>
374 <para>The <literal>[VLAN]</literal> section only applies for netdevs of kind <literal>vlan</literal>,
375 and accepts the following key:</para>
377 <variablelist class='network-directives'>
379 <term><varname>Id=</varname></term>
381 <para>The VLAN ID to use. An integer in the range 0–4094.
382 This option is compulsory.</para>
390 <title>[MACVLAN] Section Options</title>
392 <para>The <literal>[MACVLAN]</literal> section only applies for netdevs of kind
393 <literal>macvlan</literal>, and accepts the following key:</para>
395 <variablelist class='network-directives'>
397 <term><varname>Mode=</varname></term>
399 <para>The MACVLAN mode to use. The supported options are
400 <literal>private</literal>, <literal>vepa</literal>,
401 <literal>bridge</literal> and <literal>passthru</literal>.
410 <title>[IPVLAN] Section Options</title>
412 <para>The <literal>[IPVLAN]</literal> section only applies for netdevs of kind
413 <literal>ipvlan</literal>, and accepts the following key:</para>
415 <variablelist class='network-directives'>
417 <term><varname>Mode=</varname></term>
419 <para>The IPVLAN mode to use. The supported options are
420 <literal>L2</literal> and <literal>L3</literal>.
429 <title>[VXLAN] Section Options</title>
430 <para>The <literal>[VXLAN]</literal> section only applies for netdevs of kind
431 <literal>vxlan</literal>, and accepts the following key:</para>
433 <variablelist class='network-directives'>
435 <term><varname>Id=</varname></term>
437 <para>The VXLAN ID to use.</para>
441 <term><varname>Group=</varname></term>
443 <para>An assigned multicast group IP address.</para>
447 <term><varname>TOS=</varname></term>
449 <para>The Type Of Service byte value for a vxlan interface.</para>
453 <term><varname>TTL=</varname></term>
455 <para>A fixed Time To Live N on Virtual eXtensible Local Area Network packets.
456 N is a number in the range 1-255. 0 is a special value meaning that packets
457 inherit the TTL value.</para>
461 <term><varname>MacLearning=</varname></term>
463 <para>A boolean. When true, enables dynamic MAC learning
464 to discover remote MAC addresses.</para>
468 <term><varname>FDBAgeingSec=</varname></term>
470 <para>The lifetime of Forwarding Database entry learnt by the kernel in seconds.</para>
474 <term><varname>ARPProxy=</varname></term>
476 <para>A boolean. When true, enables ARP proxy.</para>
480 <term><varname>L2MissNotification=</varname></term>
482 <para>A boolean. When true, enables netlink LLADDR miss notifications.</para>
486 <term><varname>L3MissNotification=</varname></term>
488 <para>A boolean. When true, enables netlink IP ADDR miss notifications.</para>
492 <term><varname>RouteShortCircuit=</varname></term>
494 <para>A boolean. When true route short circuit is turned on.</para>
500 <title>[Tunnel] Section Options</title>
502 <para>The <literal>[Tunnel]</literal> section only applies for netdevs of kind
503 <literal>ipip</literal>, <literal>sit</literal>, <literal>gre</literal>, <literal>gretap</literal>,
504 <literal>ip6gre</literal>, <literal>ip6gretap</literal>, <literal>vti</literal> and <literal>ip6tnl</literal>
505 and accepts the following keys:</para>
507 <variablelist class='network-directives'>
509 <term><varname>Local=</varname></term>
511 <para>A static local address for tunneled packets.
512 It must be an address on another interface of this host.</para>
516 <term><varname>Remote=</varname></term>
518 <para>The remote endpoint of the tunnel.</para>
522 <term><varname>TOS=</varname></term>
524 <para>The Type Of Service byte value for a tunnel interface.
525 For details about the TOS see the
526 <ulink url="http://tools.ietf.org/html/rfc1349">
527 Type of Service in the Internet Protocol Suite
533 <term><varname>TTL=</varname></term>
535 <para>A fixed Time To Live N on tunneled packets.
536 N is a number in the range 1-255. 0 is a special value meaning that packets
537 inherit the TTL value. The default value for IPv4 tunnels is: inherit.
538 The default value for IPv6 tunnels is: 64.</para>
542 <term><varname>DiscoverPathMTU=</varname></term>
544 <para>A boolean. When true, enables Path MTU Discovery on the tunnel.</para>
548 <term><varname>Mode=</varname></term>
550 <para>An <literal>ip6tnl</literal> tunnels can have three modes
551 <literal>ip6ip6</literal> for IPv6 over IPv6,
552 <literal>ipip6</literal> for IPv4 over IPv6 or
553 <literal>any</literal> for either.
560 <title>[Peer] Section Options</title>
562 <para>The <literal>[Peer]</literal> section only applies for netdevs of kind <literal>veth</literal>
563 and accepts the following key:</para>
565 <variablelist class='network-directives'>
567 <term><varname>Name=</varname></term>
569 <para>The interface name used when creating the netdev.
570 This option is compulsory.</para>
574 <term><varname>MACAddress=</varname></term>
576 <para>The peer MACAddress, if not set it is generated in the same
577 way as the MAC address of the main interface.</para>
583 <title>[Tun] Section Options</title>
585 <para>The <literal>[Tun]</literal> section only applies for netdevs of kind
586 <literal>tun</literal>, and accepts the following keys:</para>
588 <variablelist class='network-directives'>
590 <term><varname>OneQueue=</varname></term>
591 <listitem><para>Takes a boolean argument. Configures whether
592 all packets are queued at the device (enabled), or a fixed number
593 of packets are queued at the device and the rest at the
594 <literal>qdisc</literal>. Defaults to <literal>no</literal>.</para>
598 <term><varname>MultiQueue=</varname></term>
599 <listitem><para>Takes a boolean argument. Configures whether to
600 use multiple file descriptors (queues) to parallelize packets
601 sending and receiving. Defaults to <literal>no</literal>.</para>
605 <term><varname>PacketInfo=</varname></term>
606 <listitem><para>Takes a boolean argument. Configures whether packets
607 should be prepened with four extra bytes (two flag bytes and two
608 protocol bytes). If disabled it indicates that the packets will be
609 pure IP packets. Defaults to <literal>no</literal>.</para>
613 <term><varname>User=</varname></term>
614 <listitem><para>User to grant access to the <filename>/dev/net/tun</filename>
619 <term><varname>Group=</varname></term>
620 <listitem><para>Group to grant access to the <filename>/dev/net/tun</filename>
630 <title>[Tap] Section Options</title>
632 <para>The <literal>[Tap]</literal> section only applies for netdevs of kind
633 <literal>tap</literal>, and accepts the same keys as the
634 <literal>[Tun]</literal> section.</para>
638 <title>[Bond] Section Options</title>
640 <para>The <literal>[Bond]</literal> section accepts the following
643 <variablelist class='network-directives'>
645 <term><varname>Mode=</varname></term>
647 <para>Specifies one of the bonding policies. The default is
648 <literal>balance-rr</literal> (round robin). Possible values are
649 <literal>balance-rr</literal>,
650 <literal>active-backup</literal>,
651 <literal>balance-xor</literal>,
652 <literal>broadcast</literal>,
653 <literal>802.3ad</literal>,
654 <literal>balance-tlb</literal>, and
655 <literal>balance-alb</literal>.
661 <term><varname>TransmitHashPolicy=</varname></term>
663 <para>Selects the transmit hash policy to use for slave selection in
664 balance-xor, 802.3ad, and tlb modes. Possible values are
665 <literal>layer2</literal>,
666 <literal>layer3+4</literal>,
667 <literal>layer2+3</literal>,
668 <literal>encap2+3</literal>,
669 <literal>802.3ad</literal>, and
670 <literal>encap3+4</literal>.
676 <term><varname>LACPTransmitRate=</varname></term>
678 <para>Specifies the rate with which link partner
679 transmits Link Aggregation Control Protocol Data Unit packets
680 in 802.3ad mode. Possible values are
681 <literal>slow</literal>, which requests partner to transmit LACPDUs every 30 seconds, and
682 <literal>fast</literal>, which requests partner to transmit LACPDUs every second.
683 The default value is <literal>slow</literal>.</para>
688 <term><varname>MIIMonitorSec=</varname></term>
690 <para>Specifies the frequency that Media Independent Interface link
691 monitoring will occur. A value of zero disables MII link monitoring.
692 This values is rounded down to the nearest millisecond. The default
698 <term><varname>UpDelaySec=</varname></term>
700 <para>Specifies the delay before a link is enabled after a link up
701 status has been detected. This value is rounded down to a multiple of
702 MIIMonitorSec. The default value is 0.</para>
707 <term><varname>DownDelaySec=</varname></term>
709 <para>Specifies the delay before a link is disabled after a link down
710 status has been detected. This value is rounded down to a multiple of
711 MIIMonitorSec. The default value is 0.</para>
719 <title>Example</title>
721 <title>/etc/systemd/network/bridge.netdev</title>
723 <programlisting>[NetDev]
725 Kind=bridge</programlisting>
729 <title>/etc/systemd/network/vlan1.netdev</title>
731 <programlisting>[Match]
739 Id=1</programlisting>
742 <title>/etc/systemd/network/ipip.netdev</title>
743 <programlisting>[NetDev]
749 Local=192.168.223.238
750 Remote=192.169.224.239
751 TTL=64</programlisting>
754 <title>/etc/systemd/network/tap.netdev</title>
755 <programlisting>[NetDev]
761 PacketInfo=true</programlisting> </example>
764 <title>/etc/systemd/network/sit.netdev</title>
765 <programlisting>[NetDev]
772 Remote=10.65.223.239</programlisting>
776 <title>/etc/systemd/network/gre.netdev</title>
777 <programlisting>[NetDev]
784 Remote=10.65.223.239</programlisting>
788 <title>/etc/systemd/network/vti.netdev</title>
790 <programlisting>[NetDev]
797 Remote=10.65.223.239</programlisting>
801 <title>/etc/systemd/network/veth.netdev</title>
802 <programlisting>[NetDev]
807 Name=veth-peer</programlisting>
811 <title>/etc/systemd/network/dummy.netdev</title>
812 <programlisting>[NetDev]
815 MACAddress=12:34:56:78:9a:bc</programlisting>
820 <title>See Also</title>
822 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
823 <citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
824 <citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
825 <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>