Two digital ocean nodes running elixir won't connect

I have two digital ocean instances each running an elixir app but I can’t get them to connect to each other via longnames and Node.connect.

I’m using digitalocean private IPs to connect and the machines definitely can see each other as I can ping them, from each other and they definitely have the cookies set to be the same.

It’s hard to trouble shoot why nodes won’t connect since all it does is return false.

Any ideas what is wrong?

Do you have the required ports open (default 4369)?

Below are the netstats of both machines, there are no firewalls enabled. Do I have to open ports explicitly?

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 *               LISTEN      9622/beam.smp
tcp        0      0*               LISTEN      -
tcp        0      0  *               LISTEN      9660/epmd
tcp6       0      0 :::4369                 :::*                    LISTEN      9660/epmd
udp        0      0*                           -
udp        0      0 *                           9601/narcd

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 *               LISTEN      9105/beam.smp
tcp        0      0  *               LISTEN      9105/beam.smp
tcp        0      0  *               LISTEN      9146/epmd
tcp        0      0*               LISTEN      -
tcp6       0      0 :::4369                 :::*                    LISTEN      9146/epmd
udp        0      0*                           -
udp        0      0 *                           9085/narcd

You could try starting epmd in the foreground to see what it says when you try to connect them.

Okay I’ll give this a try when i get the chance later and give an update.

Thanks for your help so far guys!

When you ask your internal DNS, will the longnames resolve to IPv6 or IPv4 Addresses, or are you using IPs directly in the longnames?

i’m using the digital ocean private ips in the long names

As I’m not using DO, I have to ask whether they are v4 or v6. If the latter, try the former.


Is private networking enabled for your droplets?

1 Like

I think we can assume so:

I’m using v4.

Haven’t really been having any success with this, can’t help but feel there is something i’m missing here but there is no feed back as to why its not working epmd -d doesn’t really show anything…

I should probably add that the instances are running inside docker containers… maybe that could be the issue?

In your docker file do you expose the necessary ports?


I’ve managed to get it working now, indeed the problem was the random ports that erlang listens on needed opening, not just the epmd port.

iex --erl ‘-kernel inet_dist_listen_min 10001’ --erl ‘-kernel inet_dist_listen_max 10010’

running elixir with the inet_dist_listen ports fixed to a certain range, then opening all the ports in that range to tcp traffic solved the issue!

Thanks for the help everyone!


UPDATE: Solved: Stupid mistake. I was calling restart instead of daemon. :frowning:

I think I might be running into this same problem.

Is this still the fix, and do you think it’s unique to DigitalOcean?

(I had my app working on Google Computer, and did not have to worry about randome erlang ports.)

Now that I have switched to DigitalOcean, it’s not talking to epmd: I run epmd in the foreground, and then launch my release, and epmd hears nothing.