17.2. Choosing a Configuration Backend
Debian 13 machines can arrive with any of three network configuration backends - or several installed at once, each owning different interfaces. They are not mutually exclusive programs; they are rival answers to "what file describes this interface", and the healthiest configurations draw one straight line: each interface, one backend, one file.
| Backend | Debian package | Configuration | Activation | Typical use | Costs and limits |
|---|---|---|---|---|---|
| NetworkManager | network-manager |
keyfile profiles in /etc/NetworkManager/system-connections/ |
daemon auto-activates profiles when devices appear | desktops, laptops, Wi-Fi, VPNs, roaming machines | heaviest stack (D-Bus, wpa_supplicant); profiles can also be edited through GUIs |
| ifupdown | ifupdown |
stanzas in /etc/network/interfaces and /etc/network/interfaces.d/ |
ifup/ifdown, run per interface; auto stanzas at boot |
servers with static layouts, minimal systems, long-standing configurations | no dynamic-connection logic of its own; DNS options need a resolver integration to take effect |
| systemd-networkd | ships in systemd |
.network files in /etc/systemd/network/ |
daemon applies files when links appear; userspace DHCP and RA clients | servers, containers, images built around systemd | no interactive client; configuration errors surface through networkctl and the journal |
All three converge on the same kernel state, so Section 17.1's tools verify them equally. Chapter 4 introduced the same three-way choice from the desktop's point of view; this chapter works the server side.
17.2.1. Recognizing NetworkManager, ifupdown, and systemd-networkd
On an unfamiliar machine, first find out what is installed, what is running, and who claims the interfaces you care about. The versions on netlab1 set the behavior for everything that follows:
$ nmcli --version
nmcli tool, version 1.52.1
$ networkctl --version
systemd 257 (257.13-1~deb13u1)
+PAM +AUDIT +SELINUX +APPARMOR +IMA +IPE +SMACK +SECCOMP +GCRYPT -GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBCRYPTSETUP_PLUGINS +LIBFDISK +PCRE2 +PWQUALITY +P11KIT +QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD +BPF_FRAMEWORK +BTF -XKBCOMMON -UTMP +SYSVINIT +LIBARCHIVE
The networkctl banner shows the systemd build (257.13, the Debian 13
revision) followed by the features this systemd was compiled with - the
same list systemctl --version prints, and a useful reference when a
behavior differs between systems. The third backend reports its
own version:
# ifup --version
ifup version 0.8.44+deb13u1
Copyright (c) 1999-2009 Anthony Towns
2010-2015 Andrej Shadura
2015-2017 Guus Sliepen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
Then ask systemd which backends are active and which will start at boot.
is-active and is-enabled each print one line per named unit:
$ systemctl is-active NetworkManager systemd-networkd
active
inactive
$ systemctl is-enabled NetworkManager systemd-networkd
enabled
disabled
NetworkManager is running and enabled; systemd-networkd is neither. Both
answers in one query, with more detail than the one-word forms, comes
from systemctl show:
$ systemctl show -p Id -p ActiveState -p UnitFileState NetworkManager systemd-networkd
Id=NetworkManager.service
ActiveState=active
UnitFileState=enabled
Id=systemd-networkd.service
ActiveState=inactive
UnitFileState=disabled
ifupdown is not a daemon at all, so it appears in neither query - it is
a set of commands plus a boot service that runs ifup -a over the
stanzas in /etc/network/interfaces. What it owns is therefore visible
only through its own query, run as root:
# ifquery --list
lo
eth1
The list contains lo and eth1: exactly the interfaces with auto
stanzas, the ones ifup -a would raise. eth0 is absent because its
stanza uses allow-hotplug rather than auto, so hotplug events, not
the boot sequence, raise it. The stanza file itself appears in Section
17.3.2.
NetworkManager's view of the same machine comes from nmcli, its
command-line client. The terse option pair -t -f selects fields for
script-friendly output; humans get the same information from
nmcli device status without them:
$ nmcli -t -f DEVICE,TYPE,STATE,CONNECTION device status
lo:loopback:connected (externally):lo
eth0:ethernet:unmanaged:
eth1:ethernet:unmanaged:
Every device is accounted for, but none is managed: unmanaged means
NetworkManager is deliberately not configuring eth0 or eth1, and
connected (externally) marks the loopback it adopted without a
profile. This is netlab1's starting state - ifupdown owns both wired
interfaces - and it comes from one small policy file:
# cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile
[ifupdown]
managed=false
plugins=keyfile is where NetworkManager's own profiles live;
plugins=ifupdown and managed=false together say "read
/etc/network/interfaces so the GUI can show those interfaces, but
never configure them". That single line is the most common reason a
desktop's network panel greys out an interface that works fine from the
console - and removing an interface from that file is exactly how a
hand-over to NetworkManager begins.
nmcli command |
Description |
|---|---|
device status |
One line per device: type, state, and the active connection, if any. |
connection show |
List saved profiles; connection show NAME prints every property. |
connection add ... |
Create a profile from command-line properties. |
connection up\|down NAME |
Activate or deactivate a saved profile. |
connection modify NAME [+|-]PROP VALUE |
Change a profile property; +PROP appends to list properties such as routes. |
connection delete NAME |
Remove a profile permanently. |
device wifi list [--rescan yes] |
Scan and list visible wireless networks (Section 17.4). |
radio wifi |
Show or set the software Wi-Fi radio state. |
-t -f FIELDS command |
Terse output limited to selected fields, for scripts and filters. |
--ask |
Prompt interactively for a secret that is missing from a profile. |
17.2.2. Assigning One Configuration Owner to Each Interface
Two owners on one interface produce symptoms that look like nothing in this chapter's troubleshooting section: duplicate addresses from two sources, routes that reappear after being deleted, DNS servers that change depending on which backend won the last race. The rule that prevents all of it is mechanical:
- An interface with a stanza in
/etc/network/interfaces(orinterfaces.d/) belongs to ifupdown. NetworkManager'smanaged=falsepolicy mirrors that file's contents, and systemd-networkd should have no.networkfile matching the same device. - An interface claimed by a NetworkManager profile belongs to NetworkManager, and should have no ifupdown stanza.
- An interface matched by a
.networkfile belongs to systemd-networkd, and neither of the others should reference it. - An interface none of them references is simply unconfigured - also a valid state, for example for a link a firewall bridges to elsewhere.
Figure 17.1 shows the three owners, their files, and the hand-over procedure as one map. The map is conceptual: the exact commands were exercised in the sections that follow it.
Figure 17.1. Each backend recognizes ownership through its own configuration file. Handing an interface over means deconfiguring the old owner, removing its file, and letting the new owner adopt the link - always verified from a link that was not changed.
Hand-over is a one-directional procedure, and each direction has a
worked example in this chapter: Section 17.3.2 moves eth1 from ifupdown
to NetworkManager, Section 17.3.3 moves it to systemd-networkd, and
Section 17.3.4 moves it back to ifupdown. One rule is common to all
three: the kernel keeps addresses that are already assigned. Stopping a
backend does not undo its work, and a new backend may happily stack its
own addresses on top of the old ones. Deconfigure first - ifdown, or an
address flush - then let the new owner start clean.
17.2.3. Desktop and Headless Server Configuration Choices
The backends exist because machines differ, not because one is best.
NetworkManager is the right default where the set of networks changes:
a laptop that moves between wireless networks, a desktop where a user
clicks a passphrase once, a machine that dials VPNs on demand. Its
profiles carry per-network secrets, it scans, associates, and re-associates
without user action, and every desktop environment ships a panel that
edits the same profiles nmcli reads.
A headless server usually wants the opposite property: the network
configuration should be plain files that can be read, copied, diffed,
and generated by a configuration-management system, with no daemon
making roaming decisions. Both remaining backends deliver that, with
different shapes. ifupdown keeps a single flat file that reads top to
bottom - compact, obvious, and easy to carry between machines; DNS
options in stanzas need a resolver integration such as resolvconf to take
effect, and wireless or dynamic situations quickly exceed what its
per-interface model expresses well. systemd-networkd expresses links as
small unit files with a systemd.network(5) vocabulary, starts its own
DHCP and RA clients in userspace, and integrates with
systemd-networkd-wait-online for boot ordering; the cost is that
nothing interactive ever edits those files, and a mistake surfaces only
in networkctl and the journal.
The choice can differ per machine - and it differs inside this chapter: the desktop-style procedures (Section 17.3.2 and all of Section 17.4) run NetworkManager, while the server-side persistent configuration (Section 17.3.3) and the ifupdown maintenance path (Section 17.3.4) each get a full demonstration. Containers and minimal images generally pair best with systemd-networkd; long-lived physical servers have run ifupdown stanzas for decades, and a working stanza file is a perfectly good reason to keep using them.
17.2.4. Planning Remote Changes and Timed Recovery
Nearly every command in the rest of this chapter edits the machine you
are connected through. Two habits keep that safe. First, do
disruptive work on a link that is not the one carrying your session -
this chapter's eth1, while SSH arrives over eth0. Second, when a
change must touch the active path, give the machine a way to heal
itself before you start.
systemd-run schedules a recovery action as a transient timer; it
needs no unit file and no editor. The mechanism is worth a rehearsal on
its own. On netlab1, in a root shell, schedule a harmless marker file
ten seconds out:
# systemd-run --on-active=10s --unit=ch17-recovery /usr/bin/touch /home/john/debian-handbook/network-basics/recovered
Running timer as unit: ch17-recovery.timer
Will run service as unit: ch17-recovery.service
systemd-run option |
Description |
|---|---|
--on-active=SECONDS |
Run the command once, SECONDS after the timer starts. |
--unit=NAME |
Use NAME as the base name of the created transient units. |
--collect |
Clean up the transient unit records when they finish, instead of leaving them for later inspection. |
--uid=USER --gid=GROUP |
Run the command as a non-root user. |
--working-directory=DIR |
Start the command in DIR. |
The timer is now live and visible:
$ systemctl list-timers ch17-recovery.timer --no-pager
NEXT LEFT LAST PASSED UNIT ACTIVATES
Sat 2026-11-21 10:28:55 UTC 8s - - ch17-recovery.timer ch17-recovery.service
1 timers listed.
Pass --all to see loaded but inactive timers, too.
Ten seconds later the service ran; the file it touched is the proof:
$ ls -l recovered
-rw-r--r-- 1 root root 0 Nov 21 10:29 recovered
The file is root-owned because the transient service ran as root. Cancel
the leftover timer and remove the marker before moving on - sudo
systemctl stop ch17-recovery.timer prints nothing, and rm recovered
from the workspace bounds the cleanup to what this rehearsal created.
Timers as such are Chapter 10's subject; transient
units and systemd-run's other uses appear in
Chapter 8.
For a real network change, the same pattern carries the undo with it:
copy the current configuration aside, schedule a command that restores
it and restarts the backend - for example, a cp of the saved
/etc/systemd/network file back into place followed by networkctl
reload, or an nmcli connection up of the profile you are about to
replace - then apply the change. If the session dies with the change
half-applied, the timer puts the machine back the way it was, and you
can reconnect and inspect. If the change holds, stop the timer before it
fires. Chapter 18 uses exactly this pattern for firewall rules, where a
bad rule can lock a machine as thoroughly as a bad route; the same
discipline applies here.