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
  • 3

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.

Lumberjack
  • 221
  • 1
  • 5
  • Public IP address is set to 138.59.144.1 , gateway 138.59.144.1, netmask 138.59.144.1, these are from Networking settings, but i can't understand why is Private IP is different 10.135.xxx.xxx ?? – swordfish Dec 06 '19 at 21:16
  • You say netmask = 138.59.144.1? Respectfully, that doesn't sound right either. – Lumberjack Dec 06 '19 at 21:19
  • @swordfish you have two interfaces called eth0. That is a problem in addition to the subnet / gateway issue. Maybe call the second one eth1? – Lumberjack Dec 06 '19 at 21:20
  • oh yeah thats my mistake i didn't noticed that, got to change to the correct one but also the error shows again! – swordfish Dec 06 '19 at 21:24
  • I have no eth* interfaces, just ens3 and ens4 – swordfish Dec 06 '19 at 21:26
  • @swordfish What if you try to comment out the eth1 and only ifup the eth0? – Lumberjack Dec 06 '19 at 21:26
  • The eth0 is not showing up, instead i changed it to ens3 or ens4 – swordfish Dec 06 '19 at 21:28
  • The configurations that i included in question are the default one, after reboot eth0 get disappeared!! instead i got ens3 and ens4, don't know why that happened!! – swordfish Dec 06 '19 at 21:30
  • The Private IP is like a local ip address if i am correct! – swordfish Dec 06 '19 at 21:42
  • Eventually i've successfully renamed the interfaces to eth0 and eth1 , but `ifup eth0` gives an error says: **Failed to bring up eth0** – swordfish Dec 06 '19 at 21:59
  • Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/101929/discussion-between-lumberjack-and-swordfish). – Lumberjack Dec 07 '19 at 21:00