this post was submitted on 05 Aug 2023
12 points (92.9% liked)

Selfhosted

39435 readers
5 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

Does anybody have experience with both systems enough to compare them?

I'm currently using ifupdown on my Debian server as that's the default, but it seems that the modern way of managing the local network is via systemd-networkd so I'm contemplating putting the effort in to migrate.

Would those of you who have experience with it, recommend it?

In my short investigation, I have made the following observations:

  • using networkd means you can use networkctl to manually control the interfaces which is quite convenient
  • networkd aims to be fully declarative
  • networkd separates the creation of virtual interfaces (netdev files) from their configuration (network files)
  • networkd doesn't support all networking features (e.g. namespaces)
  • networkd is systemd, but surprisingly I can't find information on how to create other unit files that depend on the individual network files going up or down, other than networkd-dispatcher. I don't like dispatcher because just like ifupdown it triggers all the scripts and you need if tests to exclude all interfaces you don't need to be affected. I'd like to write unit files that can be targeted to activate and deactivate when a particular interface goes up or down.
  • networkd, other than via dispatcher, does not seem to support adding arbitrary commands to run like ifupdown supports via e.g. pre-down, post-up, etc.
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 1 year ago (1 children)

If you apply what is written at https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/#cutthecraphowdoimakesurethatmyservicestartsafterthenetworkisreallyonline it will work.

Then I'll need to do a global rewrite of all distrubution delivered service files and replace network.target with network-online.target. Then I don't understand why maintainers all keep using network.target. For every service that needs some kund of netwirj active I alkready have iverrides to link then to the virtual or physical interfaces they actually use.

Systemd-networkd has a learning curve, once you learn it you’ll find it superior and more flexible than anything else.

I still find it a solution desperately looking for a problem to solve. Yes, you can control loads of dependencies, but you could already do that with the init scripts. The main selling point on introduction was 'it is faster'. Why would you want something faster when you use it once every kernel update? When you design your solutions correctly (redundant), you won't even notice a reboot of 1 system in the setup.

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (1 children)

Then I don’t understand why maintainers all keep using network.target.

Because most services are able to dynamically accommodate networking changes and act accordingly and it's rare to have cases where we really need a working link with addresses and a proper connection when the service starts. For those special cases, as described, you need to enable systemd-networkd-wait-online.service and include After=network-online.target and/or Wants=network-online.target in your service.

Programs should be designed to detect and react to networking changes and both Apache and Nginx are good examples of software that does that. There are simpler cases like stuff that needs to bind to non-existent IPs at boot (before networking) that can be dealt with ipv4.ip_nonlocal_bind and net.ipv6.ip_nonlocal_bind as described here.

This may also interest you as it includes what "up" means a few other details: https://systemd.io/NETWORK_ONLINE/

I still find it a solution desperately looking for a problem to solve.

Systemd does a LOT more than "you can control loads of dependencies", it solves tons of painful issues and provides a cohesive ecosystem of tools to manage stuff like:

Systemd is very useful and most people (including myself) don't know about half of the things it can do. It isn't teached because of the current poor state of thing when it comes to software development but if you use it you'll quickly find how to have systems running very well with less processes than conventionally.

[–] [email protected] 1 points 1 year ago (1 children)

Replace a bunch of poorly integrated tools such as NetworkManager

You got me here... I'm now battling NetworkManager in scripting (alas, still no Ansible in place there, I doubt it'll be long before I have implemented it), the thing just refuses any configuration via files. Time to dive into the networkd setup. I also hope I can get rid of the very unstable ppoe and wide-dhcpv6-client setup I have here now via ifupdown2 on Debian. The restart I like as well. Time for a deep dive I guess. On Debian NM never caught on, thank $preferredDdiety, but at work it's a disaster.

[–] [email protected] 1 points 1 year ago (1 children)

https://github.com/systemd/systemd/issues/481

wide-dhcpv6-client is easy, any systemd-networkd IPv6 guide will have what you need.

[–] [email protected] 1 points 1 year ago (2 children)

I'll see what I can manage. Thanks for the pointers.

When I can manage simple ipv4 networking via networkd I'm already happy, as it means I can ditch NM again at work, that's giving me a lot more headaches then a flapping SLAAC that I'm not dependent on. (already switched back to my super stable tunnel) The situation here is a setup with 2 ipv6 tunnels, 1 ipv6 SLAAC, source based routing and no default gateway in main routing table for ipv6. Everything runs via the ipv4 pppoe connection. (and a load of vlans both sides of my router to internet)

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago) (1 children)
[–] [email protected] 1 points 1 year ago

Then I'll limit myself to the situation at work. ifupdown2 works great and doesn't need replacing at home.