I Lost Internet on an Ubuntu Server.... due to a Blank YAML File.

I expected the difficult part of setting up my Ubuntu Server to be Docker. Instead, I couldn't even run apt update.

Package installations were failing because the server couldn't reach Ubuntu's repositories. At first, it looked like a VirtualBox problem but the VM was running, the network adapter was attached, and everything appeared normal.

The problem turned out to be much simpler: Ubuntu had no usable network configuration.


Where Ubuntu Gets Its Network Configuration

Modern Ubuntu Server uses Netplan to describe how network interfaces should be configured. The configuration files live under:

/etc/netplan/

Normally you'll find a YAML file that tells Ubuntu which interface to bring up, whether to request an IP address through DHCP, and which DNS servers to use. The configuration file was completely blank. That meant Ubuntu had nothing telling it to bring the interface online.


Looking in the Wrong Place

When a server has no internet connection, it's easy to start questioning everything. But before changing VM settings or debugging DNS, it's worth checking whether the operating system even has any network configuration. In my case, it didn't.


netplan - a YAML file

Fixing the problem wasn actually simple.

The final configuration describe one Ethernet interface, enable DHCP, and specify DNS servers, and so on. A proper configuration template usually looks like this:

network:
  version: 2
  ethernets:
    enp0s3:
match:
macaddress: xxxx dhcp4: true nameservers: addresses: [8.8.8.8, 8.8.4.4]

sudo netplan apply
sudo apt update

What I Learned

Network failures often feel overwhelming because there are so many moving parts: the hypervisor, virtual switches, DHCP, DNS, routing, firewalls, repositories... Sometimes the root cause is much closer. In my case, it was a blank YAML file. It made me laugh so hard because it was so silly. I wouldn't even have thought about it normally.

Comments

Popular posts from this blog

The Bug That Taught Me Cryptography Isn't Enough: How Flawed API Logic Can Destroy a Secure Vault

Learning IPv6 in Cisco Packet Tracer: From Direct Connections to Routed Networks

Building a Dynamic Array in C: A Deep Dive into Memory Management