Is it possible to run akka nodes behind NAT (each node is behind separate nat, public port is DNAT'ed to private)? Currently I'm trying to deploy akka nodes in docker container. Docker is Natting public port to instance private port, problem is that akka node's address is created from akka.remote.netty.tcp.hostname, but in natted environment it differs from public facing hostname. message coming from public interface are rejected cause akka is bound to private ip. Is it possible to change akka nodes address not respecting akka.remote.netty.tcp.hostname, lets say current nodes address is akka.tcp://[email protected]:2551, where 172.16.10.5 is akka.remote.netty.tcp.hostname, but I want to change it to akka.tcp://[email protected]:2551, where 10.2.0.222 is public accessible address, but akka still should be listening on 172.16.10.5:2551.
Maybe you can instruct Akka or Netty to bind on a specific address and port, but announce itself on a different one. I don't understand Akka or Netty well enough to know if it's possible.
Otherwise, there are three things that you can try:
0.0.0.0
, and then do "identity port-binding", i.e. docker run -p 1234:1234 …
which will expose port 1234 outside the container to port 1234 inside the container (thus mitigating the NAT a little bit);Yes, it's possible - you need to configure the bind-host
and bind-port
for remoting in addition to the usual host
and port
.
How to configure Akka behind NAT from the Akka docs.
Native support for this is out since Akka 2.4.x; and 2.3.11 for Typesafe subscription customers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With