Note: This may not be a recommended approach to configuring Ubuntu, but I found it easier to roll back to how things worked in older versions.
Ubuntu 18.04 uses something called NetPlan and CloudInit to manage networking. It is supposed to be more flexible and more powerful than traditional networking. Myself (and many others) have instead found it to be an inconsistent, overly complicated pain. In fact, I still haven't found adequate information on where CloudInit stores its initial settings after install.
Let's assume you just completed an Ubuntu 18.04 install, and want to quickly get your network up and running similar to how you had it in Ubuntu 16.04 or 14.04...
Update APT database:
sudo apt update
Install the old networking:
sudo apt install ifupdown
Disable the new DNS:
sudo systemctl disable systemd-resolved.service
To change your interface name back to the old "eth0" that you're familiar with, edit the /etc/default/grub file and change the line with GRUB_CMDLINE_LINUX to look like this:
Now load the new Grub configuration:
And reboot to apply your changes:
Edit/Re-create your /etc/network/interfaces file. It may look something like this:
# # /etc/network/interfaces # # loopback auto lo iface lo inet loopback # IPv4 auto eth0 iface eth0 inet static address 192.168.1.99 netmask 255.255.255.0 gateway 192.168.1.1 # IPv6 # iface eth0 inet6 auto # EoF
Restart the network:
sudo /etc/init.d/networking restart
Remove and re-create your /etc/resolv.conf file.
It may look something like this:
# # /etc/resolv.conf # nameserver 126.96.36.199 nameserver 188.8.131.52 search localhost localhost.example.com domain example.com # EoF
sudo apt purge cloud-init
Optional, you can remove the old CloudInit configuration files:
sudo rm -fr /etc/cloud/ sudo rm -fr /var/lib/cloud/
You can also remove "Snappy" if you'd like:
sudo apt purge snapd
Now you're free to change your hostname to anything you want, without CloudInit permanently keeping the old hostname in its configuration.
sudo hostname MyHostName