I recently installed Debian 12.7 on a fresh storage, this is a headless server with no desktop environment.
I checked the NetworkConfiguration documentation of Debian and I saw this:
4 ways to configure the network
- The interfaces configuration file at /etc/network/interfaces (this page): for basic or simple configurations (e.g. workstation)
- NetworkManager: This is the default for Laptop configuration
- Systemd: Debian reference Doc Chapter 5
- Netplan: Debian reference Doc Chapter 5
And now I'm confused because I don't understand what part apply to my installation.
The system uses the default configuration so the answer may be straightforward, but let's assume that I connect to a machine that I don't know and I want to identify the network configuration.
How to identify the way that a Debian (or another Linux distro) system use to configure its network stack?
My attempts
/etc/network/interfaces
The file exists:
root@serveur:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug enp2s0
iface enp2s0 inet dhcp
# This is an autoconfigured IPv6 interface
iface enp2s0 inet6 auto
NetworkManager
The service doesn't exist:
root@serveur:~# service network-manager status
Unit network-manager.service could not be found.
Update: as shown in this answer from Z0OM, it should be service NetworkManager status instead, but the result is the same.
Systemd
One file exists but its content is commented:
root@serveur:~# ls -lrth /etc/systemd/network/
total 0
root@serveur:~# cat /etc/systemd/networkd.conf
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
# Entries in this file show the compile time defaults. Local configuration
# should be created by either modifying this file, or by creating "drop-ins" in
# the networkd.conf.d/ subdirectory. The latter is generally recommended.
# Defaults can be restored by simply deleting this file and all drop-ins.
#
# See networkd.conf(5) for details.
[Network]
#SpeedMeter=no
#SpeedMeterIntervalSec=10sec
#ManageForeignRoutingPolicyRules=yes
#ManageForeignRoutes=yes
#RouteTable=
[DHCPv4]
#DUIDType=vendor
#DUIDRawData=
[DHCPv6]
#DUIDType=vendor
#DUIDRawData=
Netplan
There is no conf:
root@serveur:~# ls -lrth /etc/netplan/
ls: cannot access '/etc/netplan/': No such file or directory
Observations
This system uses /etc/network/interfaces and Systemd to configure the networking?
ifupdown(/etc/network/interfaces) mostly was first, and is still sufficient for a lot of servers -- if the IP address never changes, it is a bit silly to run a service for that.