If you are facing the snapshot restoring and No SSH problem like me, Its easy to fix.

Here is the problem. I took a snapshot of my old server and then restored it to new server. Now I can’t SSH to it, or just ping to any external site in that server (ping google.com doesn’t work). However, everything is working in the digital ocean console side.

I spent 5 long hours to find this solution. I hope to help you too!!!

Solution:

  1. Open DigitalOcean console and login to your server.
    (If the previous password doesn’t work, just reset/forgot password it)

  2. type ifconfig and click enter.

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:420 errors:0 dropped:0 overruns:0 frame:0
          TX packets:420 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:107265 (107.2 KB)  TX bytes:107265 (107.2 KB)
  1. If you see just one ‘lo’ device, it means you don’t have internet access. To fix this, type ifconfig -a
ens3      Link encap:Ethernet  HWaddr c2:eb:73:62:d7:5d  
               .......and so on.

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:426 errors:0 dropped:0 overruns:0 frame:0
          TX packets:426 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:109321 (109.3 KB)  TX bytes:109321 (109.3 KB)
  1. Now you need to add this correct ens3 to the network interface. To do that, type cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

source /etc/network/interfaces.d/*
  1. Go to the source, which is /etc/network/interfaces.d/ for me.
    Type cat /etc/network/interfaces.d

  2. Type ls and edit the file there. For me, its 50-cloud-init.cfg.
    So, type nano 50-cloud-init.cfg

  3. This is your previous server’s network configuration, just change the values of IP Address and Gateway. You can find these values in your Digital ocean >Droplet>Networking section.

Also, add ens3 device or whatever we found in step 3.

Make the file similar to this,

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
auto lo
iface lo inet loopback
    dns-nameservers 67.207.67.2 67.207.67.3

auto lo ens3
iface lo inet loopback

iface ens3 inet static
    address 68.183.xx.xxx/20
    gateway 68.183.xx.x

# control-alias eth0
iface ens3 inet static
    address 10.47.0.5/16
  1. Done, It should work now. Try ping google.com & should work properly.

Thank me later, Regards,
Sreekant Shenoy

2 comments

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.

×
2 answers

Thank you so much! Your answer is the only one that fixed my problem.

Submit an Answer