VPS – How to Forward UDP IPv6 Port to UDP IPv4 Port in Another VPS

ipv6port-forwardingsshssh-tunneludp

I have VPS let's say VPS X that doesn't have IPv4 but only has IPv6.

and

I have VPS let's say VPS Y that doesn't have IPv6 but only has IPv4.

Since IPv4 is still common used today, and some device unable to access IPv6.

I want use VPS Y network card as an IPv4 for VPS X since VPS X doesn't have IPv4.

I want UDP Port in VPS Y is listening incoming connection from internet then forward the UDP datagram to the UDP Port in VPS X.

I can achieve it with using SSH Forwarding with run this command in VPS X.

SSH -NR 19132:localhost:19133 server

I can connect SSH from VPS X to the VPS Y. But VPS Y can't connect to the VPS X.

Unfortunately SSH Forwarding is only work for TCP Port. While I want UDP Port Forwarding because minecraft bedrock server is using UDP.

Best Answer

Demand IPv6 from your IPv4 only hosting providers. (And all internet connections.) Native direct connectivity is easier to work with.

You have IPv6 only infrastructure to talk to, and need it both directions. ssh forwarding is not an option for UDP. UDP proxy software exists, but does not solve the root cause.

An IPv4 only and an IPv6 only host have no means of communicating with each other without a dual stack host between them doing some kind of translation. For example, possibly your ssh connection from X to Y worked because of a NAT64. Going the other way does not work for arbitrary IP addresses, there no way to encode 128 bits into 32 bits. While you could have both attached to yet another (dual stack) host to do a VPN as an overlay network, this is complicated and adds latency. IPv6 end to end is superior.