systemd.network man page
systemd.network — Network configuration
Network setup is performed by systemd-networkd(8).
Network files must have the extension
.network; other extensions are ignored. Networks are applied to links whenever the links appear.
.network files are read from the files located in the system network directory
/usr/lib/systemd/network, the volatile runtime network directory
/run/systemd/network and the local administration network directory
/etc/systemd/network. All configuration files are collectively sorted and processed in lexical order, regardless of the directories in which they live. However, files with identical filenames replace each other. Files in
/etc have the highest priority, files in
/run take precedence over files with the same name in
/usr/lib. This can be used to override a system-supplied configuration file with a local file if needed; a symlink in
/etc with the same name as a configuration file in
/usr/lib, pointing to
/dev/null, disables the configuration file entirely.
[Match] Section Options
The network file contains a
[Match] section, which determines if a given network file may be applied to a given device; and a
[Network] section specifying how the device should be configured. The first (in lexical order) of the network files that matches a given device is applied, all later files are ignored, even if they match as well.
A network file is said to match a device if each of the entries in the
[Match] section matches, or if the section is empty. The following keys are accepted:
- The hardware address.
- A whitespace-separated list of shell-style globs matching the persistent path, as exposed by the udev property
- A whitespace-separated list of shell-style globs matching the driver currently bound to the device, as exposed by the udev property
DRIVERof its parent device, or if that is not set the driver as exposed by
ethtool -iof the device itself.
- A whitespace-separated list of shell-style globs matching the device type, as exposed by the udev property
- A whitespace-separated list of shell-style globs matching the device name, as exposed by the udev property
- Matches against the hostname or machine ID of the host. See
ConditionHost=in systemd.unit(5) for details.
- Checks whether the system is executed in a virtualized environment and optionally test whether it is a specific implementation. See
ConditionVirtualization=in systemd.unit(5) for details.
- Checks whether a specific kernel command line option is set (or if prefixed with the exclamation mark unset). See
ConditionKernelCommandLine=in systemd.unit(5) for details.
- Checks whether the system is running on a specific architecture. See
ConditionArchitecture=in systemd.unit(5) for details.
[Link] Section Options
[Link] section accepts the following keys:
- The hardware address.
- The maximum transmission unit in bytes to set for the device. The usual suffixes K, M, G, are supported and are understood to the base of 1024.
[Network] Section Options
[Network] section accepts the following keys:
- A description of the device. This is only used for presentation purposes.
- Enables DHCPv4 and/or DHCPv6 support. Accepts
Please note that by default the domain name specified through DHCP is not used for name resolution. See option
- A boolean. Enables a basic DHCPv4 server on the device. Mostly useful for handing out leases to container instances.
- Enables link-local address autoconfiguration. Accepts
ipv6. Defaults to
- A boolean. When true, sets up the route needed for non-IPv4LL hosts to communicate with IPv4LL-only hosts. Defaults to false.
- An IPv6 address with the top 64 bits unset. When set, indicates the 64 bits interface part of SLAAC IPv6 addresses for this link. By default it is autogenerated.
- A boolean or
resolve. When true, enables Link-Local Multicast Name Resolution on the link, when set to
resolveonly resolution is enabled, but not announcement. Defaults to true.
- A boolean. When true, enables LLDP link receive support.
- A port or a list of ports. When set, controls the behaviour of the current interface. When all ports in the list are in an operational down state, the current interface is brought down. When at least one port has carrier, the current interface is brought up.
- A static IPv4 or IPv6 address and its prefix length, separated by a
/character. Specify this key more than once to configure several addresses. The format of the address must be as described in inet_pton(3). This is a short-hand for an [Address] section only containing an Address key (see below). This option may be specified more than once.
If the specified address is 0.0.0.0 (for IPv4) or [::] (for IPv6), a new address range of the requested size is automatically allocated from a system-wide pool of unused ranges. The allocated range is checked against all current network interfaces and all known network configuration files to avoid address range conflicts. The default system-wide pool consists of 192.168.0.0/16, 172.16.0.0/12 and 10.0.0.0/8 for IPv4, and fc00::/7 for IPv6. This functionality is useful to manage a large number of dynamically created network interfaces with the same network configuration and automatic address range assignment.
- The gateway address, which must be in the format described in inet_pton(3). This is a short-hand for a [Route] section only containing a Gateway key. This option may be specified more than once.
- A DNS server address, which must be in the format described in inet_pton(3). This option may be specified more than once.
- The domains used for DNS resolution over this link.
- An NTP server address. This option may be specified more than once.
- Configures IP forwarding for the network interface. If enabled incoming packets on the network interface will be forwarded to other interfaces according to the routing table. Takes either a boolean argument, or the values
ipv6, which only enables IP forwarding for the specified address family, or
kernel, which preserves existing sysctl settings. This controls the
net.ipv6.conf.<interface>.forwardingsysctl options of the network interface (see ip-sysctl.txt for details about sysctl options). Defaults to
Note: unless this option is turned on, or set to
kernel, no IP forwarding is done on this interface, even if this is globally turned on in the kernel, with the
- Configures IP masquerading for the network interface. If enabled packets forwarded from the network interface will be appear as coming from the local host. Takes a boolean argument. Implies IPForward=ipv4. Defaults to
- Configures use of stateless temporary addresses that change over time (see RFC 4941, Privacy Extensions for Stateless Address Autoconfiguration in IPv6). Takes a boolean or the special values
kernel. When true enables the privacy extensions and prefers temporary addresses over public addresses. When
prefer-publicenables the privacy extensions, but prefers public addresses over temporary addresses. When false, the privacy extensions remain disabled. When
kernelthe kernel's default setting will be left in place. Defaults to
- The name of the bridge to add the link to.
- The name of the bond to add the link to.
- The name of a VLAN to create on the link. This option may be specified more than once.
- The name of a MACVLAN to create on the link. This option may be specified more than once.
- The name of a VXLAN to create on the link. This option may be specified more than once.
- The name of a Tunnel to create on the link. This option may be specified more than once.
[Address] Section Options
[Address] section accepts the following keys. Specify several
[Address] sections to configure several addresses.
- As in the
[Network]section. This key is mandatory.
- The peer address in a point-to-point connection. Accepts the same format as the
- The broadcast address, which must be in the format described in inet_pton(3). This key only applies to IPv4 addresses. If it is not given, it is derived from the
- An address label.
[Route] Section Options
[Route] section accepts the following keys. Specify several
[Route] sections to configure several routes.
- As in the
- The destination prefix of the route. Possibly followed by a slash and the prefixlength. If omitted, a full-length host route is assumed.
- The source prefix of the route. Possibly followed by a slash and the prefixlength. If omitted, a full-length host route is assumed.
- The metric of the route. An unsigned integer
- The scope of the route. One of the values
host. Defaults to
[DHCP] Section Options
[DHCP] section accepts the following keys:
- When true (the default), the DNS servers received from the DHCP server will be used and take precedence over any statically configured ones.
This corresponds to the
nameserveroption in resolv.conf(5).
- When true (the default), the NTP servers received from the DHCP server will be used by systemd-timesyncd and take precedence over any statically configured ones.
- When true, the interface maximum transmission unit from the DHCP server will be used on the current link. Defaults to false.
- When true (the default), the machine's hostname will be sent to the DHCP server
- When true (the default), the hostname received from the DHCP server will be used as the transient hostname.
- When true (not the default), the domain name received from the DHCP server will be used for DNS resolution over this link. When a name cannot be resolved as specified, the domain name will be used a suffix and name resolution of that will be attempted.
This corresponds to the
domainoption in resolv.conf(5) and should not be enabled on untrusted networks.
- When true (the default), the static routes will be requested from the DHCP server and added to the routing table with metric of 1024.
- When true, the connection will never be torn down even if the DHCP lease expires. This is contrary to the DHCP specification, but may be the best choice if, say, the root filesystem relies on this connection. Defaults to false.
- DHCP client identifier to use. Either
macto use the MAC address of the link or
duid(the default) to use a RFC4361-compliant Client ID.
- The vendor class identifier used to identify vendor type and configuration.
- Request the server to use broadcast messages before the IP address has been configured. This is necessary for devices that cannot receive RAW packets, or that cannot receive packets at all before an IP address has been configured. On the other hand, this must not be enabled on networks where broadcasts are filtered out.
- Set the routing metric for routes specified by the DHCP server.
[Bridge] Section Options
[Bridge] section accepts the following keys.
- Each port in a bridge may have different speed. Cost is used to decide which link to use. Faster interfaces should have lower costs
[BridgeFDB] Section Options
[BridgeFDB] section manages the forwarding database table of a port and accepts the following keys. Specify several
[BridgeFDB] sections to configure several static MAC table entries.
- As in the
[Network]section. This key is mandatory.
- The VLAN Id for the new static MAC table entry. If omitted, no VLAN Id info is appended to the new static MAC table entry.
Example 1. /etc/systemd/network/50-static.network
[Match] Name=enp2s0 [Network] Address=192.168.0.15/24 Gateway=192.168.0.1
Example 2. /etc/systemd/network/80-dhcp.network
[Match] Name=en* [Network] DHCP=yes
Example 3. /etc/systemd/network/bridge-static.network
[Match] Name=bridge0 [Network] Address=192.168.0.15/24 Gateway=192.168.0.1 DNS=192.168.0.1
Example 4. /etc/systemd/network/bridge-slave-interface.network
[Match] Name=enp2s0 [Network] Bridge=bridge0
Example 5. /etc/systemd/network/ipip.network
[Match] Name=em1 [Network] Tunnel=ipip-tun
Example 6. /etc/systemd/network/sit.network
[Match] Name=em1 [Network] Tunnel=sit-tun
Example 7. /etc/systemd/network/gre.network
[Match] Name=em1 [Network] Tunnel=gre-tun
Example 8. /etc/systemd/network/vti.network
[Match] Name=em1 [Network] Tunnel=vti-tun
systemd(1), systemd-networkd(8), systemd.link(5), systemd.netdev(5)
dnssec-trust-anchors.d(5), networkctl(1), networkd.conf(5), systemd.directives(7), systemd.index(7), systemd.link(5), systemd.netdev(5), systemd-networkd.service(8), systemd-resolved.service(8), systemd-timesyncd.service(8).
Explore man page connections for systemd.network(5).