Akka remote actors from different networks

350 Views Asked by At

I have 2 systems on 2 different networks. One system is in a public cloud and the other system is on a PC. The problem is that i can't access the PC system remotely because, the PC system it has local ip as hostname (e.g. 192.168.1.140) and on cloud system i specified as destination system ip the ip from my public ip. And in the router i made a port forwarding to redirect the traffic that came on a specified port to the actor system. Below is the error that occurs on PC actors system:

[ERROR] [03/27/2015 14:57:54.712] [slave-port-akka.remote.default-remote-dispatcher-6] [akka.tcp://[email protected]:20007/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2Fxxx%40192.168.1.183%3A2005-0/endpointWriter] dropping message [class akka.actor.ActorSelectionMessage] for non-local recipient [Actor[akka.tcp://pc-system@my_public_ip:20007/]] arriving at [akka.tcp://pc-system@my_public_ip:20007] inbound addresses are [akka.tcp://[email protected]:20007] 

Thank you, Marius!

2

There are 2 best solutions below

0
On BEST ANSWER

Solved by creating a VPN and now is more secure and it's working perfectly!

1
On

Akka needs to be able to bind to the same IP or hostname that other remote actor systems will use to address it. If the actor systems in your public cloud are addressing the system on your local box as $MY_PUBLIC_IP, that's what your actor system needs to bind to.

You can use DNS to get around this by both binding to and addressing actor systems by a logical name rather than an IP address. Mapping hostnames in /etc/hosts also works but obviously presents a maintenance headache.

(This will be changing in a future version but you'll still need to ensure that your actor system can be reached by the other actor systems).