remote nodes 1: Setting up ports

Boy oh boy. I love port configuration on two different OS’s. To get started get that port for EPMD (that would be Erlang Port Mapper Demon, not the rappers) opened up. EPMD allows your nodes to communicate with each other over a range of different ports you specify at erl startup. That comes in a second though, first:

iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 4369 -j ACCEPT

Open port 4369, which is was EPMD always runs on. Now start erl with a min and max port number for communication set:

erl -sname "away" -setcookie abc123 -kernel inet_dist_listen_min 4001 inet_dist_listen_max 4001

Now I check that EPMD is running properly:

netstat -an | grep "LISTEN"

and lo and behold I see:

tcp 0 0 0.0.0.0:4001 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN

ok. good for me! Now onto the local. I’m on my mac, so I can be dumb about this and allow traffic on 4369 in Sharing/Firewall, setting up a new service and assigning it port 4369. Now when I start erl on my mac using:

erl -sname "base" _setcookie abc123 -kernel net_dist_list_min 4001 inet_dist_listen_max 4001

and then netstat, I can see:

tcp4 0 0 *.4369 *.* LISTEN

which means EPMD is up and running and we’re ready to start communicating between nodes. Yippee.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>