SystemdNetworkd
SystemdNetworkd
Ethernet Networking
Ethernet Networking
Wireless Networking
Wireless Networking
systemctl status systemd-networkd
systemctl status systemd-resolved.service
systemctl status wpa_supplicant.service
systemctl status [email protected]
systemctl status dbus.service
Simplified Systemd-Networkd setup
Configuring networking using systemd-networkd
requires multiple steps, and it is easy to get things wrong.
The following 3 scripts simplify the process and enable swapping between systemd-networkd
and dhcpcd
.
The setup below is more general than that described above and should work with multiple interfaces (although if you have reason to have multiples you will probably want to customise the setup).
This should offer similar functionality to the dhcpcd
setup (except this will disable the Networking tool on the Desktop Panel).
Step1 installs necessary files, and only needs to be run once.
The other scripts activate/deactivate systemd-networkd
but do not delete anything merely changing which services are running - Reboot REQUIRED!
All script MUST be run by root or with sudo.
SetupSystemdNetworkd.sh
#! /bin/sh
# Script to install files for basic networking using systemd-networkd
# NOTE this does NOT swap networking systems - see separate scripts to activate
# 2022-06-24
# Assumes a working wpa_supplicant.conf file /etc/wpa_supplicant/wpa_supplicant.conf
# This script MUST be run by root or with sudo
# Create a network configuration for Ethernet
# Supports default eth0 or Predictable Network Interface Name en…
cat > /etc/systemd/network/02-eth.network <<EOF
[Match]
Name=e*
[Network]
DHCP=ipv4
[DHCP]
RouteMetric=201
EOF
# Create a network configuration for WiFi
# Supports default wlan0 or Predictable Network Interface Name wl…r
cat > /etc/systemd/network/03-wlan.network <<EOF
[Match]
Name=wl*
[Network]
DHCP=ipv4
[DHCP]
RouteMetric=301
EOF
# Copy existing wpa_supplicant.conf
cp /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
ActivateSystemdNetworkd.sh
#! /bin/sh
# Script to Activate networking using systemd-networkd
# This DeActivates dhcpcd and Debian networking
# 2022-06-24
# Assumes network configuration files and wpa_supplicant.conf file have been setup
# This script MUST be run by root or with sudo
# Reboot REQUIRED!
# Copy existing wpa_supplicant.conf
cp /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
systemctl enable systemd-networkd
systemctl disable dhcpcd
systemctl disable networking
systemctl enable systemd-resolved.service
systemctl disable wpa_supplicant.service
systemctl enable [email protected]
DeactivateSystemdNetworkd.sh
#! /bin/sh
# Script to DeActivates networking using systemd-networkd
# This Activates dhcpcd
# 2022-06-24
# This script MUST be run by root or with sudo
# Reboot REQUIRED!
# Copy existing wpa_supplicant.conf
cp /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
systemctl enable dhcpcd
systemctl disable systemd-networkd
systemctl enable wpa_supplicant.service
systemctl disable systemd-resolved.service
systemctl disable wpa_supplicant@wlan0.service