Question

The network configuration is not working on a droplet after reboot

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!

Show comments

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

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.

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?

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

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.