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.network" 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.network
</refentrytitle>
42 <manvolnum>5</manvolnum>
46 <refname>systemd.network
</refname>
47 <refpurpose>Network configuration
</refpurpose>
51 <para><filename><replaceable>network
</replaceable>.network
</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>Network files must have the extension
62 <filename>.network
</filename>; other extensions are ignored.
63 Networks are applied to links whenever the links appear.
</para>
65 <para>The
<filename>.network
</filename> files are read from the
66 files located in the system network directory
67 <filename>/usr/lib/systemd/network
</filename>, the volatile
68 runtime network directory
69 <filename>/run/systemd/network
</filename> and the local
70 administration network directory
71 <filename>/etc/systemd/network
</filename>. All configuration files
72 are collectively sorted and processed in lexical order, regardless
73 of the directories in which they live. However, files with
74 identical filenames replace each other. Files in
75 <filename>/etc
</filename> have the highest priority, files in
76 <filename>/run
</filename> take precedence over files with the same
77 name in
<filename>/usr/lib
</filename>. This can be used to
78 override a system-supplied configuration file with a local file if
79 needed. As a special case, an empty file (file size
0) or symlink
80 with the same name pointing to
<filename>/dev/null
</filename>,
81 disable the configuration file entirely (it is
"masked").
</para>
85 <title>[Match] Section Options
</title>
87 <para>The network file contains a
<literal>[Match]
</literal>
88 section, which determines if a given network file may be applied
89 to a given device; and a
<literal>[Network]
</literal> section
90 specifying how the device should be configured. The first (in
91 lexical order) of the network files that matches a given device
92 is applied, all later files are ignored, even if they match as
95 <para>A network file is said to match a device if each of the
96 entries in the
<literal>[Match]
</literal> section matches, or if
97 the section is empty. The following keys are accepted:
</para>
99 <variablelist class='network-directives'
>
101 <term><varname>MACAddress=
</varname></term>
103 <para>The hardware address.
</para>
107 <term><varname>Path=
</varname></term>
109 <para>A whitespace-separated list of shell-style globs
110 matching the persistent path, as exposed by the udev
111 property
<literal>ID_PATH
</literal>.
</para>
115 <term><varname>Driver=
</varname></term>
117 <para>A whitespace-separated list of shell-style globs
118 matching the driver currently bound to the device, as
119 exposed by the udev property
<literal>DRIVER
</literal>
120 of its parent device, or if that is not set the driver
121 as exposed by
<literal>ethtool -i
</literal> of the
122 device itself.
</para>
126 <term><varname>Type=
</varname></term>
128 <para>A whitespace-separated list of shell-style globs
129 matching the device type, as exposed by the udev property
130 <literal>DEVTYPE
</literal>.
</para>
134 <term><varname>Name=
</varname></term>
136 <para>A whitespace-separated list of shell-style globs
137 matching the device name, as exposed by the udev property
138 <literal>INTERFACE
</literal>.
</para>
142 <term><varname>Host=
</varname></term>
144 <para>Matches against the hostname or machine ID of the
145 host. See
<literal>ConditionHost=
</literal> in
146 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
152 <term><varname>Virtualization=
</varname></term>
154 <para>Checks whether the system is executed in a virtualized
155 environment and optionally test whether it is a specific
156 implementation. See
<literal>ConditionVirtualization=
</literal> in
157 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
163 <term><varname>KernelCommandLine=
</varname></term>
165 <para>Checks whether a specific kernel command line option is
166 set (or if prefixed with the exclamation mark unset). See
167 <literal>ConditionKernelCommandLine=
</literal> in
168 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
174 <term><varname>Architecture=
</varname></term>
176 <para>Checks whether the system is running on a specific
177 architecture. See
<literal>ConditionArchitecture=
</literal> in
178 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
188 <title>[Link] Section Options
</title>
190 <para> The
<literal>[Link]
</literal> section accepts the following keys:
</para>
192 <variablelist class='network-directives'
>
194 <term><varname>MACAddress=
</varname></term>
196 <para>The hardware address.
</para>
200 <term><varname>MTUBytes=
</varname></term>
202 <para>The maximum transmission unit in bytes to set for the
203 device. The usual suffixes K, M, G, are supported and are
204 understood to the base of
1024.
</para>
211 <title>[Network] Section Options
</title>
213 <para>The
<literal>[Network]
</literal> section accepts the following keys:
</para>
215 <variablelist class='network-directives'
>
217 <term><varname>Description=
</varname></term>
219 <para>A description of the device. This is only used for
220 presentation purposes.
</para>
224 <term><varname>DHCP=
</varname></term>
226 <para>Enables DHCPv4 and/or DHCPv6 support. Accepts
227 <literal>yes
</literal>,
<literal>no
</literal>,
228 <literal>ipv4
</literal>, or
<literal>ipv6
</literal>.
</para>
230 <para>Please note that by default the domain name
231 specified through DHCP is not used for name resolution.
232 See option
<option>UseDomains=
</option> below.
</para>
236 <term><varname>DHCPServer=
</varname></term>
238 <para>A boolean. Enables a basic DHCPv4 server on the
239 device. Mostly useful for handing out leases to container
244 <term><varname>LinkLocalAddressing=
</varname></term>
246 <para>Enables link-local address autoconfiguration. Accepts
247 <literal>yes
</literal>,
<literal>no
</literal>,
248 <literal>ipv4
</literal>, or
<literal>ipv6
</literal>. Defaults to
249 <literal>ipv6
</literal>.
</para>
253 <term><varname>IPv4LLRoute=
</varname></term>
255 <para>A boolean. When true, sets up the route needed for
256 non-IPv4LL hosts to communicate with IPv4LL-only hosts. Defaults
262 <term><varname>IPv6Token=
</varname></term>
264 <para>An IPv6 address with the top
64 bits unset. When set, indicates the
265 64 bits interface part of SLAAC IPv6 addresses for this link. By default
266 it is autogenerated.
</para>
270 <term><varname>LLMNR=
</varname></term>
272 <para>A boolean or
<literal>resolve
</literal>. When true, enables
273 Link-Local Multicast Name Resolution on the link, when set to
274 <literal>resolve
</literal> only resolution is enabled, but not
275 announcement. Defaults to true.
</para>
279 <term><varname>LLDP=
</varname></term>
281 <para>A boolean. When true, enables LLDP link receive support.
286 <term><varname>BindCarrier=
</varname></term>
288 <para>A port or a list of ports. When set, controls the
289 behavior of the current interface. When all ports in the list
290 are in an operational down state, the current interface is brought
291 down. When at least one port has carrier, the current interface
297 <term><varname>Address=
</varname></term>
299 <para>A static IPv4 or IPv6 address and its prefix length,
300 separated by a
<literal>/
</literal> character. Specify
301 this key more than once to configure several addresses.
302 The format of the address must be as described in
303 <citerefentry project='man-pages'
><refentrytitle>inet_pton
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
304 This is a short-hand for an [Address] section only
305 containing an Address key (see below). This option may be
306 specified more than once.
309 <para>If the specified address is
0.0.0.0 (for IPv4) or
310 [::] (for IPv6), a new address range of the requested size
311 is automatically allocated from a system-wide pool of
312 unused ranges. The allocated range is checked against all
313 current network interfaces and all known network
314 configuration files to avoid address range conflicts. The
315 default system-wide pool consists of
192.168.0.0/
16,
316 172.16.0.0/
12 and
10.0.0.0/
8 for IPv4, and fc00::/
7 for
317 IPv6. This functionality is useful to manage a large
318 number of dynamically created network interfaces with the
319 same network configuration and automatic address range
325 <term><varname>Gateway=
</varname></term>
327 <para>The gateway address, which must be in the format
329 <citerefentry project='man-pages'
><refentrytitle>inet_pton
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
330 This is a short-hand for a [Route] section only containing
331 a Gateway key. This option may be specified more than
336 <term><varname>DNS=
</varname></term>
338 <para>A DNS server address, which must be in the format
340 <citerefentry project='man-pages'
><refentrytitle>inet_pton
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
341 This option may be specified more than once.
</para>
345 <term><varname>Domains=
</varname></term>
347 <para>The domains used for DNS resolution over this link.
</para>
351 <term><varname>NTP=
</varname></term>
353 <para>An NTP server address. This option may be specified more than once.
</para>
357 <term><varname>IPForward=
</varname></term>
358 <listitem><para>Configures IP forwarding for the network
359 interface. If enabled incoming packets on the network
360 interface will be forwarded to other interfaces according to
361 the routing table. Takes either a boolean argument, or the
362 values
<literal>ipv4
</literal> or
<literal>ipv6
</literal>,
363 which only enables IP forwarding for the specified address
364 family, or
<literal>kernel
</literal>, which preserves existing sysctl settings.
366 <filename>net.ipv4.conf.
<interface
>.forwarding
</filename>
368 <filename>net.ipv6.conf.
<interface
>.forwarding
</filename>
369 sysctl options of the network interface (see
<ulink
370 url=
"https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt">ip-sysctl.txt
</ulink>
371 for details about sysctl options). Defaults to
372 <literal>no
</literal>.
</para>
374 <para>Note: unless this option is turned on, or set to
<literal>kernel
</literal>,
375 no IP forwarding is done on this interface, even if this is
376 globally turned on in the kernel, with the
377 <filename>net.ipv4.ip_forward
</filename>,
378 <filename>net.ipv4.conf.all.forwarding
</filename>, and
379 <filename>net.ipv6.conf.all.forwarding
</filename> sysctl
384 <term><varname>IPMasquerade=
</varname></term>
385 <listitem><para>Configures IP masquerading for the network
386 interface. If enabled packets forwarded from the network
387 interface will be appear as coming from the local host.
388 Takes a boolean argument. Implies
389 <varname>IPForward=ipv4
</varname>. Defaults to
390 <literal>no
</literal>.
</para></listitem>
393 <term><varname>IPv6PrivacyExtensions=
</varname></term>
394 <listitem><para>Configures use of stateless temporary
395 addresses that change over time (see
<ulink
396 url=
"https://tools.ietf.org/html/rfc4941">RFC
4941</ulink>,
397 Privacy Extensions for Stateless Address Autoconfiguration
398 in IPv6). Takes a boolean or the special values
399 <literal>prefer-public
</literal> and
400 <literal>kernel
</literal>. When true enables the privacy
401 extensions and prefers temporary addresses over public
402 addresses. When
<literal>prefer-public
</literal> enables the
403 privacy extensions, but prefers public addresses over
404 temporary addresses. When false, the privacy extensions
405 remain disabled. When
<literal>kernel
</literal> the kernel's
406 default setting will be left in place. Defaults to
407 <literal>no
</literal>.
</para></listitem>
410 <term><varname>Bridge=
</varname></term>
412 <para>The name of the bridge to add the link to.
</para>
416 <term><varname>Bond=
</varname></term>
418 <para>The name of the bond to add the link to.
</para>
422 <term><varname>VLAN=
</varname></term>
424 <para>The name of a VLAN to create on the link. This
425 option may be specified more than once.
</para>
429 <term><varname>MACVLAN=
</varname></term>
431 <para>The name of a MACVLAN to create on the link. This
432 option may be specified more than once.
</para>
436 <term><varname>VXLAN=
</varname></term>
438 <para>The name of a VXLAN to create on the link. This
439 option may be specified more than once.
</para>
443 <term><varname>Tunnel=
</varname></term>
445 <para>The name of a Tunnel to create on the link. This
446 option may be specified more than once.
</para>
454 <title>[Address] Section Options
</title>
456 <para>An
<literal>[Address]
</literal> section accepts the
457 following keys. Specify several
<literal>[Address]
</literal>
458 sections to configure several addresses.
</para>
460 <variablelist class='network-directives'
>
462 <term><varname>Address=
</varname></term>
464 <para>As in the
<literal>[Network]
</literal> section. This
465 key is mandatory.
</para>
469 <term><varname>Peer=
</varname></term>
471 <para>The peer address in a point-to-point connection.
472 Accepts the same format as the
<literal>Address
</literal>
477 <term><varname>Broadcast=
</varname></term>
479 <para>The broadcast address, which must be in the format
481 <citerefentry project='man-pages'
><refentrytitle>inet_pton
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
482 This key only applies to IPv4 addresses. If it is not
483 given, it is derived from the
<literal>Address
</literal>
488 <term><varname>Label=
</varname></term>
490 <para>An address label.
</para>
497 <title>[Route] Section Options
</title>
498 <para>The
<literal>[Route]
</literal> section accepts the
499 following keys. Specify several
<literal>[Route]
</literal>
500 sections to configure several routes.
</para>
502 <variablelist class='network-directives'
>
504 <term><varname>Gateway=
</varname></term>
506 <para>As in the
<literal>[Network]
</literal> section.
</para>
510 <term><varname>Destination=
</varname></term>
512 <para>The destination prefix of the route. Possibly
513 followed by a slash and the prefixlength. If omitted, a
514 full-length host route is assumed.
</para>
518 <term><varname>Source=
</varname></term>
520 <para>The source prefix of the route. Possibly followed by
521 a slash and the prefixlength. If omitted, a full-length
522 host route is assumed.
</para>
526 <term><varname>Metric=
</varname></term>
528 <para>The metric of the route. An unsigned integer
</para>
532 <term><varname>Scope=
</varname></term>
534 <para>The scope of the route. One of the values
<literal>global
</literal>,
535 <literal>link
</literal> or
<literal>host
</literal>. Defaults to
536 <literal>global
</literal>.
</para>
543 <title>[DHCP] Section Options
</title>
544 <para>The
<literal>[DHCP]
</literal> section accepts the following keys:
</para>
546 <variablelist class='network-directives'
>
548 <term><varname>UseDNS=
</varname></term>
550 <para>When true (the default), the DNS servers received
551 from the DHCP server will be used and take precedence over
552 any statically configured ones.
</para>
554 <para>This corresponds to the
<option>nameserver
</option>
555 option in
<citerefentry project='man-pages'
><refentrytitle>resolv.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
</para>
559 <term><varname>UseNTP=
</varname></term>
561 <para>When true (the default), the NTP servers received
562 from the DHCP server will be used by systemd-timesyncd
563 and take precedence over any statically configured ones.
</para>
567 <term><varname>UseMTU=
</varname></term>
569 <para>When true, the interface maximum transmission unit
570 from the DHCP server will be used on the current link.
571 Defaults to false.
</para>
575 <term><varname>SendHostname=
</varname></term>
577 <para>When true (the default), the machine's hostname will
578 be sent to the DHCP server.
</para>
582 <term><varname>UseHostname=
</varname></term>
584 <para>When true (the default), the hostname received from
585 the DHCP server will be used as the transient hostname.
590 <term><varname>Hostname=
</varname></term>
592 <para>Use this value for the hostname which is sent to the
593 DHCP server, instead of machine's hostname.
</para>
597 <term><varname>UseDomains=
</varname></term>
599 <para>When true (not the default), the domain name
600 received from the DHCP server will be used for DNS
601 resolution over this link. When a name cannot be resolved
602 as specified, the domain name will be used a suffix and
603 name resolution of that will be attempted.
</para>
605 <para>This corresponds to the
<option>domain
</option>
606 option in
<citerefentry project='man-pages'
><refentrytitle>resolv.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
607 and should not be enabled on untrusted networks.
</para>
611 <term><varname>UseRoutes=
</varname></term>
613 <para>When true (the default), the static routes will be
614 requested from the DHCP server and added to the routing
615 table with metric of
1024.
</para>
619 <term><varname>CriticalConnection=
</varname></term>
621 <para>When true, the connection will never be torn down
622 even if the DHCP lease expires. This is contrary to the
623 DHCP specification, but may be the best choice if, say,
624 the root filesystem relies on this connection. Defaults to
629 <term><varname>ClientIdentifier=
</varname></term>
631 <para>DHCP client identifier to use. Either
<literal>mac
</literal>
632 to use the MAC address of the link or
<literal>duid
</literal>
633 (the default) to use a RFC4361-compliant Client ID.
</para>
637 <term><varname>VendorClassIdentifier=
</varname></term>
639 <para>The vendor class identifier used to identify vendor
640 type and configuration.
</para>
644 <term><varname>RequestBroadcast=
</varname></term>
646 <para>Request the server to use broadcast messages before
647 the IP address has been configured. This is necessary for
648 devices that cannot receive RAW packets, or that cannot
649 receive packets at all before an IP address has been
650 configured. On the other hand, this must not be enabled on
651 networks where broadcasts are filtered out.
</para>
655 <term><varname>RouteMetric=
</varname></term>
657 <para>Set the routing metric for routes specified by the
666 <title>[Bridge] Section Options
</title>
667 <para>The
<literal>[Bridge]
</literal> section accepts the
668 following keys.
</para>
669 <variablelist class='network-directives'
>
671 <term><varname>UnicastFlood=
</varname></term>
673 <para>A boolean. Controls whether the bridge should flood
674 traffic for which an FDB entry is missing and the destination
675 is unknown through this port. Defaults to on.
680 <term><varname>HairPin=
</varname></term>
682 <para>A boolean. Configures whether traffic may be sent back
683 out of the port on which it was received. By default, this
684 flag is false, and the bridge will not forward traffic back
685 out of the receiving port.
</para>
689 <term><varname>UseBPDU=
</varname></term>
691 <para>A boolean. Configures whether STP Bridge Protocol Data Units will be
692 processed by the bridge port. Defaults to yes.
</para>
696 <term><varname>FastLeave=
</varname></term>
698 <para>A boolean. This flag allows the bridge to immediately stop multicast
699 traffic on a port that receives IGMP Leave message. It is only used with
700 IGMP snooping if enabled on the bridge. Defaults to off.
</para>
704 <term><varname>AllowPortToBeRoot=
</varname></term>
706 <para>A boolean. Configures whether a given port is allowed to
707 become a root port. Only used when STP is enabled on the bridge.
708 Defaults to on.
</para>
712 <term><varname>Cost=
</varname></term>
714 <para>Sets the
"cost" of sending packets of this interface.
715 Each port in a bridge may have different speed and the cost
716 is used to decide which link to use. Faster interfaces
717 should have lower costs.
</para>
723 <title>[BridgeFDB] Section Options
</title>
724 <para>The
<literal>[BridgeFDB]
</literal> section manages the
725 forwarding database table of a port and accepts the following
726 keys. Specify several
<literal>[BridgeFDB]
</literal> sections to
727 configure several static MAC table entries.
</para>
729 <variablelist class='network-directives'
>
731 <term><varname>MACAddress=
</varname></term>
733 <para>As in the
<literal>[Network]
</literal> section. This
734 key is mandatory.
</para>
738 <term><varname>VLANId=
</varname></term>
740 <para>The VLAN Id for the new static MAC table entry. If
741 omitted, no VLAN Id info is appended to the new static MAC
749 <title>Example
</title>
751 <title>/etc/systemd/network/
50-static.network
</title>
753 <programlisting>[Match]
757 Address=
192.168.0.15/
24
758 Gateway=
192.168.0.1</programlisting>
762 <title>/etc/systemd/network/
80-dhcp.network
</title>
764 <programlisting>[Match]
768 DHCP=yes
</programlisting>
772 <title>/etc/systemd/network/bridge-static.network
</title>
774 <programlisting>[Match]
778 Address=
192.168.0.15/
24
780 DNS=
192.168.0.1</programlisting>
784 <title>/etc/systemd/network/bridge-slave-interface.network
</title>
786 <programlisting>[Match]
790 Bridge=bridge0
</programlisting>
793 <title>/etc/systemd/network/ipip.network
</title>
795 <programlisting>[Match]
799 Tunnel=ipip-tun
</programlisting>
803 <title>/etc/systemd/network/sit.network
</title>
805 <programlisting>[Match]
809 Tunnel=sit-tun
</programlisting>
813 <title>/etc/systemd/network/gre.network
</title>
815 <programlisting>[Match]
819 Tunnel=gre-tun
</programlisting>
823 <title>/etc/systemd/network/vti.network
</title>
825 <programlisting>[Match]
829 Tunnel=vti-tun
</programlisting>
833 <title>/etc/systemd/network/bond.network
</title>
835 <programlisting>[Match]
846 <title>See Also
</title>
848 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
849 <citerefentry><refentrytitle>systemd-networkd
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
850 <citerefentry><refentrytitle>systemd.link
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
851 <citerefentry><refentrytitle>systemd.netdev
</refentrytitle><manvolnum>5</manvolnum></citerefentry>