The network configuration is not working on a droplet after reboot

Posted February 21, 2018 10k views
NetworkingUbuntu 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?



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.

Submit an Answer
3 answers

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

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:

  • GATEWAY/IPADDR/NETMASK needs to be filled with the correct information (as web console window shows).


service network restart

So we are having the same issue on centos 7.x; needed to reboot after run folder was overflowing due to some common centos issue.

After restart: no public networking

What I dont understand is: how … after years and years of good service can this suddenul happen? eth0 scripts are created by cloud init (and not changed by anyone after) ....

So is this something due to Digital Ocean config? Or how can this come to be?

  • I’ve seen a couple of recent cases where users had accidentally (neither of us figured out how) uninstalled cloud-init. While the configurations remained there, the software had been removed. I suppose it wouldn’t be crazy to check the yum logs to see if that might be the case for you.