I discovered this question while searching for something else, but had just developed a solution for my own use in Debian. I think it answers the OP's question:
How to identify the way that a Debian (or another Linux distro) system use to configure its network stack?
This is a rather simple-minded answer I think. It assumes that the software being used to manage the network runs as a service under systemd, and so amounts to listing all systemd units, and applying grep filters:
$ string1=$(systemctl list-units --all | grep -Ei 'networking\.|NetworkManager\.|networkd\.' | grep 'service' | grep -E 'running')
$ string2=$(systemctl list-units --all | grep -Ei 'networking\.|NetworkManager\.|networkd\.' | grep 'service' | grep -Ev 'dead')
$ if [ -n "$string1" ]; then echo ${string1::24}; else echo ${string2::20}; fi
As it turns out - for the versions of Debian 'bookworm' that I use at least, there are only 3 network services to choose from :
Note that Netplan isn't installed in my default installation, but could probably be accommodated under this scheme.
- NetworkManager.service
- systemd-networkd.service
- networking.service
If you list those services, you see the following as the default setup (using NetworkManager) :
$ systemctl list-units --all | grep -Ei 'networking\.|NetworkManager\.|networkd\.' | grep 'service'
networking.service loaded active exited Raise network interfaces
NetworkManager.service loaded active running Network Manager
systemd-networkd.service loaded inactive dead Network Configuration
However, if you disable & mask NetworkManager in favor of ifupdown/networking.service, you will see the following. Note that the networking.service status does not change. :
$ systemctl list-units --all | grep -Ei 'networking\.|NetworkManager\.|networkd\.' | grep 'service'
networking.service loaded active exited Raise network interfaces
NetworkManager.service masked inactive dead NetworkManager.service
systemd-networkd.service loaded inactive dead Network Configuration