saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Install Salt from the Salt package repositories here:
https://docs.saltproject.io/salt/install-guide/en/latest/
Apache License 2.0
14.19k stars 5.48k forks source link

[FEATURE REQUEST] systemd-networkd support #64632

Open dmurphy18 opened 1 year ago

dmurphy18 commented 1 year ago

Is your feature request related to a problem? Please describe. Support for systemd-networkd

Describe the solution you'd like systemd-network supported

Salt network module to be able to create systemd-networkd files

more information: http://www.freedesktop.org/software/systemd/man/systemd-networkd.service.html http://www.freedesktop.org/software/systemd/man/systemd.network.html http://www.freedesktop.org/software/systemd/man/systemd.netdev.html http://www.freedesktop.org/software/systemd/man/systemd.link.html

and an overview: http://coreos.com/blog/intro-to-systemd-networkd/

The reason for this module is easy, an unified way to set network interface on all systemd enabled operating systems, redhat/archlinux/suse/fedora and in the future: debian

This is my setup on archlinux using a bridge and dhcp failover The numbering is the order in which systemd-networkd parses the files

/etc/systemd/network:
10-bridge.network
30-bridge.netdev
40-dhcp.network
20-static.network
/etc/systemd/network/10-bridge.network 
[Match]
Name=br0

[Network]
Address=xxx.xxx.xxx.xxx/24
Gateway=xxx.xxx.xxx.xxx
/etc/systemd/network/20-static.network 
[Match]
MACAddress=xx:xx:xx:xx:xx:xx
Name=xxxxxx

[Network]
Bridge=br0
/etc/systemd/network/30-bridge.netdev 
[NetDev]
Name=br0
Kind=bridge
/etc/systemd/network/40-dhcp.network 
[Match]
Name=*

[Network]
DHCP=yes

Additional context This is originally from issue https://github.com/saltstack/salt/issues/13085 for 2014, but is still relevant according to @OrangeDog and systemd-networkd is unsupported. That issue is closed due to age, but want to address the issue with current OSes and versions of Salt. Note, that systemd has changed since 2014 and the links provided need to be addressed for accuracy and if more up to date information is available.

In the meantime, OSes have adopted other networking solutions, such as, netplan on Ubuntu, network-manager, hence this feature may have superseded but could still be relevant given systemd is now dominant on most commercial versions of Linux.

Please Note If this feature request would be considered a substantial change or addition, this should go through a SEP process here https://github.com/saltstack/salt-enhancement-proposals, instead of a feature request.

OrangeDog commented 1 year ago

In the meantime, OSes have adopted other networking solutions, such as, netplan on Ubuntu, network-manager, hence this feature may have [been] superseded

Incorrect. NetworkManager came first (2004), followed by systemd-networkd (2014). The former is now the de facto industry standard for desktop systems (because it has a GUI), and the latter for server systems. See previous ticket for discussion of netplan, which is a Python tool that generates configuration for either system from a common yaml format, which is what Salt should be doing and could possibly share code with.

in the future: debian

As the point of this new ticket was to update the information, you should do so in the description. All currently-supported Linux systems have systemd-networkd available, and all (IIRC) have deprecated and/or removed ifup/ifdown and manual configuration of /etc/network/interfaces.

Edit: some systems have available an ifupdown2 package, that replaces the old commands with compatibility wrappers.

dmurphy18 commented 1 year ago

@OrangeDog Thanks for the correction