0

I'm having an issue with netplan settings being changed on reboot. I'm attempting to setup a simple bridge network on my home server. My configuration is in a file called /etc/netplan/99-netconfig.yaml

network:
  version: 2
  renderer: networkd
  ethernets:
    enp1s0:
      dhcp4: no
  bridges:
    br0:
      dhcp4: yes
      interfaces:
        - enp1s0

When I run netplan generate and netplan apply everything works as intended. When I reboot, suddenly I get a file in /run/netplan/enp1s0.yaml that calls for a static IP address. I also get 3 files under /run/systemd/network, and one of them is 10-netplan-enp1s0.network. That file also calls for a static IP address. Even if I delete all of these files and reset my netplan, they will all return upon reboot.

Is there a way to prevent this from happening? It took me a while to get this far, but I'm stuck in figuring out what in my system is making this happen. This issue causes my server to lose internet.

I'm running Ubuntu 24.04.2 LTS x86_64. I am also running Docker.

Any help is appreciated.

NotTheDr01ds
  • 22,082

1 Answers1

1

(Moved from the question into an answer)

Thank you @mpboden this put me on the right track and I now have it working. I have dropbear-initramfs/noble,now 2022.83-4 amd64 installed to unlock my drive (LUKS). This was the issue. Here is my solve

  1. Creating a script /etc/initramfs-tools/scripts/init-bottom/remove-enp1s0.sh that contains the following:
#!/bin/sh

rm -f /run/netplan/eth0.yaml && ip -f inet address flush dev enp1s0

After adding the script I ran sudo chmod +x /etc/initramfs-tools/scripts/init-bottom/remove-enp1s0.sh to make it executable. (I missed that my first reboot and the file didn't work.)I then ran sudo update-initramfs -u and rebooted. After unlocking the drive my machine worked and Netplan was back to normal. I was able to successfully create my bridge network.

Please note if you have this issue, you may not be able to use enp1s0. Your ethernet might be enp1s0 or eth0 or something else. Check the output of ip link.

NotTheDr01ds
  • 22,082