By ACSRWeb
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.
How do I troubleshoot this?
Thanks for any help!
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!
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.
GRUB_CMDLINE_LINUX_DEFAULT=“console=tty1 console=ttyS0 net.ifnames=0”
update-grub
reboot
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:
network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses: [ "<droplet IP address>/24" ]
routes:
- 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.
In my case the issue was caused by the fact that eth0
was replaced by ens0
. In order to check what your card name is :
ll /sys/class/net/
total 0
drwxr-xr-x 2 root root 0 set 26 08:46 ./
drwxr-xr-x 70 root root 0 set 26 08:46 ../
lrwxrwxrwx 1 root root 0 set 26 08:49 docker0 -> ../../devices/virtual/net/docker0/
lrwxrwxrwx 1 root root 0 set 26 08:46 ens3 -> ../../devices/pci0000:00/0000:00:03.0/virtio1/net/ens3/
lrwxrwxrwx 1 root root 0 set 26 08:46 lo -> ../../devices/virtual/net/lo/
lrwxrwxrwx 1 root root 0 set 26 08:49 veth0210b8e -> ../../devices/virtual/net/veth0210b8e/
as you can see I have no eth0
but I have a “suspicious” ens3
.
Cross reference the findings with what’s inside /etc/network/interfaces.d/50-cloud-init.cfg
auto eth0
iface eth0 inet static
address <your ip>
dns-nameservers 8.8.8.8 8.8.4.4
gateway <your gateway>
netmask 255.255.192.0
post-up ifup eth0:1
auto eth0:1
iface eth0:1 inet static
address <your ip>
netmask 255.255.0.0
At that point I changed the occurrences of eth0
with ens3
in cloud-init.cfg
and tried to manually up/down my network :
ifdown eth0
ip addr flush dev eth0
ip addr flush dev ens3
ifup ens3
ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=117 time=2.96 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=117 time=0.853 ms
nslookup google.com
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: google.com
Address: 142.250.179.174
Name: google.com
Address: 2a00:1450:400e:811::200e
all up and running.
Reboot
njoy :)
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.