Binding Akka remote on 0.0.0.0 interface

1,774 views
Skip to first unread message

gutzeit

unread,
Aug 1, 2012, 8:58:44 PM8/1/12
to akka...@googlegroups.com
Sometimes its useful to bind the remoting on any interface like this:

remote {
        transport = "akka.remote.netty.NettyRemoteTransport"
        netty {
            hostname = "0.0.0.0"
            port = 2552
        }
   }

Service starts and indeed listens on all interfaces. The problem though is when there is an incoming message Akka does not recognise that it is intended for the local system and drops the message since the message address is system@concrete-ip/user/blah while akka thinks that its sys...@0.0.0.0/user/blah, strings do not match, message goes to cold eternal void.

The question is - should it be changed to allow binding to all IPs or is it a design incurred limitation ?

Thanks in advance.

gutzeit

unread,
Aug 2, 2012, 10:55:09 PM8/2/12
to akka...@googlegroups.com
Anything from someone ?

Roland Kuhn

unread,
Aug 3, 2012, 7:36:27 AM8/3/12
to akka...@googlegroups.com
Hi Dima,

the usefulness of binding to 0.0.0.0 depends on why you are trying to do that. If you want to save yourself the hassle of configuring the actor systems with concrete IPs, then you can achieve that also by obtaining the “right” IP programmatically and passing that into the ActorSystem’s config parameter, e.g.

ActorSystem("mySystem", ConfigFactory.parseString("akka.remote.netty.hostname=1.2.3.4").withFallback(ConfigFactory.load()))

How to get the right IP is specific to your situation, depending on the circumstances it might work to use InetAddress.getLocalHost.getHostAddress.

Using 0.0.0.0 might work for binding to all interfaces, but it will not work when some other system tries to reply, because 0.0.0.0 is not a valid target IP. You have to tell the system which IP it should advertise to its partners.

If you want to bind to all interfaces and accept messages no matter of their destination host, try looking up NATFriendlyRemoteTransport (e.g. on this mailing list).

Regards,

Roland

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/v7fQf4Mx77MJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Roland Kuhn
Typesafe – The software stack for applications that scale.
twitter: @rolandkuhn


√iktor Ҡlang

unread,
Aug 3, 2012, 7:46:09 AM8/3/12
to akka...@googlegroups.com
On Fri, Aug 3, 2012 at 1:36 PM, Roland Kuhn <goo...@rkuhn.info> wrote:
Hi Dima,

the usefulness of binding to 0.0.0.0 depends on why you are trying to do that. If you want to save yourself the hassle of configuring the actor systems with concrete IPs, then you can achieve that also by obtaining the “right” IP programmatically and passing that into the ActorSystem’s config parameter, e.g.

ActorSystem("mySystem", ConfigFactory.parseString("akka.remote.netty.hostname=1.2.3.4").withFallback(ConfigFactory.load()))

How to get the right IP is specific to your situation, depending on the circumstances it might work to use InetAddress.getLocalHost.getHostAddress.

The config is also pretty well documented:

 # (I) The hostname or ip to bind the remoting to,
      # InetAddress.getLocalHost.getHostAddress is used if empty
      hostname = ""

 

Using 0.0.0.0 might work for binding to all interfaces, but it will not work when some other system tries to reply, because 0.0.0.0 is not a valid target IP. You have to tell the system which IP it should advertise to its partners.

I.e. Akka Netty Remoting does not support multihoming.

Cheers,



--
Viktor Klang

Akka Tech Lead
Typesafe - The software stack for applications that scale

Twitter: @viktorklang

Reply all
Reply to author
Forward
0 new messages