3

By default docker appears to not do UDP hole punching.

Is there anyway to turn this on? Or is this not supported at all?

Note: UDP hole punching is different from the port forwarding configured with the -p option. It means a device can respond to a UDP packet originating from your docker image using the source IP Address and port in the packet received and the NAT maps it back to the correct image and port. This is a feature most routers support by default.

Maybe I should explain why I want this instead of -p forwarding built into docker. We know the IP Address of the devices we want to talk to from our docker image when we send our UDP packet to that device if we use the -p forwarding then the reply packet gets forwarded to us but both the from address and port are changed by the docker NAT. This means that when we receive that packet we don't actually know who it is from. This might be OK if you are only talking to one device, however we can be talking to many, so when you get a packet from a different address then what we sent to, we have no way to know who that packet is actually from. We are hoping with UDP hole punching the from address would remain intact.

trampster
  • 8,598
  • 4
  • 37
  • 52
  • Also ref: https://stackoverflow.com/questions/27596409/how-do-i-expose-a-udp-port-on-docker – Timir May 03 '18 at 04:38
  • Yes that's what I cover in my note at the bottom of my question and is absolutely not what I am asking about. UDP hole punching is something quite different. Hole punching allows replies to packets originating from within a NAT, Port forwarding allows packets originating from outside the NAT to be forwarded to the correct internal address. You should be able to do UDP hole punching without needing to configure port forwarding at all. At least this is how a normal NAT works. – trampster May 03 '18 at 04:44
  • This seems to imply docker can't do it buts its a less then official source, https://twitter.com/denormalize/status/913874394421719040 – trampster May 03 '18 at 04:49

0 Answers0