How to connect Erlang node on windows 10 with Erlang node on freeBSD 10.3 vm on same machine Using erl -name anynode@hostname?
Asked
Active
Viewed 740 times
1
-
1AFAIK there are two cases of networking between the host and the guest. One is that the guest is getting his IP from the regular DHCP server (same as the host). The other method is it creates a virtual network between guest and host. Either way, you should be able to see this using the `ipconfig` (windows) and `ifconfig` (FreeBSD) commands. Check what are the ips and check for `ping` between them (both from host to guest and guest to host), if it worked then this is probably the right ips to use as `hostname`. – A. Sarid Aug 02 '16 at 13:01
2 Answers
1
As I wrote in the comment you first need to determine the internal network (subnet) between the host (windows) and your guest (FreeBSD VM). Use ipconfig
on windows and ifconfig
commands to get the information.
You will probably notice that one of the IPs in the host has the same prefix as one of the IPs in guest, so this is the subnet. For example, if host has IP 192.168.2.10
and guest has IP 192.168.2.11
meaning that 192.168.2.x
is the network between them. Now we can continue to connect those nodes.
There are few simple steps:
- Enter shell with the right IP and a common cookie.
On Windows -werl -name windows_node@192.168.2.10 -setcookie 'mycookie'
.
On FreeBSD -erl -name freebsd_node@192.168.2.11 -setcookie 'mycookie'
.
You can read more about cookie here and here. - Connect between nodes. This can be done by either
net_adm:ping/1
ornet_kernel:connect_node/1
. You only need to do it from one of the shells. Examples:
From Windows shell -net_adm:ping('freebsd_node@192.168.2.11')
From Linux shell -net_kernel:connect_node('windows_node@192.168.2.10')
- Your nodes should now be connected. You can check this by calling
nodes()
from either one of the shells.

A. Sarid
- 3,916
- 2
- 31
- 56
0
- Host machines on which erlang nodes are running (windows and BSD VM) must have IP connectivity between them, you can verify that by using ping.
- Erlang nodes must be started with same magic cookie, use -setcookie "cookie" when starting erlang node.
- see if erlang nodes can see each other by running nodes() in the shell.

Usman
- 1
- 1