0

I am looking to forward a game server (Minecraft) port 25565 with UDP and TCP from one Ubuntu Server to another. I can easily do this with SSH -R option, but it only works for tcp, what can I do to make this work with udp?

1 Answers1

1

The easiest way is to use nc and a FIFO on both sides:

  • First set up another TCP tunnel with ssh -R on port 25566

  • on the source side: connect UDP port 25565 of the target server with TCP port 25566

    mkfifo /some/path/to.fifo nc -l -p 25566 < /some/path/to.fifo | nc -u target.server.ip 25565 > /some/path/to.fifo

  • on the target side: Connect TCP port 25566 with UDP port 25565

    mkfifo /some/path/to.fifo nc -l -u -p 25565 < /some/path/to.fifo | nc source.server.ip 25566 > /some/path/to.fifo

So UDP traffic is encapsulated into TCP on another port and so forwarded via ssh

You might also want to look into ssh -w to create a dead simple VPN via SSH with only two participants. This can then transport any traffic via a tun virtual device.

Eugen Rieck
  • 20,637