Skip to content

Instantly share code, notes, and snippets.

@xpr0ger
Last active March 31, 2025 22:01
Show Gist options
  • Save xpr0ger/ff23ec1ece6769c5dae85f3163f2bbe3 to your computer and use it in GitHub Desktop.
Save xpr0ger/ff23ec1ece6769c5dae85f3163f2bbe3 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -euo pipefail
dnf config-manager --set-enabled crb
dnf install epel-release -y
dnf install --refresh systemd-resolved systemd-networkd -y
systemctl enable systemd-networkd
systemctl enable systemd-resolved
systemctl disable NetworkManager
rm /etc/resolv.conf -f
ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
mkdir -p /etc/systemd/network
cat <<EOF > /etc/systemd/network/00-default.network
[Match]
Name=enp*
[Network]
DHCP=ipv4
LLMNR=true
MulticastDNS=true
EOF
cat <<EOF >> /etc/systemd/resolved.conf
LLMNR=yes
MulticastDNS=yes
EOF
@xpr0ger
Copy link
Author

xpr0ger commented Mar 31, 2025

WARNING:
The script might disable remote access, meaning physical access to the machine could be needed to regain control.

Rocky Linux 9.5+

  1. Replaces standard NetworkManager with systemd-network and systemd-resolved
  2. Configures all wired interfaces using DHCPv4
  3. Enables LLMNR and MulticastDNS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment