2
votes

There are two machines: M1 with two ip addresses 192.168.5.47, 192.168.1.250. And M2 with ip 192.168.5.250.

I launch an erlang node on M1:

nik@nik-PC:~/erlsrc/test_mk$ erl -name '[email protected]' -setcookie cook
Erlang/OTP 22 [erts-10.6.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]

Eshell V10.6.2  (abort with ^G)
([email protected])1> 

Then, I'm making another node on M2 and try to ping M1:

nik2@nik2-PC:~$ erl -name '[email protected]' -setcookie cook
Erlang/OTP 22 [erts-10.6.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]

Eshell V10.6.2  (abort with ^G)
([email protected])1> 
([email protected])1> net_adm:ping('[email protected]').
pang
([email protected])2> 

How to make a communication between nodes on remote machines if one of them has several ip addresses and launched as 'name@localhost' or '[email protected]'? Or it's better to use domain names?

1

1 Answers

1
votes

If nodes is running in one LAN Network but one different computers, you can try detect your IP on each of computer, eg run:

$ hostname -I

Let's pretend that machine 1 has IP 192.168.5.47 and machine 2 has IP 192.168.5.250. Now you ou need run node on machine 1 with flag name what include the IP - machine #1:

$ erl -name '[email protected]' -setcookie cook

Now do the same in machine 2, but use IP of machine 2 - machine #2:

$ erl -name '[email protected]' -setcookie cook

Now you can try send ping from [email protected] to [email protected] - machine #1:

([email protected])1> net_adm:ping('[email protected]').
pong