Leif
Leif

Reputation: 127

IPv4 to IPv6 UDP Holepunching

So I'm writing a P2P multiplayer game. Server establishes connections (UDP) to each player and then gets the players to connect with each other directly (using the UDP Holepunching technique).

Then I tested at my parents house and wham - stopped working.

The reason is because my parents router is not IPv6 compatible.

Question

Is it possible to do UDP Holepunching between users that have different ip protocols?

Aka

Or is this sort of setup doomed to fail?

Upvotes: 2

Views: 719

Answers (1)

Johannes
Johannes

Reputation: 162

No, it's not directly possible to establish connections between IPv4 and IPv6. If it isn't a realtime-based multiplayer game, there are some possible (gratuitously complex) workarounds.

  1. User A could configure something like Teredo which effectively assigns an IPv6 address to his device.[1]
  2. Both users could connect to a VPN where the server responsible for establishing connections is reachable via both protocols (dual-stack) or both users use IPv4 for connecting.
  3. Both users could try to use NAT traversal on IPv4 (if user A needs to do that). As you have already experienced and described in your third comment UDP hole punching (for user B, IPv4 CGNAT) is a mess.
  4. User A could ask his ISP to finish deploying IPv6.
  5. User B could try to connect to user A via IPv4 if user A is able to open a port. Some CGNAT implementations then keep the connection for 30 seconds so you have to ensure that some sort of keep-alive datagrams get transmitted e.g. in an interval of 25 seconds.
  6. User B could use a portmapper service. Use your favourite search engine: portmapper ds-lite. The service provides an IPv4 address where all connections to a specific port "connect through" to user B's IPv6 address (and a specific port).

[1] From personal experience I can tell you that some of the different available Teredo servers are unreliable. I had to try three different Teredo server configurations and actually need to switch between two of them because none of them is able to access all devices of the IPv6 internet - some devices can be reached via teredo.trex.fi, some of them via teredo.remlab.net - and then sometimes it just turns around.

In my opinion the least complex option would be 4.

If 5 doesn't work, I'd say that user A doesn't have Internet access but slightly enhanced web access only.

Upvotes: 1

Related Questions