The network configuration is not working on a droplet after reboot

February 21, 2018 2.2k views
Networking Ubuntu 16.04

For some reason when I reboot my droplet, the network configuration is not working. The details appear correctly for the interfaces file, but the interface doesn't appear to be getting assigned.

To fix that issue I have to do this:

ip address add IP_ADDRESS_1/20 dev eth0

That updates the output of ip addr to show that the IP address is assigned, but connectivity still will not work until the route is setup.

ip route add default via IP_ADDRESS_2 dev eth0

This updates the ip route output to have a default route.

If I reboot the droplet I can't connect to the droplet via SSH (any attempt to access the public IP address fail) and I have to use the web browser console to access the droplet and to use the commands above in order to restore the correct work of the server.

Can anyone help me to find out the reason which may cause this issues?

Every time when I reboot I reproduce the same issue. Any suggestions where I have to look first?

Thanks!

3 comments
  • I am having the same issue ever since the Spectre/Meltdown patch yesterday.

  • I opened a ticket in the Support centre and after two days discussion it turns out that the solution is to create a new droplet and to move all applications from the old droplet to the new one. Basically to re-build everything from scratch.

  • I have same issue on Ubuntu 18.04 LTS. But it could not be solved with this method.

2 Answers
reiuiji February 23, 2018
Accepted Answer

I had the same issue and fixed it by adding the gateway IP to ifcfg-eth0. The commands I used works on a CentOS/Redhat system and will not work on Debian. See bottom for interface config.

You can check your gateway IP under the droplet console. For example, my gateway was X.Y.Z.1 which I ran this command to force my gateway IP address.

echo "GATEWAY=X.Y.Z.1" >> /etc/sysconfig/network-scripts/ifcfg-eth0

After you setup the gateway IP, restart the network service.

systemctl restart network

Once the network is up, test to see if you can establish an outbound connection.

ping -c 3 digitalocean.com

Common locations for interface config

CentOS/Redhat : /etc/sysconfig/network-scripts
Debian/Ubuntu : /etc/network/interfaces

FYI: The interface config file is created through cloud-init and will likely be overridden sometime in the future.

Similar issue with me. After i resized my droplet, the public IP was unavailable.

I copy the "/etc/sysconfig/network-scripts/ifcfg-eth0" information for a working droplet to the broken one and it works. Information keep saved after a reboot also.

Digital Ocean "ifcfg-eth0" example:

BOOTPROTO=none
DEVICE=eth0
HWADDR=x
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
GATEWAY=x
IPADDR=x
NETMASK=x
DNS1=8.8.8.8
DNS2=8.8.4.4
NM_CONTROLLED="YES"
  • GATEWAY/IPADDR/NETMASK needs to be filled with the correct information (as web console window shows).

Then:

service network restart
  • There is something important which should mention in my question. The platform I work with is Ubuntu 16.04.

Have another answer? Share your knowledge.