Jump to content

Systemd/networkd: Difference between revisions

m
no edit summary
imported>Mweinelt
imported>Vater
mNo edit summary
Line 1: Line 1:
Networkd is the network configuration component of the systemd software suite. It is well integrated into NixOS below {{Nixos:option|systemd.network}} and should be preferred over {{Nixos:option|networking.interfaces}} options for most use cases, since it receives far superior maintenance.
{{DISPLAYTITLE:systemd-networkd}}
[https://www.freedesktop.org/software/systemd/man/systemd-networkd.html systemd-networkd] is the network configuration component of the systemd software suite. It is well integrated into NixOS below {{Nixos:option|systemd.network}} and should be preferred over {{Nixos:option|networking.interfaces}} options for most use cases, since it receives far superior maintenance.


Configuration for networkd is split into three sections.
Configuration for networkd is split into three sections.
Line 14: Line 15:


== Basics ==
== Basics ==
=== When to use ===
=== When to use ===


Use systemd-networkd for setups that rely on static configuration, that doesn't change much
Use systemd-networkd for setups that rely on static configuration, that doesn't change much during its lifetime, that does not require varying profiles for a single interface. Common examples are:
during its lifetime, that does not require varying profiles for a single interface. Common
examples are:
* Servers/Routers
* Servers/Routers
* Always-On VPN Tunnels
* Always-On VPN Tunnels
Line 26: Line 26:
* Selectively used VPN tunnels
* Selectively used VPN tunnels


These use cases are better served by [[NetworkManager]] and its various frontends,
These use cases are better served by [[NetworkManager]] and its various frontends, that provides a better integrated user experience for various desktop systems.
that provides a better integrated user experience for various desktop systems.


{{Note|Both systemd-networkd and NetworkManager can exist in parallel on the same machine,
{{Note|Both systemd-networkd and NetworkManager can exist in parallel on the same machine,
Line 71: Line 70:
</nowiki>}}
</nowiki>}}


Note that we usually prefix the configuration file with a number. This can be important,
Note that we usually prefix the configuration file with a number. This can be important, because networkd collects all available configuration files, then sorts them alphabetically, and uses the first match for each interface as its configuration. This happens separately for <code>.link</code>, <code>.netdev</code> and <code>.network</code> files, so that you can have one configuration of each type per interface.
because networkd collects all available configuration files, then sorts them alphabetically,
and uses the first match for each interface as its configuration. This happens separately
for <code>.link</code>, <code>.netdev</code> and <code>.network</code> files, so
that you can have one configuration of each type per interface.


=== Limitations ===
=== Limitations ===
Some limitations might be surprising, so it is probably helpful to get them out of the
 
way early.
Some limitations might be surprising, so it is probably helpful to get them out of the way early.


* {{Nixos:option|systemd.network.links}}
* {{Nixos:option|systemd.network.links}}
Anonymous user