Ginsan Ginsan - 10 months ago 84
Scala Question

Akka Port Forwarding

I am trying to perform port forwarding towards my Akka program where the client can communicate with the server over the Internet. I have configured my router and the port forwarding mechanism is working but there seems to be a problem with Akka.

The problem is that the client is unable to obtain the remote actor from the server. It keep coming out error at the server side that the recipient are different. The client is obtaining the remote actor through

is my global IP address for example. Then the remote actor is remoting at the path
is my local IP of the server. I know that the client must access the remote actor using the same path but despite I defined the
, the server still doesn't translate the global IP to the local IP or allow access through the global IP. Is there any workaround to it? Below is the
of the server.

akka {
loglevel = "INFO"

actor {
provider = "akka.remote.RemoteActorRefProvider"

remote {
enabled-transports = ["akka.remote.netty.tcp"]
netty.tcp {
hostname = ""
port = 5150
public-hostname = ""

log-sent-messages = on
log-received-messages = on


Answer Source

The config parameter is "bind-hostname" for the interface you want to bind to, and "hostname" for the public IP. You also need to set "bind-port" for the local port to bind to, and "port" for the public IP.

Consult the documentation for more details: