This is post is more less my displeasure of ubuntu’s path as of late. Well, over the last two release cycles. Not only with the introduction of gnome as there default desktop, which I am pretty sure its safe to say it hasn’t been as smooth of an implemation when compare to fedora, arch, and manjaro. Anyway, they decided to introduce netplan as an abstraction layer for the linux network stack and for some reason hide the systemd network that is under the covers. If all you have to do is setup a static ip, or configure multiple interfaces then fine, its ok, at just doing that, but what about bridge interface?, or some some other advanced network configuration? Ubuntu rather that Canonical, has decided to take a once fairly straight forward configuration, and somehow turn it into a nightmare. Instead of exposing admins, users, hobbyists to the interworkings of systemd network configurations (which is here to stay whether people like it or not) they decided add an overly complicated layer ontop of something that has always worked.

Piror to jumping ship from the ubuntu desktop, I decided to ease my frustrations with a shell script that disables netplan from being installed, remove netplan entirely, and enables systemd dhcp. I have tested this script on virtual machines and live systems successfully. The code for it is below and can check it out my github as well.

Just as Canonical did away with Unity, and finally amazon lenses, I hope that one day they realize just how much of a mistake it was creating netplan. Other than these failures of new technology implemenation, Ubuntu continues to power some of the biggest cloud workloads.

#!/bin/bash

echo -e "script must but run as root, or at least have privledges to it"

sleep 2

if [ $(id -u) = 0 ]; then
   echo -e "looks you are root"
else
   echo -e "your are someone other then root"
   exit 1
fi

function rmnetplan () {
   echo -e "removing netplan"
   aptitude remove netplan.io -y -qq
   aptitude purge netplan.io -y  -qq
   echo -e holding netplan back so that will not be installed
   apt-mark hold netplan.io

   if [ -d  /etc/netplan ]; then
    echo -e "removing netplan config files"
    rm -rf /etc/netplan 
  else
    echo -e "files dont exist, they must have been already removed"
  fi

}
rmnetplan 

sleep 2

if [ $? -eq 0 ]; then
   echo -e "netplan removed successully"
else
   echo -e "netplan is still installed"
   exit
fi

sleep 2

echo -e "enabling networkd system and adding networkd dhcp conifguration"

function netdconfig () {

systemctl enable systemd-networkd
sleep 2
systemctl disable NetworkManager 

netfile='/etc/systemd/network/99-wildcard.network'

if [ ! -f ${netfile} ]; then
  echo -e "systemd network file does not exist, adding configuartion"
fi

cat > ${netfile} << EOF 
[Match]
Name=en* #after script is executed make adjustment as need as it pertains to the name of your NIC
  
[Network]
DHCP=yes
EOF

}
netdconfig

function dnsdconfig() {

echo -e "enabling systemd-resolved"
systemctl enable systemd-resolved

dnsfile='/run/systemd/resolve/resolv.conf'

if [  -f ${dnsfile} ]; then
  echo -e "file exists creating symlink"
  rm /etc/resolv.conf
  sleep 2
  ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
fi
}
dnsdconfig

echo -e "removal of netplan complete, enabling and configuration of networkd is complete!, please reboot your system!"
echo -e "after the reboot ensure that netword is able to pull an ip, dns etc using the following cmds"
echo  -e "\n\n"
echo -e "verify network: networkctl"
echo -e "verify interface: networkctl list <interface>"
echo -e "verify dns: systemd-resolve --status"