Question

No internet/connection after droplet reboot

After rebooting Ubuntu 18.04 Droplet I couldn’t access it via SSH. Then I realized that I don’t receive any response when pinging its IP. I connected to my Droplet through DigitalOcean built-in terminal and tried to ping other remote servers but this also didn’t work. So it seems that my Droplet is disconnected from the internet. I tried rebooting, shutting off/turning on. Nothing helped. I tried to Google for possible reasons and searched DigitalOcean’s QA section but didn’t find any working solution. Here is what I found so far:

  • if i run “sudo ip link set eth0 up” it returns "Cannot find device “eth0”
  • if i run “ifconfig -a”, there is no eth0, only ens3 and lo
  • if i run “dmesg | grep -i eth”, i get “virtio_net virtio0 ens3: renamed from eth0”. if i do the same on other Droplets (where internet is working) i get

“virtio_net virtio0 ens3: renamed from eth0; virtio_net virtio0 eth0: renamed from ens3”

i.e. eth0 is renamed to ens3 and then back to eth0. So maybe if I managed to rename ens3 to eth0 on my broken Droplet I would be able to restore internet connection but I don’t know how to do this. Also I am not sure why it got broken in the first place. I created a support ticket for this but i didn’t get any response yet.


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.

After almost two weeks since I raised this issue, I was finally able to resolve it. The problem occurred in the first place because different packages got uninstalled somehow when I rebooted. This includes cloud-init, ufw and landscape-common. There is probably more that I haven’t noticed yet. Let’s start with the internet connection, this is how I fixed it:

Step 1. I created file “/etc/udev/rules.d/70-persistent-net.rules” and added

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="b2:fe:09:35:6e:57", NAME="eth0"

as I mentioned previously. Note that MAC address used above can be found here: “/etc/netplan/50-cloud-init.yaml”

Step 2. Run “sudo reboot” and check that eth0 interface persists by running “ifconfig -a”

Step 3. Run the following command:

sudo ifconfig eth0 207.154.193.4 netmask 255.255.240.0 up

Your IP address and netmask can be found if you go to your Droplet’s page and then go to Networking tab. It is important that both these are correct.

Step 4. Run another command:

ip route add default via 207.154.192.1

This is your gateway address which again can be found on Networking tab on your Droplet’s page. At this point you should be able to access your server through SSH. If you try to run “ping www.google.com” it will fail to resolve the domain. Also if you do “sudo reboot”, the configuration won’t persist and you will need to repeat steps 3-4 again. So let’s continue.

Step 5. Run command:

sudo nano /etc/resolv.conf

and change nameserver to “8.8.8.8”, i.e. Google’s DNS, and save the file. Now you should be able to run “ping www.google.com” and receive response.

Step 6. Now I ran these:

sudo apt update
sudo apt upgrade

not sure if this was necessary though.

Step 7. Let’s install the missing cloud-init so that network configuration persists next time we reboot. We can do this by running:

sudo apt install cloud-init

Now you should be able to run “sudo reboot” without losing network connection.

Step 8. Finally, I installed some missing packages by running these:

sudo apt install ufw
sudo apt install landscape-common

landscape-common will enable “landscape-sysinfo” command which is used to show server information on your welcome screen when you connect to your server.

There is probably more stuff that is missing and my Droplet is not exactly the same as it was when I first created it but at least I was able to restore network connection, missing packages that I use and continue running my scripts are before. I hope this hasn’t left any security hole in my system. Probably it would be wise to create new Droplet from scratch at some point.

After upgrading from Ubuntu 18.04 to 20.04, the upgrade procedure left the Droplet with two conflicting network configuration tools: network-manager and systemd-networkd. Systemctl reported both as active. After every reboot the ethernet interface eth0 showed as UP, but had no assigned IP address. To correct this we removed network-manager and re-installed cloud-init to be safe.

sudo apt-get remove --purge network-manager-gnome network-manager
sudo apt-get remove --purge cloud-init
sudo apt-get install cloud-init

Further, we’d seen from logs that the interface with no IP (eth0) was configured to use DHCP to get an IP address when we had a static IP address assigned, so we disabled DHCP and explicitly specified networkd in /etc/netplan/50-cloud-init.yaml prior to rebooting.

network:
    version: 2
    renderer: networkd
    ethernets:
        eth0:
            dhcp4: false
            dhcp6: false
            addresses:
            - XX.XX.XX.XX/XX
            - 10.XX.XX.XX/XX
            match:
                macaddress: YY:YY:YY:YY:YY:YY
            mtu: 1500
            nameservers:
                addresses:
                - 67.207.67.2
                - 67.207.67.3
                search: []
            routes:
            -   to: 0.0.0.0/0
                via: XX.XX.XX.1
            set-name: eth0

Thankyou…

I just upgraded from 18.04 to 20.04 where I lost all contact with my droplet. This article saved my a$$

Thanks again.

Try DigitalOcean for free

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

Sign up

Become a contributor for community

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

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.