Jump to content

Systemd/networkd: Difference between revisions

imported>Mweinelt
(Use nixos options template to link to s.n.o)
imported>Mweinelt
Line 14: Line 14:


== Basics ==
== Basics ==
=== When to use ===
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:
* Servers/Routers
* Always-On VPN Tunnels
Following that logic, it is less suitable to
* Varying WLAN profiles
* Selectively used VPN tunnels
These use cases are better served by [[Networkmanager]] and its various frontends,
that provides a better integrated user experience for various desktop systems.
{{Note|Both networkd and networkmanager can exist in parallel on the same machine,
when they manage a distinct set of interfaces.}}
=== Enabling ===
=== Enabling ===


To be able to use networkd configuration it needs to be enabled first.
To be able to use networkd configuration, it needs to be enabled first.


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
Line 64: Line 82:
* <code>systemd.network.netdevs</code> does not modify existing network interfaces
* <code>systemd.network.netdevs</code> does not modify existing network interfaces
** https://github.com/systemd/systemd/issues/9627
** https://github.com/systemd/systemd/issues/9627
Interfaces are set up in a one-shot fashion with networkd. That means it sets them up
once and doesn't expect them to change significantly during their lifetime.
This means that networkd is not well suited to manage scenarios where multiple profiles
can be configured onto an interface, or an interface is only selectively up. This is mostly
the case for WLAN on mobile devices, and occassional usage of VPN tunnels. Use
[[Networkmanager]] to cover these use cases, it can run in paralle with networkd, as
long as they aren't set up to manage the same interfaces.


=== network-online.target ===
=== network-online.target ===
Anonymous user