1

I have an ubuntu droplet on www.digitalocean.com, after i changed a few lines of code in my application, i restarted the server, still have access to it through web console but no interfaces has founded, just docker0 and lo, can't ping google even!!

here are my interfaces.d/50-cloud-init.cfg file configurations: auto lo iface lo inet loopback dns-nameservers 8.8.8.8 8.8.4.4

auto eth0
iface eth0 inet static
    address 139.59.148.230
    gateway 138.59.144.1
    netmask 255.255.255.0
    172.17.0.1

# control-alias eth0
iface eth0 inet static
    address 10.135.0.1
    netmask 255.255.0.0

eth0 interface is not showing after ifconfig -a command, i got ens3, ens4, lo, docker0, so i changed the eth0 to one of these ens* but without avail.

I've tried also to assign the ip to the interface statically after restarting the networking service service networking restart, it throwing this error:

ifup[774]: /sbin/ifup: pre-up script failed
systemd[1]: networking.service Main process exited
systemd[1]: Failed to start Raise network interfaces
swordfish
  • 111

1 Answers1

1

Your server and default gateway need to be on the same subnet

When you set your netmask to 255.255.255.0 you are telling the interface it can only broadcast to other addresses on 139.59.148.x. Anything else needs to go through your gateway, but your gateway is on 138.59.144.1

As the saying goes, "you can't get there from here."

Either the gateway address is incorrect, or you need to change your ip address or netmask. Right now your local device can't broadcast to the default gateway because they are not on the same subnet.

address 139.59.148.230
gateway 138.59.144.1

EDIT: Just a theory, but could the default gateway possibly contain an error? Should it have been 139.59.x.x? If so, and your subnet was set to 255.255.249.0 you could broadcast to the default gateway at that point.