Question

I cannot seem to connect via private ip address between 2 droplets

I have 2 droplets, same data center behind the same fire wall. I have enabled private networking. My end goal is to have a web application on droplet 1 and mysql database on droplet 2 and connect the two via private network IP over port 3306. However, I cannot ping from droplet 1 to droplet 2 using the private ip address. I’m not sure what i’m doing wrong. Ports 22,80,443 are open on the firewall. Ubuntu 16.

Thank you!

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.

jarland
DigitalOcean Employee
DigitalOcean Employee badge
August 29, 2018
Accepted Answer

Hey friend!

Most often when receiving reports of this, the case is that at least one droplet has had private networking enabled after it’s creation, but it has not been set up yet in the operating system. If that might be the case for you, try these instructions:

https://www.digitalocean.com/docs/networking/private-networking/how-to/enable/#manual

You will also want to make sure that the droplets are both on the same account, as private networking will be limited in communication to droplets on that same account.

Jarland

In case this helps, additionally to correctly enabling VPC on your droplets (if unable, you can always destroy them and recreate them with the VPC option), I had trouble signing in from one droplet to another over ssh. I got a public key error. To solve that, I did the following:

Assuming you want to ssh with user myuser, make sure your .ssh folder is owned by myuser and belongs to group myuser:

sudo chown myuser ~/.ssh sudo chgrp myuser ~/.ssh

and the same for authorized_keys and other files in .ssh.

In droplet1, create a config file in .ssh with:

Host droplet2 (or whatever you want) Hostname <ip_droplet_2> User myuser IdentityFile <path_private_key>

And you can do the same on droplet2, setting the connection data for droplet1.

The IdentityFile finally made it work.

For future readers of this thread: Also, if a DO Cloud-firewall has been setup for the target droplet, the firewall must be open to ICMP protocol for Ping to work.

Try DigitalOcean for free

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

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

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

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel