SYSTEMD.NETDEV(5)
๐ธ systemd.netdev โ Virtual Network Device configuration ๐
okay bestie, welcome to systemd.netdev(5), the page that tells you how to write a .netdev file. it's part of the systemd.network family of docs, and it's literally the blueprint for every fake-but-real network device you're gonna manifest into existence. sit down, hydrate, let's go ๐ง
โจ SYNOPSIS โจ
netdev.netdev
like. that's it. that's the whole vibe. one file, one extension, infinite networking possibilities ๐ฆ
๐ DESCRIPTION ๐
so. a .netdev file is a plain ini-style text file. it encodes configuration about a virtual network device, and it's read by systemd-networkd(8). if you wanna know the general syntax rules of these ini-style files, go check systemd.syntax(7) โ it's the grammar girlie of the systemd world ๐
the main Virtual Network Device file must have the extension .netdev. any other extension? ignored, not even looked at, blocked, ghosted ๐
virtual network devices get created as soon as systemd-networkd is started, if that's possible at all. and here's the tea ๐ต โ if a netdev with the name you specified already exists, systemd-networkd will try to update the config if the kind of the existing netdev is equivalent to the one you requested. but if it's not equivalent โ say, a bridge device foo already exists but you configured a bonding device with that same name in a .netdev file โ then it just uses the existing netdev as-is rather than replacing it with the one you asked for. soz, no take-backsies ๐
real talk: several settings (like vlan ID) cannot be changed after the netdev is created. to change those, you have to first remove the existing netdev, and then run thenetworkctl reloadcommand or restartsystemd-networkd. see alsonetworkctl(1). no shortcuts, bestie ๐ญ
๐ where do these files even live ๐
your .netdev files are read from:
- the system network directory
/usr/lib/systemd/networkand/usr/local/lib/systemd/network - the volatile runtime network directory
/run/systemd/network - the local administration network directory
/etc/systemd/network
all config files get collectively sorted and processed in alphanumeric order, no matter which directory they live in. but โ and this is the key part โ files with identical filenames replace each other ๐
it's recommended that every filename gets prefixed with a number smaller than "70" (like 10-vlan.netdev). why? because otherwise .netdev files generated by systemd-network-generator.service(8) might take precedence over your user configured files, and not on your watch โ
priority order, from most to least slay:
- files in
/etc/have the highest priority ๐ - files in
/run/take precedence over files with the same name in/usr/lib/
this is exactly how you override a system-supplied config file with a local one when you need to. it's giving "main character edits the defaults" energy โจ
and as a special case: an empty file (file size 0) or a symlink with the same name pointing to /dev/null disables the configuration file entirely. it is "masked". not deleted, just. silenced. the ultimate mute button ๐
๐ซถ drop-in directories, aka the glow-up ๐ซถ
alongside the netdev file foo.netdev, a "drop-in" directory foo.netdev.d/ may exist. every file with the suffix ".conf" from this directory gets merged in alphanumeric order and parsed after the main file itself has been parsed. this is useful to alter or add configuration settings without having to modify the main config file โ like adding accessories to an outfit instead of redoing the whole look ๐
every drop-in file must have appropriate section headers though, no freeloading.
in addition to /etc/systemd/network, drop-in .d directories can be placed in /usr/lib/systemd/network or /run/systemd/network. and the hierarchy is:
- drop-in files in
/etc/take precedence over those in/run/ - those in
/run/in turn take precedence over those in/usr/lib/ - drop-in files under any of these directories take precedence over the main netdev file, wherever that main file is located ๐
though fr: since/run/is temporary and/usr/lib/is for vendors, it's unlikely drop-ins should be used in either of those places. just saying. keep it in/etc/like a normal person ๐
๐ SUPPORTED NETDEV KINDS ๐
the following kinds of virtual network devices may be configured in .netdev files:
...and bestie, this list is long, so stay tuned โ more coming in the next part ๐โจ
bondโ a bond device is literally just an aggregation of all its slave devices ๐ช like a little friend group where everyone shows up as one. See the Linux Ethernet Bonding Driver HOWTO[1] for the whole lore.bridgeโ bestie this is a software switch โจ and every one of its slave devices plus the bridge itself are ports of that switch. Very main character, very connective.dummyโ a dummy device drops all packets sent to it. It's giving "I'm just here for the vibes" ๐ zero packets survive.greโ a Level 3 GRE tunnel over IPv4. Details live in RFC 2784[2]. And no cap: do not use the name"gre0", because the kernel makes a device with that exact name the moment the corresponding kernel module gets loaded ๐gretapโ a Level 2 GRE tunnel over IPv4. Same warning energy: don't use the name"gretap0", the kernel creates a device with this name when the corresponding kernel module is loaded ๐ซerspanโ ERSPAN mirrors traffic on one or more source ports and delivers that mirrored traffic to one or more destination ports on another switch. The traffic gets encapsulated in generic routing encapsulation (GRE), so it's routable across a layer 3 network between the source switch and the destination switch ๐ Also, avoid the name"erspan0"โ the kernel creates a device with this name when the corresponding kernel module is loaded, and then you're fighting the kernel and you will lose ๐ญip6greโ a Level 3 GRE tunnel over IPv6. That's it, that's the whole thing ๐ip6tnlโ an IPv4 or IPv6 tunnel over IPv6. Pick your fighter.ip6gretapโ a Level 2 GRE tunnel over IPv6 ๐ipipโ an IPv4 over IPv4 tunnel. Classic. Iconic. Ate.ipvlanโ an IPVLAN device is a stacked device which receives packets from its underlying device based on IP address filtering ๐งipvtapโ an IPVTAP device is a stacked device which receives packets from its underlying device based on IP address filtering and can be accessed using the tap user space interface ๐macvlanโ a macvlan device is a stacked device which receives packets from its underlying device based on MAC address filtering ๐macvtapโ a macvtap device is a stacked device which receives packets from its underlying device based on MAC address filtering. Same filter, different access vibe.sitโ an IPv6 over IPv4 tunnel ๐ฆtapโ a persistent Level 2 tunnel between a network device and a device node ๐tunโ a persistent Level 3 tunnel between a network device and a device node โญvethโ an Ethernet tunnel between a pair of network devices. They come as a pair, they're bonded for life fr fr ๐ซถvlanโ a VLAN is a stacked device which receives packets from its underlying device based on VLAN tagging. See IEEE 802.1Q[3] for details ๐ฅvtiโ an IPv4 over IPSec tunnel ๐vti6โ an IPv6 over IPSec tunnel ๐vxlanโ a virtual extensible LAN (vxlan), for connecting Cloud computing deployments โ๏ธgeneveโ a GEneric NEtwork Virtualization Encapsulation (GENEVE) netdev driver โจhsrโ a High-availability Seamless Redundancy (HSR) or Parallel Redundancy Protocol (PRP) interface. HSR and PRP are two protocols defined by the IEC 62439-3 standard, providing seamless failover against failure of any single network component. Basically the "nothing can stop us" of network setups ๐ชl2tpโ a Layer 2 Tunneling Protocol (L2TP) is a tunneling protocol used to support virtual private networks (VPNs) or as part of the delivery of services by ISPs. Heads up though: it does not provide any encryption or confidentiality by itself ๐ so don't be out here thinking it's a security layer, because it is not.macsecโ Media Access Control Security (MACsec) is an 802.1AE IEEE industry-standard security technology that provides secure communication for all traffic on Ethernet links. MACsec provides point-to-point security on Ethernet links between directly connected nodes and is capable of identifying and preventing most security threats ๐ก๏ธvrfโ a Virtual Routing and Forwarding (VRF[4]) interface to create separate routing and forwarding domains ๐ธvcanโ the virtual CAN driver (vcan). Similar to thevcanโ okay so this is a virtual CAN interface, right? Think of it like a network loopback device but for CAN โvcanoffers you a virtual local CAN interface ๐๐จvxcanโ the virtual CAN tunnel driver, bestie. It's giving veth but for CAN. Similar to the virtual ethernet driverveth,vxcanimplements a local CAN traffic tunnel between two virtual CAN network devices. When you create avxcan, twovxcandevices pop out as a pair ๐ฏ When one end receives the packet it appears on its pair, and vice versa. And thevxcancan be used for cross namespace communication โจwireguardโ WireGuard Secure Network Tunnel. That's it, that's the vibe ๐nlmonโ a Netlink monitor device. Use annlmondevice when you want to monitor system Netlink messages ๐fouโ Foo-over-UDP tunneling. Yeah. Foo. Over UDP. ๐xfrmโ a virtual tunnel interface likevti/vti6but with several advantages. Lowkey the glow-up version ๐ifbโ the Intermediate Functional Block (ifb) pseudo network interface, which acts as a QoS concentrator for multiple different sources of traffic ๐ฆbareudpโ Bare UDP tunnels provide a generic L3 encapsulation support for tunnelling different L3 protocols like MPLS, IP etc. inside of a UDP tunnel ๐ฆbatadvโ B.A.T.M.A.N. Advanced[5] is a routing protocol for multi-hop mobile ad-hoc networks which operates on layer 2 ๐ฆipoibโ an IP over Infiniband subinterface. Fancy ๐ซwlanโ a virtual wireless network (WLAN) interface ๐ก
โจ [MATCH] SECTION OPTIONS โจ
Okay so here's the tea: a virtual network device is only created if the [Match] section matches the current environment โ or if the section is just empty. Here are all the keys it accepts:
Host=โ matches against the hostname or machine ID of the host. SeeConditionHost=insystemd.unit(5)for the deets. When you prefix it with an exclamation mark ("!"), the result gets negated ๐ And if you assign an empty string, the previously assigned value is cleared.
Added in version 211.
Virtualization=โ checks whether the system is running inside a virtualized environment, and optionally tests whether it's a specific implementation. SeeConditionVirtualization=insystemd.unit(5)for details. Prefixed with an exclamation mark ("!") โ negated. Empty string โ previous value cleared.
Added in version 211.
KernelCommandLine=โ checks whether a specific kernel command line option is set. SeeConditionKernelCommandLine=insystemd.unit(5)for details. Exclamation mark ("!") prefix โ negated. Empty string โ previous value cleared.
Added in version 211.
KernelVersion=โ checks whether the kernel version (as reported byuname -r) matches a certain expression. SeeConditionKernelVersion=insystemd.unit(5)for details. Exclamation mark ("!") prefix โ negated. Empty string โ previous value cleared.
Added in version 237.
Version=โ checks whether a software version matches a certain expression. SeeConditionVersion=insystemd.unit(5)for details. Exclamation mark ("!") prefix โ negated. Empty string โ previous value cleared.
Added in version 258.
Credential=โ checks whether the specified credential was passed to thesystemd-udevd.serviceservice. See System and Service Credentials[6] for details. Exclamation mark ("!") prefix โ negated. Empty string โ previous value cleared.
Added in version 252.
Architecture=โ checks whether the system is running on a specific architecture. SeeConditionArchitecture=insystemd.unit(5)for details. Exclamation mark ("!") prefix โ negated. Empty string โ previous value cleared.
Added in version 211.
Firmware=โ checks whether the system is running on a machine with the specified firmware. SeeConditionFirmware=insystemd.unit(5)for details. Exclamation mark ("!") prefix โ negated. Empty string โ previous value cleared.
Added in version 249.
MachineTag=โ matches against the tags assigned to the local machine. SeeConditionMachineTag=insystemd.unit(5)for details. Exclamation mark ("!") prefix โ negated. Empty string โ previous value cleared.
Added in version 262.
๐ [NETDEV] SECTION OPTIONS ๐
The [NetDev] section accepts these keys, bestie:
Description=โ a free-form description of the netdev. Say whatever you want, it's your moment ๐
Added in version 215.
Name=โ the interface name used when creating the netdev. This setting is compulsory โ you literally cannot skip it ๐จ
Added in version 211.
Kind=โ the netdev kind. This setting is compulsory too. Check the "Supported netdev kinds" section for the valid keys.
Added in version 211.
MTUBytes=โ the maximum transmission unit in bytes to set for the device. The usual suffixesK,M,Gare supported and are understood to the base of 1024. For"tun"or"tap"devices, theMTUBytes=setting is not currently supported in the[NetDev]section ๐ญ Please specify it in the[Link]section of the correspondingsystemd.network(5)files instead.
Added in version 215.
MACAddress=โ specifies the MAC address to use for the device, or takes the special value"none". When it's"none",systemd-networkddoes not request the MAC address for the device, and the kernel will assign a random MAC address ๐ฒ For"tun","tap", or"l2tp"devices, theMACAddress=setting in the[NetDev]section is not supported and will be ignored โ please specify it in the[Link]section of the correspondingsystemd.network(5)file instead. If this option isn't set,"vlan"devices inherit the MAC address of the master interface. For other kinds of netdevs, if this option isn't set, then the MAC address is generated based on the interface name and themachine-id(5).
Heads up bestie ๐ even if you specify"none",systemd-udevdwill assign the persistent MAC address for the device, because99-default.linkhasMACAddressPolicy=persistent. So you also need to create a custom.linkfile for the device if you don't want the MAC address assignment happening at all. No cap.
Added in version 215.
๐ [BRIDGE] SECTION OPTIONS ๐
ok so this whole section? only does anything when your netdev is kind "bridge". otherwise she's just sitting there, unread. ๐
here's everything she accepts:
HelloTimeSec=โ how many seconds go by between two hello packets, the ones the root bridge and the designated bridges send out. hello packets are literally how the whole bridged LAN gossips about topology, so this is the heartbeat. (Added in version 227.)MaxAgeSec=โ the max message age, in seconds. if the last hello packet you saw is older than this, the bridge in question says "okay bestie i'm taking over" and starts the takeover procedure, trying to become the Root Bridge itself. (Added in version 227.)ForwardDelaySec=โ how many seconds get spent in each of the Listening and Learning states before it finally enters the Forwarding state. the waiting era. ๐ญ (Added in version 227.)AgeingTimeSec=โ how many seconds a MAC Address sticks around in the forwarding database after a packet came in from that MAC Address. it's giving memory-keeping. (Added in version 232.)Priority=โ the bridge's priority. an integer between0and65535. lower value = higher priority, which is so counterintuitive, but the bridge with the lowest priority gets elected as root bridge. ๐ (Added in version 232.)GroupForwardMask=โ a 16-bit bitmask, written as an integer, that lets you forward link local frames with 802.1D reserved addresses (01:80:C2:00:00:0X). here's the math: a logical AND happens between the bitmask you specify and2^X, whereXis the lower nibble of the last octet of the MAC address. so like, a value of8would allow forwarding of frames addressed to01:80:C2:00:00:03(that's 802.1X PAE). (Added in version 235.)DefaultPVID=โ the default port VLAN ID of a newly attached bridge port. set it to an integer in the range1...4094, or"none"to disable the PVID entirely. (Added in version 232.)MulticastQuerier=โ takes a boolean. controls theIFLA_BR_MCAST_QUERIERoption in the kernel. if enabled, the kernel sends general ICMP queries from a zero source address. this should allow faster convergence on startup, but it makes some multicast-aware switches misbehave and disrupt forwarding of multicast packets. ๐ when unset, the kernel's default gets used. (Added in version 230.)MulticastSnooping=โ takes a boolean. controls theIFLA_BR_MCAST_SNOOPINGoption in the kernel. if enabled, IGMP snooping monitors the Internet Group Management Protocol (IGMP) traffic between hosts and multicast routers. when unset, the kernel's default gets used. (Added in version 230.)VLANFiltering=โ takes a boolean. controls theIFLA_BR_VLAN_FILTERINGoption in the kernel. if enabled, the bridge starts up in VLAN-filtering mode. when unset, kernel's default. (Added in version 231.)VLANProtocol=โ lets you set the protocol used for VLAN filtering. takes802.1qor802.1ad, and defaults to unset, in which case the kernel's default is used. (Added in version 246.)STP=โ takes a boolean. this enables the bridge's Spanning Tree Protocol (STP). when unset, kernel's default. (Added in version 232.)MulticastIGMPVersion=โ lets you change the bridge's multicast Internet Group Management Protocol (IGMP) version. takes an integer,2or3. when unset, the kernel's default gets used. (Added in version 243.)FDBMaxLearned=โ the maximum number of learned Ethernet addresses for the bridge. once the limit is reached, no more addresses are learned. when unset, the kernel's default is used.0disables the limit. (Added in version 257.)LinkLocalLearning=โ takes a boolean. this enables learning source addresses from link local frames. when unset, the kernel's default gets used. (Added in version 258.)
๐ท๏ธ [VLAN] SECTION OPTIONS ๐ท๏ธ
this section is only for netdevs of kind "vlan". she accepts these:
Id=โ the VLAN ID to use. an integer in the range0...4094. and bestie, this setting is compulsory โ you literally cannot skip it. (Added in version 211.)Protocol=โ lets you set the protocol used for the VLAN interface. takes"802.1q"or"802.1ad", defaults to unset, and then the kernel's default is used. (Added in version 248.)GVRP=โ takes a boolean. the Generic VLAN Registration Protocol (GVRP) is a protocol that allows automatic learning of VLANs on a network. when unset, kernel's default. (Added in version 234.)MVRP=โ takes a boolean. Multiple VLAN Registration Protocol (MVRP), formerly known as GARP VLAN Registration Protocol (GVRP), is a standards-based Layer 2 network protocol for automatic configuration of VLAN information on switches. she was defined in the 802.1ak amendment to 802.1Q-2005. ๐ when unset, kernel's default. (Added in version 234.)LooseBinding=โ takes a boolean. this is the VLAN loose binding mode, where only the operational state gets passed from the parent to the associated VLANs, but the VLAN device state doesn't change. when unset, kernel's default. (Added in version 234.)ReorderHeader=โ takes a boolean. when enabled, the VLAN reorder header is used and VLAN interfaces behave like physical interfaces. iconic. when unset, kernel's default. (Added in version 234.)EgressQOSMaps=,IngressQOSMaps=โ defines a mapping of Linux internal packet priority (SO_PRIORITY) to the VLAN header PCP field, for outgoing and incoming frames respectively. takes a whitespace-separated list of integer pairs, where each integer has to be in the range1...4294967294, formatted as"from"-"to", e.g."21-7 45-5". ๐ note that"from"must be greater than or equal to"to". when unset, the kernel's default gets used. (Added in version 248.)
๐ [MACVLAN] SECTION OPTIONS ๐
[MACVLAN] is only for netdevs of kind "macvlan", and she accepts this:
Mode=โ the MACVLAN mode to use. the supported options are"private","vepa","bridge","passthru", and"source". (Added in version 211.)SourceMACAddress=โ a whitespace-separated list of remote hardware addresses allowed on the MACVLAN. heads up: this option only does anything in source mode. use full colon-, hyphen- or dot-delimited hexadecimal. this option may appear more than once, in which case the lists are merged. if you assign the empty string to this option, the list of hardware addresses defined before this point gets reset. defaults to unset. (Added in version 246.)BroadcastMulticastQueueLength=โ the length of the receive queue for broadcast/multicast packets. an unsigned integer in the range0...4294967294. defaults to unset. (Added in version 248.)BroadcastQueueThreshold=โ controls the threshold for broadcast queueing of the macvlan device. takes the special value"no", or an integer in the range0...2147483647. when"no"is specified, broadcast queueing is disabled altogether. when an integer is specified, a multicast address will be queued as broadcast if the number of devices using the macvlan is greater than the given value. defaults to unset, and the kernel default gets used. (Added in version 256.)
๐ฆ [MACVTAP] SECTION OPTIONS ๐ฆ
[MACVTAP] applies for netdevs of kind "macvtap", and it accepts the exact same keys as [MACVLAN]. no new lore, just a rebrand. โจ
๐ธ [IPVLAN] SECTION OPTIONS ๐ธ
[IPVLAN] is only for netdevs of kind "ipvlan", and accepts this:
Mode=โ the IPVLAN mode to use. the supported options are"L2","L3"and"L3S". (Added in version 219.)Flags=โ the IPVLAN flags to use. the supported options are"bridge","private"and"vepa". (Added in version 237.)
๐ง [IPVTAP] SECTION OPTIONS ๐ง
[IPVTAP] is only for netdevs of kind "ipvtap", and it accepts the same keys as [IPVLAN]. again: same vibe, different name. ๐
๐ฆ [VXLAN] SECTION OPTIONS ๐ฆ
Bestie, the [VXLAN] section is only for netdevs of kind "vxlan" โ like, it does not care about anything else. And here's everything it eats:
VNI=โ the VXLAN Network Identifier (aka the VXLAN Segment ID, same thing, iconic). Takes a number in the range1...16777215. It gets ignored ifExternal=is set totrue. Added in version 243.Remote=โ sets up the destination IP address. That's it, that's the job. Added in version 233.Local=โ sets up the local IP address. It has to be an address on the underlying interface of the VXLAN interface, or one of these special values:"ipv4_link_local","ipv6_link_local","dhcp4","dhcp6", and"slaac". If you pick one of the special ones, an address matching that type on the underlying interface gets used. Defaults to unset. Added in version 233.Group=โ sets the VXLAN multicast group IP address. Heads up: every member of a VXLAN has to use the same multicast group address, no exceptions. Added in version 243.TOS=โ the Type Of Service byte value for a vxlan interface. Added in version 215.TTL=โ a fixed Time To Live N on Virtual eXtensible Local Area Network packets. Takes"inherit"or a number in the range0...255.0is a special value meaning inherit the inner protocol's TTL value, and"inherit"means it'll inherit the outer protocol's TTL value. Added in version 215.MacLearning=โ takes a boolean. Whentrue, it enables dynamic MAC learning so remote MAC addresses get discovered. Added in version 215.FDBAgeingSec=โ the lifetime of a Forwarding Database entry learnt by the kernel, in seconds. Added in version 218.MaximumFDBEntries=โ sets the maximum number of FDB entries. Added in version 228.ReduceARPProxy=โ takes a boolean. Whentrue, a bridge-connected VXLAN tunnel endpoint answers ARP requests from the local bridge on behalf of remote Distributed Overlay Virtual Ethernet (DOVE)[7] clients. Defaults tofalse. Added in version 233.L2MissNotification=โ takes a boolean. Whentrue, it enables netlink LLADDR miss notifications. Added in version 218.L3MissNotification=โ takes a boolean. Whentrue, it enables netlink IP address miss notifications. Added in version 218.RouteShortCircuit=โ takes a boolean. Whentrue, route short circuiting is turned on. Added in version 218.UDPChecksum=โ takes a boolean. Whentrue, transmitting UDP checksums when doing VXLAN/IPv4 is turned on. Added in version 220.UDP6ZeroChecksumTx=โ takes a boolean. Whentrue, sending zero checksums in VXLAN/IPv6 is turned on. Added in version 220.UDP6ZeroChecksumRx=โ takes a boolean. Whentrue, receiving zero checksums in VXLAN/IPv6 is turned on. Added in version 220.RemoteChecksumTx=โ takes a boolean. Whentrue, remote transmit checksum offload of VXLAN is turned on. Added in version 232.RemoteChecksumRx=โ takes a boolean. Whentrue, remote receive checksum offload in VXLAN is turned on. Added in version 232.GroupPolicyExtension=โ takes a boolean. Whentrue, it enables the Group Policy VXLAN extension security label mechanism across network peers based on VXLAN. For the deets on Group Policy VXLAN, go peek at the VXLAN Group Policy[8] document. Defaults tofalse. Added in version 224.GenericProtocolExtension=โ takes a boolean. Whentrue, Generic Protocol Extension extends the existing VXLAN protocol to give you protocol typing, OAM, and versioning capabilities. For the deets on the VXLAN GPE Header, go peek at the Generic Protocol Extension for VXLAN[9] document. If the destination port isn't specified and Generic Protocol Extension is set, the default port of4790gets used. Defaults tofalse. Added in version 243.DestinationPort=โ sets the default destination UDP port. If the destination port isn't specified, the Linux kernel default gets used. Set it to4789to get the IANA assigned value. Added in version 229.PortRange=โ sets the source port range for the VXLAN. The kernel assigns the source UDP port based on the flow, which helps the receiver do load balancing. When this option isn't set, the normal range of local UDP ports is used. Added in version 229.FlowLabel=โ specifies the flow label to use in outgoing packets. The valid range is0-1048575. Added in version 234.IPDoNotFragment=โ lets you set the IPv4 Do not Fragment (DF) bit in outgoing packets, or inherit its value from the IPv4 inner header. Takes a boolean value, or"inherit". Set it to"inherit"if the encapsulated protocol is IPv6. When it's unset, the kernel's default gets used. Added in version 243.Independent=โ takes a boolean. Whentrue, the vxlan interface gets created without any underlying network interface. Defaults tofalse, which means a.networkfile that requests this VXLAN interface usingVXLAN=is required for the VXLAN to be created. Added in version 247.External=โ takes a boolean. Whentrue, the vxlan interface is externally controlled, like by an EVPN control plane or whatever. Defaults tofalse. Added in version 258.VNIFilter=โ takes a boolean. Whentrue, the interface is capable of filtering VNI filtering. It gets ignored ifExternal=is set tofalse. Defaults tofalse. Added in version 258.
๐ธ [GENEVE] SECTION OPTIONS ๐ธ
The [GENEVE] section is only for netdevs of kind "geneve", and it accepts these keys, bestie:
Id=โ specifies the Virtual Network Identifier (VNI) to use, a number between0and16777215. This field is mandatory, so don't skip it. Added in version 234.Remote=โ specifies the unicast destination IP address to use in outgoing packets. Added in version 234.TOS=โ specifies the TOS value to use in outgoing packets. Takes a number between1and255. Added in version 234.TTL=โ accepts the same values as in the[VXLAN]section, except that when unset or set to0, the kernel's default gets used, meaning the packet TTL will be set from/proc/sys/net/ipv4/ip_default_ttl. Added in version 234.UDPChecksum=โ takes a boolean. Whentrue, it specifies that the UDP checksum is calculated for transmitted packets over IPv4. Added in version 234.UDP6ZeroChecksumTx=โ takes a boolean. Whentrue, skip UDP checksum calculation for transmitted packets over IPv6. Added in version 234.UDP6ZeroChecksumRx=โ takes a boolean. Whentrue, it allows incoming UDP packets over IPv6 with a zero checksum field. Added in version 234.DestinationPort=โ specifies the destination port. Defaults to6081. If it's not set or assigned the empty string, the default port of6081is used. Added in version 234.FlowLabel=โ specifies the flow label to use in outgoing packets. Added in version 234.IPDoNotFragment=โ accepts the same key as in the[VXLAN]section. Added in version 243.InheritInnerProtocol=โ takes a boolean. Whentrue, the inner Layer 3 protocol is set as Protocol Type in the GENEVE header instead of Ethernet. Defaults tofalse. Added in version 254.
๐ [HSR] SECTION OPTIONS ๐
The [HSR] section is only for netdevs of kind "hsr", and it accepts these keys:
Ports=โ specifies the underlying interfaces. This field is mandatory and it must contain exactly two interface names separated by a space. This option can be specified multiple times, which means these two cases below give you the same result, no cap:
Ports=eth1 eth2
Ports=eth1
Ports=eth2
All the previous assignments get cleared when you specify an empty string. Added in version 258.
Protocol=โ specifies the protocol used by the interface. Takes one of"hsr"or"prp". Defaults to"hsr".
Okay so both protocols work by sending two copies of every outgoing frame, one for each of the two ports. The destination node receives both frames and keeps only the first one. If a link fails, only one of the two frames gets received. HSR uses a ring topology where the two outgoing frames are sent in opposite directions in the ring. PRP doesn't need a specific topology, but it requires two completely redundant networks attached to the two ports. Added in version 258.
Supervision=โ specifies the last byte of the destination MAC address of supervision frames. Takes a number between0and255. Defaults to0. Supervision frames are what the HSR and PRP protocols use to monitor the integrity of the network and the presence of nodes. The first 5 bytes of the destination MAC are always01:15:4E:00:01while the last byte is configurable. Added in version 258.
โจ [BAREUDP] SECTION OPTIONS โจ
The [BareUDP] section is only for netdevs of kind "bareudp", and it accepts these keys:
DestinationPort=โ specifies the destination UDP port (in range1...65535). This is mandatory. Added in version 247.EtherType=โ specifies the L3 protocol. Takes one of"ipv4","ipv6","mpls-uc"or"mpls-mc". This is mandatory. Added in version 247.MinSourcePort=โ specifies the lowest value of the UDP tunnel source port (in range1...65535). Defaults to unset. Added in version 257.
โจ [L2TP] SECTION OPTIONS โจ
Okay bestie, this section is only for netdevs of kind "l2tp", and it takes these keys ๐
TunnelId=โ the tunnel identifier, bestie. Give it a number from1...4294967295. Heads up: whatever you put here has to match the"PeerTunnelId="value on the other side, no cap. This setting is compulsory โ you literally cannot skip it. ๐ซถ
Added in version 242.
PeerTunnelId=โ the peer's tunnel id. Number in the range1...4294967295. And yeah, this one has to match the"TunnelId="value the peer is using. Also compulsory. ๐
Added in version 242.
Remote=โ the IP address of the remote peer. Yep, compulsory too. โจ
Added in version 242.
Local=โ the IP address of a local interface. It takes an IP address, or one of the special values"auto","static", or"dynamic". You can also tack on the name of a local interface after an"@", like"192.168.0.1@eth0"or"auto@eth0". When you give an actual address, then a local or specified interface has to have that address, and the remote address has to be reachable through it. If it's"auto", then one of the addresses on a local or specified interface that's reachable from the remote address gets used. Same energy for"static"or"dynamic"โ one of the static or dynamic addresses gets used. Defaults to"auto". ๐ฆ
Added in version 242.
EncapsulationType=โ the encapsulation type of the tunnel. Takes either"udp"or"ip". Pick your fighter. ๐
Added in version 242.
UDPSourcePort=โ the UDP source port for the tunnel. When UDP encapsulation is selected, this is mandatory. If IP encapsulation is selected, it's ignored, periodt. ๐
Added in version 242.
UDPDestinationPort=โ destination port. When UDP encapsulation is selected it's mandatory. Ignored when IP encapsulation is selected. ๐
Added in version 245.
UDPChecksum=โ takes a boolean. When true, it means the UDP checksum gets calculated for transmitted packets over IPv4. ๐ฅ
Added in version 242.
UDP6ChecksumTx=โ takes a boolean. When true, skip the UDP checksum calculation for transmitted packets over IPv6. Iconic shortcut behaviour. โจ
Added in version 242.
UDP6ChecksumRx=โ takes a boolean. When true, it allows incoming UDP packets over IPv6 that have a zero checksum field. ๐
Added in version 242.
โจ [L2TPSESSION] SECTION OPTIONS โจ
Again, only for netdevs of kind "l2tp", and here's what it accepts:
Name=โ the name of the session. Compulsory, obviously. ๐
Added in version 242.
SessionId=โ the session identifier. Number in the range1...4294967295. Must match the"SessionId="value on the peer. Compulsory โ no skipping. ๐ญ
Added in version 242.
PeerSessionId=โ the peer session identifier. Number in the range1...4294967295. Must match the"PeerSessionId="value on the peer. Also compulsory. Yes, again. It's giving symmetry. ๐
Added in version 242.
Layer2SpecificHeader=โ the layer 2 specific header type of the session. One of"none"or"default". Defaults to"default". ๐
Added in version 242.
โจ [MACSEC] SECTION OPTIONS โจ
This one is only for network devices of kind "macsec". Keys below, bestie ๐ซถ
Port=โ the port used for the MACsec transmit channel. The port is what makes the secure channel identifier (SCI). Takes a value between1and65535. Defaults to unset. ๐ฆ
Added in version 243.
Encrypt=โ takes a boolean. When true, encryption is enabled. Defaults to unset. ๐ฅ
Added in version 243.
โจ [MACSECRECEIVECHANNEL] SECTION OPTIONS โจ
Only for network devices of kind "macsec", as always ๐
Port=โ the port used for the MACsec receive channel. The port is used to make the secure channel identifier (SCI). Takes a value between1and65535. This option is compulsory, and it is not set by default. ๐
Added in version 243.
MACAddress=โ the MAC address used for the MACsec receive channel. The MAC address is used to make the secure channel identifier (SCI). This setting is compulsory, and it is not set by default. ๐
Added in version 243.
โจ [MACSECTRANSMITASSOCIATION] SECTION OPTIONS โจ
Yep, "macsec" again. Here's the tea โ
PacketNumber=โ the packet number used for replay protection and for constructing the initialization vector (along with the secure channel identifier [SCI]). Takes a value between1-4,294,967,295. Defaults to unset. โจ
Added in version 243.
KeyId=โ the identification for the key. Takes a number between0-255. This option is compulsory, and it is not set by default. ๐ญ
Added in version 243.
Key=โ the encryption key used in the transmission channel. The same key has to be configured on the peer's matching receive channel. This setting is compulsory, and it is not set by default. It takes a 128-bit key encoded as a hexadecimal string, for example"dffafc8d7b9a43d5b9a3dfbbf6a30c16". ๐
Added in version 243.
KeyFile=โ takes an absolute path to a file containing a 128-bit key encoded in a hexadecimal string, which will be used in the transmission channel. When this option is specified,Key=is ignored. Important: the file has to be readable by the user"systemd-network", so it should be, e.g., owned by"root:systemd-network"with a"0640"file mode. And if the path refers to anAF_UNIXstream socket in the file system, a connection is made to it and the key is read from it. ๐ง
Added in version 243.
Activate=โ takes a boolean. If enabled, then the security association is activated. Defaults to unset. ๐
Added in version 243.
UseForEncoding=โ takes a boolean. If enabled, then the security association is used for encoding. Only one[MACsecTransmitAssociation]section can enable this option. When it's enabled,Activate=yesis implied. Defaults to unset. ๐
Added in version 243.
โจ [MACSECRECEIVEASSOCIATION] SECTION OPTIONS โจ
Still "macsec", still iconic ๐
Port=โ accepts the same key as in the[MACsecReceiveChannel]section. ๐
Added in version 243.
MACAddress=โ accepts the same key as in the[MACsecReceiveChannel]section. ๐
Added in version 243.
PacketNumber=โ accepts the same key as in the[MACsecTransmitAssociation]section. โจ
Added in version 243.
KeyId=โ accepts the same key as in the[MACsecTransmitAssociation]section. ๐ฅ
Added in version 243.
Key=โ accepts the same key as in the[MACsecTransmitAssociation]section. ๐ซถ
Added in version 243.
KeyFile=โ accepts the same key as in the[MACsecTransmitAssociation]section. ๐ฆ
Added in version 243.
Activate=โ accepts the same key as in the[MACsecTransmitAssociation]section. ๐
Added in version 243.
โจ [TUNNEL] SECTION OPTIONS โจ
okay bestie, real talk ๐ โ this [Tunnel] section is exclusive. It only applies for netdevs of kind "ipip", "sit", "gre", "gretap", "ip6gre", "ip6gretap", "vti", "vti6", "ip6tnl", and "erspan". That's the guest list, no plus-ones ๐ธ. And it accepts the following keys:
External=โ takes a boolean. When true, the tunnel is externally controlled (which the cool kids also call collect metadata mode), and most of the settings down below โ likeLocal=orRemote=โ get straight up ignored ๐. This impliesIndependent=. Defaults tofalse.
๐ Added in version 251.
Local=โ a static local address for tunneled packets. It has to be an address on another interface of this host, or one of the special values"any","ipv4_link_local","ipv6_link_local","dhcp4","dhcp6","dhcp_pd", and"slaac". If you pick one of the special values (any of them except"any"), then an address matching that corresponding type on the underlying interface gets used. Defaults to"any".
๐ Added in version 215.
Remote=โ the remote endpoint of the tunnel. Takes an IP address, or the special value"any".
๐ Added in version 215.
TOS=โ the Type Of Service byte value for a tunnel interface. Wanna know the deets on TOS? Go look at Type of Service in the Internet Protocol Suite<sup>[10]</sup>.
๐ Added in version 215.
TTL=โ a fixed Time To Live N on tunneled packets. N is a number in the range1...255. And0is the special little guy meaning packets inherit the TTL value. The default for IPv4 tunnels is0(inherit ๐ซถ). The default for IPv6 tunnels is64.
๐ Added in version 215.
DiscoverPathMTU=โ takes a boolean. When true, it enables Path MTU Discovery on the tunnel. WhenIgnoreDontFragment=is enabled, this defaults tofalse. Otherwise it defaults totrue.
๐ Added in version 215.
IgnoreDontFragment=โ takes a boolean. When true, it enables IPv4 Don't Fragment (DF) suppression on the tunnel. Defaults tofalse. Heads up bestie: ifIgnoreDontFragment=is set to true, thenDiscoverPathMTU=cannot be set to true. Also this is only applicable to GRE, GRETAP, and ERSPAN tunnels ๐ .
๐ Added in version 254.
IPv6FlowLabel=โ configures the 20-bit flow label field (see RFC 6437<sup>[11]</sup>) in the IPv6 header (see RFC 2460<sup>[12]</sup>), which a node uses to label packets of a flow. It's only used for IPv6 tunnels. A flow label of zero is used to indicate packets that haven't been labeled. You can set it to a value in the range0...0xFFFFF, or set it to"inherit", in which case the original flowlabel is used ๐.
๐ Added in version 223.
CopyDSCP=โ takes a boolean. When true, the Differentiated Service Code Point (DSCP) field gets copied to the inner header from the outer header during decapsulation of an IPv6 tunnel packet. DSCP is a field in an IP packet that lets different levels of service be assigned to network traffic. Defaults to"no".
๐ Added in version 223.
EncapsulationLimit=โ the Tunnel Encapsulation Limit option specifies how many additional levels of encapsulation are permitted to be prepended to the packet. Like, a Tunnel Encapsulation Limit option holding a limit value of zero means that a packet carrying that option may not enter another tunnel before exiting the current one (see RFC 2473<sup>[13]</sup>). The valid range is0...255and"none". Defaults to4.
๐ Added in version 226.
Key=โ specifies the same key to use in both directions (so like,InputKey=andOutputKey=at the same time, slay ๐ ). TheKey=is either a number or an IPv4 address-like dotted quad. It's used as a mark-configured SAD/SPD entry as part of the lookup key (both in data and control path) in IP XFRM (the framework used to implement the IPsec protocol). See ip-xfrm โ transform configuration<sup>[14]</sup> for the details. Only used for VTI/VTI6, GRE, GRETAP, and ERSPAN tunnels.
๐ Added in version 231.
InputKey=โ specifies the key to use for input. Same format asKey=. Only used for VTI/VTI6, GRE, GRETAP, and ERSPAN tunnels.
๐ Added in version 231.
OutputKey=โ specifies the key to use for output. Same format asKey=. Only used for VTI/VTI6, GRE, GRETAP, and ERSPAN tunnels.
๐ Added in version 231.
Mode=โ specifies the tunnel mode. Which values are acceptable depends on the tunnel kind ๐.
๐ Table 2. Supported tunnel modes ๐
- kind
"ipip":"ipip"โ IPv4 over IPv4 (default)"any"โ both IPv4 and IPv6 over IPv4
- kind
"sit":"ipip"โ IPv4 over IPv4"ip6ip"โ IPv6 over IPv4 (default)"any"โ both IPv4 and IPv6 over IPv4
- kind
"ip6tnl":"ipip6"โ IPv4 over IPv6"ip6ip6"โ IPv6 over IPv6"any"โ both IPv4 and IPv6 over IPv6 (default)
๐ Added in version 219.
Independent=โ takes a boolean. Whenfalse(which is the default), the tunnel is always created over some network device, and you need a.networkfile that requests this tunnel usingTunnel=for the tunnel to even exist. Whentrue, the tunnel is created independently of any network, as"tunnel@NONE"โจ.
๐ Added in version 235.
AssignToLoopback=โ takes a boolean. If set to"yes", the loopback interface"lo"is used as the underlying device of the tunnel interface. Defaults to"no".
๐ Added in version 243.
AllowLocalRemote=โ takes a boolean. When true, it allows tunnel traffic onip6tnldevices where the remote endpoint is a local host address. When unset, the kernel's default gets used.
๐ Added in version 237.
FooOverUDP=โ takes a boolean. Specifies whether aFooOverUDP=tunnel is to be configured. Defaults tofalse. This only takes effect for IPIP, SIT, GRE, and GRETAP tunnels. For more detail information, see Foo over UDP<sup>[15]</sup>.
๐ Added in version 240.
FOUDestinationPort=โ this setting specifies the UDP destination port for encapsulation. This field is mandatory whenFooOverUDP=yes, and it is not set by default ๐ซ .
๐ Added in version 240.
FOUSourcePort=โ this setting specifies the UDP source port for encapsulation. Defaults to0โ meaning the source port for packets is left to the network stack to decide. Very "you handle it bestie" of it ๐ .
๐ Added in version 240.
Encapsulation=โ accepts the same key as in the[FooOverUDP]section.
๐ Added in version 240.
IPv6RapidDeploymentPrefix=โ reconfigures the tunnel for IPv6 Rapid Deployment<sup>[16]</sup>, also known as 6rd. The value is an ISP-specific IPv6 prefix with a non-zero length. Only applicable to SIT tunnels.
๐ Added in version 240.
ISATAP=โ takes a boolean. If set, it configures the tunnel as an Intra-Site Automatic Tunnel Addressing Protocol (ISATAP) tunnel. Only applicable to SIT tunnels. When unset, the kernel's default gets used.
๐ Added in version 240.
SerializeTunneledPackets=โ takes a boolean. If set toyes, then packets are serialized. Only applies for GRE, GRETAP, and ERSPAN tunnels. When unset, the kernel's default gets used.
๐ Added in version 240.
ERSPANVersion=โ specifies the ERSPAN version number. Takes0for version 0 (a.k.a. type I),1for version 1 (a.k.a. type II), or2for version 2 (a.k.a. type III). Defaults to1.
๐ Added in version 252.
ERSPANIndex=โ specifies the ERSPAN v1 index field for the interface. Takes an integer in the range0...1048575, which is associated with the ERSPAN traffic's source port and direction. Only used whenERSPANVersion=1. Defaults to0.
๐ Added in version 240.
ERSPANDirection=โ specifies the ERSPAN v2 mirrored traffic's direction. Takes"ingress"or"egress". Only used whenERSPANVersion=2. Defaults to"ingress".
๐ Added in version 252.
ERSPANHardwareId=โ specifies a unique identifier of the ERSPAN v2 engine. Takes an integer in the range0...63. Only used whenERSPANVersion=2. Defaults to0.
๐ Added in version 252.
โจ [FOOOVERUDP] SECTION OPTIONS โจ
Okay so the [FooOverUDP] section? It only applies to netdevs of kind "fou", and it takes these keys ๐
Encapsulation=โ picks the encapsulation mechanism used to stash networking packets from all sorts of protocols inside UDP packets. The accepted values are:"FooOverUDP", which is literally the no-frills, simplest model of UDP encapsulation โ it just drops packets straight into the UDP payload, no thoughts, head empty ๐ซถ. And"GenericUDPEncapsulation", which is the generic, extensible one: it lets you encapsulate packets for any IP protocol plus optional data as part of the encapsulation. For more detailed information see Generic UDP Encapsulation[17]. Defaults to"FooOverUDP".
Added in version 240.
Port=โ the port number where the encapsulated packets will arrive. Those packets get removed and manually fed back into the network stack with the encapsulation stripped off, so they can be sent to the real destination. This option is mandatory, bestie, no skipping it ๐
Added in version 240.
PeerPort=โ the peer port number. Defaults to unset. Note that when peer port is set,Peer=address is mandatory.
Added in version 243.
Protocol=โ specifies the protocol number of the packets arriving at the UDP port. WhenEncapsulation=FooOverUDP, this field is mandatory and is not set by default. It takes an IP protocol name such as"gre"or"ipip", or an integer within the range1...255. WhenEncapsulation=GenericUDPEncapsulation, this must not be specified. (Iconic duality honestly.)
Added in version 240.
Peer=โ configures the peer IP address. Note that when peer address is set,PeerPort=is mandatory.
Added in version 243.
Local=โ configures the local IP address.
Added in version 243.
๐ [PEER] SECTION OPTIONS ๐
The [Peer] section only applies for netdevs of kind "veth" and accepts the following keys:
Name=โ the interface name used when creating the netdev. This setting is compulsory. Non-negotiable, fr fr.
Added in version 215.
MACAddress=โ the peer MACAddress. If it's not set, it gets generated in exactly the same way as the MAC address of the main interface.
Added in version 215.
๐ฆ [VXCAN] SECTION OPTIONS ๐ฆ
The [VXCAN] section only applies for netdevs of kind "vxcan" and accepts this one key:
Peer=โ the peer interface name used when creating the netdev. This setting is compulsory.
Added in version 236.
๐ธ [TUN] SECTION OPTIONS ๐ธ
The [Tun] section only applies for netdevs of kind "tun", and it accepts these keys:
MultiQueue=โ takes a boolean. Configures whether to use multiple file descriptors (queues) to parallelize packets sending and receiving. Defaults to"no".
Added in version 215.
PacketInfo=โ takes a boolean. Configures whether packets should be prepended with four extra bytes (two flag bytes and two protocol bytes). If disabled, it indicates that the packets will be pure IP packets. Defaults to"no".
Added in version 215.
VNetHeader=โ takes a boolean. Configures theIFF_VNET_HDRflag for a tun or tap device. It allows sending and receiving larger Generic Segmentation Offload (GSO) packets. This may increase throughput significantly ๐ฅ. Defaults to"no".
Added in version 223.
User=โ user to grant access to the/dev/net/tundevice. Note that the user must be resolvable during early boot. Using non-system users is deprecated.
Added in version 215.
Group=โ group to grant access to the/dev/net/tundevice. Note that the group must be resolvable during early boot. Using non-system groups is deprecated.
Added in version 215.
KeepCarrier=โ takes a boolean. If enabled, to make the interface maintain its carrier status, the file descriptor of the interface is kept open. This may be useful to keep the interface in running state, for example while the backing process is temporarily shutdown. Defaults to"no".
Added in version 252.
๐ง [TAP] SECTION OPTIONS ๐ง
The [Tap] section only applies for netdevs of kind "tap", and it accepts the same keys as the [Tun] section. That's it, that's the whole section, she's a copycat and we love her for it ๐
๐ [WIREGUARD] SECTION OPTIONS ๐
The [WireGuard] section accepts the following keys:
PrivateKey=โ the Base64 encoded private key for the interface. You can generate it with thewg genkeycommand (seewg(8)). Specially, if the specified key is prefixed with"@", it is interpreted as the name of the credential from which the actual key shall be read.systemd-networkd.service(8)automatically imports credentials matching"network.wireguard.*". For more details on credentials, refer tosystemd.exec(5). A private key is mandatory to use WireGuard. If not set, the credential"network.wireguard.private.netdev"is used if exists. I.e. for50-foobar.netdev,"network.wireguard.private.50-foobar"is tried.
Note that because this information is secret, it is strongly recommended to use an (encrypted) credential. Alternatively, you may want to set the permissions of the.netdevfile to be owned by"root:systemd-network"with a"0640"file mode. Protect your secrets bestie, no leaking ๐ญ๐
Added in version 237.
PrivateKeyFile=โ takes an absolute path to a file which contains the Base64 encoded private key for the interface. When this option is specified, thenPrivateKey=is ignored. Note that the file must be readable by the user"systemd-network", so it should be, e.g., owned by"root:systemd-network"with a"0640"file mode. If the path refers to anAF_UNIXstream socket in the file system a connection is made to it and the key read from it.
Added in version 242.
ListenPort=โ sets the UDP port for listening. Takes either a value between 1 and 65535 or"auto". If"auto"is specified, the port is automatically generated based on interface name. Defaults to"auto".
Added in version 237.
FirewallMark=โ sets a firewall mark on outgoing WireGuard packets from this interface. Takes a number between 1 and 4294967295.
Added in version 243.
RouteTable=โ the table identifier for the routes to the addresses specified in theAllowedIPs=. Takes a negative boolean value, one of the predefined names"default","main", and"local", names defined inRouteTable=innetworkd.conf(5), or a number in the range1...4294967295. When"off"the routes to the addresses specified in theAllowedIPs=setting will not be configured. Defaults to false. This setting will be ignored when the same setting is specified in the[WireGuardPeer]section.
Added in version 250.
RouteMetric=โ the priority of the routes to the addresses specified in theAllowedIPs=. Takes an integer in the range0...4294967295. Defaults to 0 for IPv4 addresses, and 1024 for IPv6 addresses. This setting will be ignored when the same setting is specified in the[WireGuardPeer]section.
Added in version 250.
๐ซ [WIREGUARDPEER] SECTION OPTIONS ๐ซ
okay so this is where you set up your peers โ the other WireGuard homies your tunnel is gonna talk to. The [WireGuardPeer] section accepts the following keys, and bestie, there's a lot of tea here so let's go ๐ซโจ
PublicKey=โ drops a Base64 encoded public key, the kind you get from runningwg pubkey(peepwg(8)) on a private key, and it's usually handed over out-of-band to whoever's writing the config file. This option honors the"@"prefix the exact same wayPrivateKey=does over in the[WireGuard]section. This one is mandatory for this section โ no key, no peer, periodt. ๐
Added in version 237.
PublicKeyFile=โ takes an absolute path to a file holding the Base64 encoded public key for the peer. When this is set,PublicKey=gets ignored. Heads up: the file has to be readable by the"systemd-network"user, so like, make it owned by"root:systemd-network"with a"0640"file mode. And if the path points at anAF_UNIXstream socket in the file system, it makes a connection to it and reads the key straight from there. ๐ง
Added in version 257.
PresharedKey=โ an optional preshared key for the interface, and you can generate it with thewg genpskcommand. This adds a whole extra layer of symmetric-key cryptography mixed into the public-key cryptography you already have, for post-quantum resistance. It honors the"@"prefix the same wayPrivateKey=does in the[WireGuard]section.
okay so because this info is secret, it's strongly recommended to use an (encrypted) credential. Or alternatively, you can set the permissions of the.netdevfile to be owned by"root:systemd-network"with a"0640"file mode. ๐
Added in version 237.
PresharedKeyFile=โ takes an absolute path to a file holding the Base64 encoded preshared key for the peer. When this is set,PresharedKey=gets ignored. Same deal as above: the file must be readable by the"systemd-network"user, so make it owned by"root:systemd-network"with a"0640"file mode. And if the path refers to anAF_UNIXstream socket in the file system, it connects to it and reads the key from there. ๐
Added in version 242.
AllowedIPs=โ sets a comma-separated list of IP (v4 or v6) addresses with CIDR masks from which this peer is allowed to send incoming traffic, and to which outgoing traffic for this peer is directed. You can specify this setting multiple times. If you assign an empty string, then all previous assignments get cleared. ๐งน
The catch-all 0.0.0.0/0 matches all IPv4 addresses, and ::/0 matches all IPv6 addresses.
ngl this only affects routing inside the network interface itself, i.e. the packets that pass through the tunnel itself. To actually make packets get sent via the tunnel in the first place, you also need to add an appropriate route โ either in the"[Routes]"section on the".network"matching the wireguard interface, or externally tosystemd-networkd. ๐
Added in version 237.
Endpoint=โ sets an endpoint IP address or hostname, then a colon, then a port number. IPv6 addresses have to go in square brackets. For example,"111.222.333.444:51820"for IPv4 and"[1111:2222::3333]:51820"for an IPv6 address. This endpoint gets updated automatically once to the most recent source IP address and port of correctly authenticated packets from the peer, at configuration time. โจ
This option honors the "@" prefix in the same way as the PrivateKey= setting of the [WireGuard] section.
Added in version 237.
PersistentKeepalive=โ sets a seconds interval, between1and65535inclusive, of how often to send an authenticated empty packet to the peer, for the purpose of keeping a stateful firewall or NAT mapping valid persistently. Like, for example, if the interface very rarely sends traffic but it might receive traffic from a peer at any time, and it's behind NAT, the interface might benefit from having a persistent keepalive interval of25seconds. If set to0or"off", this option is disabled. By default, or when unspecified, it's off. Most users will not need this, fr fr. ๐
Added in version 237.
RouteTable=โ the table identifier for the routes to the addresses specified inAllowedIPs=. Takes a negative boolean value, one of the predefined names"default","main", and"local", names defined inRouteTable=innetworkd.conf(5), or a number in the range1...4294967295. Defaults to unset, and the value specified in the same setting in the[WireGuard]section will be used. ๐ฆ
Added in version 250.
RouteMetric=โ the priority of the routes to the addresses specified inAllowedIPs=. Takes an integer in the range0...4294967295. Defaults to unset, and the value specified in the same setting in the[WireGuard]section will be used. ๐ธ
Added in version 250.
๐ [BOND] SECTION OPTIONS ๐
okay so the [Bond] section is where you build your lil link-aggregation bestie, and it accepts the following key:
Mode=โ picks your bonding policy, i.e. the whole personality of the bond. Default is"balance-rr"(round robin, the classic). The possible values are"balance-rr","active-backup","balance-xor","broadcast","802.3ad","balance-tlb", and"balance-alb".
Added in version 216.
TransmitHashPolicy=โ chooses the transmit hash policy used for slave selection inbalance-xor,802.3ad, andtlbmodes. Possible values are"layer2","layer3+4","layer2+3","encap2+3", and"encap3+4".
Added in version 216.
LACPTransmitRate=โ the rate at which your link partner transmits Link Aggregation Control Protocol Data Unit packets in802.3admode. Possible values are"slow", which asks the partner to transmit LACPDUs every 30 seconds, and"fast", which asks them every single second. The default value is"slow".
Added in version 216.
MIIMonitorSec=โ how often Media Independent Interface link monitoring happens. A value of zero disables MII link monitoring entirely (no cap, we're just not checking). This value is rounded down to the nearest millisecond. The default value is0.
Added in version 216.
PeerNotifyDelaySec=โ the number of seconds of delay between each peer notification (that's gratuitous ARP and unsolicited IPv6 Neighbor Advertisement, bestie) when they're issued after a failover event. This delay should be a multiple of the MII link monitor interval (miimon). The valid range is0...300s. The default value is0, which means to match the value ofMIIMonitorSec=.
Added in version 256.
UpDelaySec=โ the delay before a link is enabled after a link up status has been detected. This value is rounded down to a multiple ofMIIMonitorSec=. The default value is0.
Added in version 216.
DownDelaySec=โ the delay before a link is disabled after a link down status has been detected. This value is rounded down to a multiple ofMIIMonitorSec=. The default value is0.
Added in version 216.
LearnPacketIntervalSec=โ the number of seconds between instances where the bonding driver sends learning packets to each slave peer switch. The valid range is1...0x7fffffff; the default value is1. Heads up: this option has an effect only for thebalance-tlbandbalance-albmodes.
Added in version 220.
AdSelect=โ the 802.3ad aggregation selection logic to use. Possible values are"stable","bandwidth"and"count".
Added in version 220.
AdActorSystemPriority=โ the 802.3ad actor system priority. Takes a number in the range1...65535.
Added in version 240.
AdUserPortKey=โ the 802.3ad user defined portion of the port key. Takes a number in the range0...1023.
Added in version 240.
AdActorSystem=โ the 802.3ad system MAC address. This cannot be a null or multicast address.
Added in version 240.
FailOverMACPolicy=โ decides whetheractive-backupmode should set all slaves to the same MAC address at the time of enslavement or, when enabled, perform special handling of the bond's MAC address in accordance with the selected policy. The default policy isnone. Possible values are"none","active"and"follow".
Added in version 220.
ARPValidate=โ whether or not ARP probes and replies should be validated in any mode that supports ARP monitoring, or whether non-ARP traffic should be filtered (disregarded) for link monitoring purposes. Possible values are"none","active","backup"and"all".
Added in version 220.
ARPIntervalSec=โ the ARP link monitoring frequency. A value of0disables ARP monitoring. The default value is0, and the default unit is seconds.
Added in version 220.
ARPIPTargets=โ the IP addresses to use as ARP monitoring peers whenARPIntervalSec=is greater than0. These are the targets of the ARP request sent to determine the health of the link to the targets. Specify these values in IPv4 dotted decimal format. At least one IP address must be given for ARP monitoring to function. The maximum number of targets that can be specified is16. The default value is no IP addresses.
Added in version 220.
ARPAllTargets=โ the quantity ofARPIPTargets=that must be reachable in order for the ARP monitor to consider a slave as being up. This option affects onlyactive-backupmode for slaves withARPValidateenabled. Possible values are"any"and"all".
Added in version 220.
PrimaryReselectPolicy=โ the reselection policy for the primary slave. This affects how the primary slave is chosen to become the active slave when failure of the active slave or recovery of the primary slave occurs. This option is designed to prevent flip-flopping between the primary slave and other slaves (we love a stable queen). Possible values are"always","better"and"failure".
Added in version 220.
ResendIGMP=โ the number of IGMP membership reports to be issued after a failover event. One membership report is issued immediately after the failover, subsequent packets are sent in each 200ms interval. The valid range is0...255. Defaults to1. A value of0prevents the IGMP membership report from being issued in response to the failover event.
Added in version 220.
PacketsPerSlave=โ the number of packets to transmit through a slave before moving to the next one. When set to0, then a slave is chosen at random (chaotic, we respect it). The valid range is0...65535. Defaults to1. This option only has effect when inbalance-rrmode.
Added in version 220.
GratuitousARP=โ the number of peer notifications (gratuitous ARPs and unsolicited IPv6 Neighbor Advertisements) to be issued after a failover event. As soon as the link is up on the new slave, a peer notification is sent on the bonding device and each VLAN sub-device. This is repeated at each link monitor interval (ARPIntervalSecorMIIMonitorSec, whichever is active) if the number is greater than1. The valid range is0...255. The default value is1. These options affect only theactive-backupmode.
Added in version 220.
AllSlavesActive=โ takes a boolean. Specifies that duplicate frames (received on inactive ports) should be dropped when false, or delivered when true. Normally, bonding will drop duplicate frames (received on inactive ports), which is desirable for most users. But there are some cases where it is nice to allow duplicate frames to be delivered. The default value isfalse(drop duplicate frames received on inactive ports).
Added in version 220.
DynamicTransmitLoadBalancing=โ takes a boolean. Specifies if dynamic shuffling of flows is enabled. Applies only forbalance-tlbmode. Defaults to unset.
Added in version 240.
MinLinks=โ the minimum number of links that must be active before asserting carrier. The default value is0.
Added in version 220.
ARPMissedMax=โ the maximum number of arp interval monitor cycle for missed ARP replies. If this number is exceeded, the link is reported as down. Defaults to unset.
Added in version 256.
For more detail information see Linux Ethernet Bonding Driver HOWTO[1] ๐ซถ
๐ฅ [XFRM] SECTION OPTIONS ๐ฅ
The [Xfrm] section accepts the following keys:
InterfaceId=โ sets the ID/key of the xfrm interface which needs to be associated with a SA/policy. Can be decimal or hexadecimal, valid range is1-0xffffffff. This is mandatory.
Added in version 243.
Independent=โ takes a boolean. If false (the default), the xfrm interface must have an underlying device which can be used for hardware offloading.
Added in version 243.
For more detail information see Virtual XFRM Interfaces[18].
๐ฆ [VRF] SECTION OPTIONS ๐ฆ
The [VRF] section only applies for netdevs of kind "vrf" and accepts the following key:
Table=โ the routing table identifier. Takes a route table name or number. Route table names may be predefined or configured withRouteTable=innetworkd.conf(5). This setting is compulsory.
Added in version 243.
๐ฆ [BATMANADVANCED] SECTION OPTIONS ๐ฆ
Okay so this section is only for netdevs of kind "batadv" โ like, exclusively, don't try it anywhere else bestie โ and it takes these keys:
GatewayMode=โ takes one of"off","server", or"client". So a batman-adv node can either run in server mode (sharing its internet connection with the whole mesh, generous queen ๐) or in client mode (out here searching for the most suitable internet connection in the mesh) or just have gateway support turned off entirely โ which is the default setting, no cap.
Added in version 248.
Aggregation=โ takes a boolean value. Turns aggregation of originator messages on or off. Defaults totrue.
Added in version 248.
BridgeLoopAvoidance=โ takes a boolean value. Enables or disables avoidance of loops on bridges. Defaults totrue.
Added in version 248.
DistributedArpTable=โ takes a boolean value. Enables or disables the distributed ARP table. Defaults totrue.
Added in version 248.
Fragmentation=โ takes a boolean value. Enables or disables fragmentation. Defaults totrue.
Added in version 248.
HopPenalty=โ okay so the hop penalty setting lets you modifybatctl(8)'s preference for multihop routes vs. short routes. This integer value gets applied to the TQ (Transmit Quality) of each forwarded OGM (Originator Message), which is how it propagates the cost of an extra hop โ because the packet has to be received and retransmitted, and that costs airtime. A higher hop penalty makes it more unlikely that other nodes will pick this node as an intermediate hop towards any given destination. The default hop penalty of'15'is a reasonable value for most setups and probably does not need to be changed, fr. But mobile nodes could choose a value of255(the maximum value) to avoid being chosen as a router by other nodes. The minimum value is0.
Added in version 248.
OriginatorIntervalSec=โ this value specifies the interval in seconds, unless another time unit is specified, in which batman-adv floods the network with its protocol information. Seesystemd.time(7)for more info.
Added in version 248.
GatewayBandwidthDown=โ if the node is a server, this parameter is used to inform other nodes in the network about this node's internet connection download bandwidth in bits per second. Just enter any number suffixed withK,M,GorT(base 1000) and the batman-adv module will propagate the entered value in the mesh. โจ
Added in version 248.
GatewayBandwidthUp=โ if the node is a server, this parameter is used to inform other nodes in the network about this node's internet connection upload bandwidth in bits per second. Just enter any number suffixed withK,M,GorT(base 1000) and the batman-adv module will propagate the entered value in the mesh.
Added in version 248.
RoutingAlgorithm=โ this can be either"batman-v"or"batman-iv"and it describes whichrouting_algoofbatctl(8)to use. Heads up: the algorithm cannot be changed after interface creation. Defaults to"batman-v".
Added in version 248.
๐งต [IPOIB] SECTION OPTIONS ๐งต
This section only applies for netdevs of kind "ipoib" and accepts the following keys:
PartitionKey=โ takes an integer in the range1...0xffff, except for0x8000. Defaults to unset, and the kernel's default is used.
Added in version 250.
Mode=โ takes one of the special values"datagram"or"connected". Defaults to unset, and the kernel's default is used.
When "datagram", the Infiniband unreliable datagram (UD) transport is used, and so the interface MTU is equal to the IB L2 MTU minus the IPoIB encapsulation header (4 bytes). For example, in a typical IB fabric with a 2K MTU, the IPoIB MTU will be 2048 - 4 = 2044 bytes. ๐งฎ
When "connected", the Infiniband reliable connected (RC) transport is used. Connected mode takes advantage of the connected nature of the IB transport and allows an MTU up to the maximal IP packet size of 64K, which reduces the number of IP packets needed for handling large UDP datagrams, TCP segments, etc and increases the performance for large messages. Iconic behaviour honestly.
Added in version 250.
IgnoreUserspaceMulticastGroups=โ takes a boolean value. Whentrue, the kernel ignores multicast groups handled by userspace. Defaults to unset, and the kernel's default is used.
Added in version 250.
๐ก [WLAN] SECTION OPTIONS ๐ก
This section only applies to WLAN interfaces, and accepts the following keys:
PhysicalDevice=โ specifies the name or index of the physical WLAN device (e.g."0"or"phy0"). You can get the list of physical WLAN devices that exist on the host with theiw phycommand. This option is mandatory.
Added in version 251.
Type=โ specifies the type of the interface. Takes one of the"ad-hoc","station","ap","ap-vlan","wds","monitor","mesh-point","p2p-client","p2p-go","p2p-device","ocb","nan","nan-data"and"pd". This option is mandatory.
Added in version 251.
WDS=โ enables the Wireless Distribution System (WDS) mode on the interface. The mode is also known as the"4 address mode". Takes a boolean value. Defaults to unset, and the kernel's default will be used.
Added in version 251.
๐ EXAMPLES ๐
Serving you the actual configs, verbatim, because copy-paste is self-care ๐
Example 1. /etc/systemd/network/25-bridge.netdev
[NetDev]
Name=bridge0
Kind=bridge
Example 2. /etc/systemd/network/25-vlan1.netdev
[Match]
Virtualization=no
[NetDev]
Name=vlan1
Kind=vlan
[VLAN]
Id=1
Example 3. /etc/systemd/network/25-ipip.netdev
[NetDev]
Name=ipip-tun
Kind=ipip
MTUBytes=1480
[Tunnel]
Local=192.168.223.238
Remote=192.169.224.239
TTL=64
Example 4. /etc/systemd/network/1-fou-tunnel.netdev
[NetDev]
Name=fou-tun
Kind=fou
[FooOverUDP]
Port=5555
Protocol=4
Example 5. /etc/systemd/network/25-fou-ipip.netdev
[NetDev]
Name=ipip-tun
Kind=ipip
[Tunnel]
Independent=yes
Local=10.65.208.212
Remote=10.65.208.211
FooOverUDP=yes
FOUDestinationPort=5555
Example 6. /etc/systemd/network/25-tap.netdev
[NetDev]
Name=tap-test
Kind=tap
[Tap]
MultiQueue=yes
PacketInfo=yes
Example 7. /etc/systemd/network/25-sit.netdev
[NetDev]
Name=sit-tun
Kind=sit
MTUBytes=1480
[Tunnel]
Local=10.65.223.238
Remote=10.65.223.239
Example 8. /etc/systemd/network/25-6rd.netdev
[NetDev]
Name=6rd-tun
Kind=sit
MTUBytes=1480
[Tunnel]
Local=10.65.223.238
IPv6RapidDeploymentPrefix=2602::/24
Example 9. /etc/systemd/network/25-gre.netdev
[NetDev]
Name=gre-tun
Kind=gre
MTUBytes=1480
[Tunnel]
Local=10.65.223.238
Remote=10.65.223.239
Example 10. /etc/systemd/network/25-ip6gre.netdev
[NetDev]
Name=ip6gre-tun
Kind=ip6gre
[Tunnel]
Key=123
Example 11. /etc/systemd/network/25-vti.netdev
[NetDev]
Name=vti-tun
Kind=vti
MTUBytes=1480
[Tunnel]
Local=10.65.223.238
Remote=10.65.223.239
Example 12. /etc/systemd/network/25-veth.netdev
[NetDev]
Name=veth-test
Kind=veth
[Peer]
Name=veth-peer
Example 13. /etc/systemd/network/25-bond.netdev
[NetDev]
Name=bond1
Kind=bond
[Bond]
Mode=802.3ad
TransmitHashPolicy=layer3+4
MIIMonitorSec=1s
LACPTransmitRate=fast
Example 14. /etc/systemd/network/25-dummy.netdev
[NetDev]
Name=dummy-test
Kind=dummy
MACAddress=12:34:56:78:9a:bc
Example 15. /etc/systemd/network/25-vrf.netdev
Create a VRF interface with table 42.
[NetDev]
Name=vrf-test
Kind=vrf
[VRF]
Table=42
Example 16. /etc/systemd/network/25-macvtap.netdev
Create a MacVTap device.
[NetDev]
Name=macvtap-test
Kind=macvtap
Example 17. /etc/systemd/network/25-wireguard.netdev
[NetDev]
Name=wg0
Kind=wireguard
[WireGuard]
PrivateKey=EEGlnEPYJV//kbvvIqxKkQwOiS+UENyPncC4bF46ong=
ListenPort=51820
[WireGuardPeer]
PublicKey=RDf+LSpeEre7YEIKaxg+wbpsNV7du+ktR99uBEtIiCA=
AllowedIPs=fd31:bf08:57cb::/48,192.168.26.0/24
Endpoint=wireguard.example.com:51820
Example 18. /etc/systemd/network/27-xfrm.netdev
[NetDev]
Name=xfrm0
Kind=xfrm
[Xfrm]
Independent=yes
๐ SEE ALSO ๐
systemd(1), systemd-networkd.service(8), systemd.link(5), systemd.network(5), systemd-network-generator.service(8)
๐ NOTES ๐
- Linux Ethernet Bonding Driver HOWTO https://docs.kernel.org/networking/bonding.html
- RFC 2784 https://tools.ietf.org/html/rfc2784
- IEEE 802.1Q http://www.ieee802.org/1/pages/802.1Q.html
- VRF https://docs.kernel.org/networking/vrf.html
- B.A.T.M.A.N. Advanced https://www.open-mesh.org/projects/open-mesh/wiki
- System and Service Credentials https://systemd.io/CREDENTIALS
- Distributed Overlay Virtual Ethernet (DOVE) https://en.wikipedia.org/wiki/Distributed_Overlay_Virtual_Ethernet
- VXLAN Group Policy https://tools.ietf.org/html/draft-smith-vxlan-group-policy
- Generic Protocol Extension for VXLAN https://tools.ietf.org/html/draft-ietf-nvo3-vxlan-gpe-07
- Type of Service in the Internet Protocol Suite http://tools.ietf.org/html/rfc1349
- RFC 6437 https://tools.ietf.org/html/rfc6437
- RFC 2460 https://tools.ietf.org/html/rfc2460
- RFC 2473 https://tools.ietf.org/html/rfc2473#section-4.1.1
- ip-xfrm โ transform configuration https://man7.org/linux/man-pages/man8/ip-xfrm.8.html
- Foo over UDP https://lwn.net/Articles/614348
- IPv6 Rapid Deployment https://tools.ietf.org/html/rfc5569
- Generic UDP Encapsulation https://lwn.net/Articles/615044
- Virtual XFRM Interfaces https://lwn.net/Articles/757391
aaaand that's the whole page bestie, we did it!! ๐๐ฆโจ you just read the entire systemd.netdev(5) and honestly? that's main character energy. This one's from systemd 262.1 and the page you're holding is SYSTEMD.NETDEV(5) โ go forth and configure some netdevs, you absolute icon ๐๐ periodt.
๐ฆ where this page comes from
- arch rolling: systemd 262.1-1 ยท LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later AND MIT-0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms