DEV Community

adhham
adhham

Posted on

How to Fix No Internet Connection in Digital Ocean's Droplet

Digital Ocean stores its network configuration in two interfaces: eth0 and eth1.

  • eth0 is used for public network (aka. The Internet)
  • eth1 is used for internal private network (ie. digital ocean's internal network)

The correct naming of these interfaces is a must for it to work properly; it should have the exact same name.

In your droplet, run ip -br a command to see if these two interfaces are correctly configured. If you see an output like this, it means the interfaces are not up.

$ ip -br a
eth0 DOWN
eth1 DOWN
Enter fullscreen mode Exit fullscreen mode

To follow this tutorial you will need the public IP address and router gateway IP of your droplet. The public IP can be found in your droplet's dashboard page. If you don't know your gateway IP address, I recommend lodging a support ticket.

To configure eth0 or public network interface, run the following commands:

$ ip addr add 123.456.78.9/20 dev eth0
$ ip link set eth0 up
$ ip route add default via 123.456.0.1
Enter fullscreen mode Exit fullscreen mode

Replace 123.456.78.9/20 with your droplet's public IP address and 123.456.0.1 with the gateway IP address.

Now, configure the nameservers. Edit /etc/resolv.conf file and add the following nameservers:

nameserver 8.8.8.8
nameserver 8.8.4.4
Enter fullscreen mode Exit fullscreen mode

Apply the netplan configurations to make these changes persistent:

$ sudo netplan --debug generate
$ sudo netplan --debug apply
Enter fullscreen mode Exit fullscreen mode

Run the ip -br a command again. If it gives a similar output to the one shown below, it means the interface has been configured.

$ ip -br a
eth0 UP 123.456.78.9/20
Enter fullscreen mode Exit fullscreen mode

You can test this by pinging to a website. Try ping google.com and see if it is working correctly.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay