Upgrading Ubuntu 20.x -> 22.x killed my network

I’ve spent the last several hours trying to figure out what’s going on, but I’m totally stuck.

I was trying to upgrade my droplet from Ubuntu 20.x to Ubuntu 22.x using this guide. Now my networking doesn’t work.

  • I can only access the droplet through the recovery terminal, so copy-pasting details is not possible.
  • When using the terminal, I can ping localhost, but I can’t ping the gateway.
  • DNS doesn’t work because the network is totally unreachable.
  • ufw status shows ssh port is LIMIT IN from Anywhere and: deny (incoming), allow (outgoing), disabled (routed).
  • /etc/netplan/50-cloud-init.yaml file shows one entry for “ens3”.
  • “ip a” shows two interfaces: “lo” (state UNKNOWN) and “ens3” (state UP).
  • “ip route” does not return anything.

How do I troubleshoot this?

Thanks for any help!

  • Andy

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

To answer my own question via DO support (thanks Mubashir!)…

The issue was with “systemd’s predictable network interface naming”.

The solution was to turn it off via GRUB.

  • edit /etc/default/grub.d/50-cloudimg-settings.cfg and add net.ifnames=0 at the end of GRUB_CMDLINE_LINUX_DEFAULT:

GRUB_CMDLINE_LINUX_DEFAULT=“console=tty1 console=ttyS0 net.ifnames=0”

  • then:



So the answer above didn’t work for me. What I ended up doing was creating a new YAML file at /etc/netplan/config.yaml with the following content:

  version: 2
  renderer: networkd
          addresses: [ "<droplet IP address>/24" ]
            - to: default
              via: <droplet gateway IP address>
              on-link: true #only needed if the droplet is on a different subnet

If your droplet gateway is on a different subnet (i.e. more than just the last set of numbers in the IP address and gateway IP address are different), you need to include the “on-link” line.

Save the file and then run this command:

netplan generate

followed by

netplan apply

That will set the static IP and gateway address and make it persist past reboots.

If you need to temporarily add the static IP address and gateway, use these commands:

ip addr add <droplet IP address> dev eth0
ip link set dev eth0 up
ip route add default via <gateway IP address> onlink dev eth0

This will give you connectivity in order to run updates and install additional packages, but that connectivity will not persist on reboot.

I hope this helps someone.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel