0

i want to run a publicly accessible Rust server on a windows machine behind some routers and firewalls. the idea is tunneling the local server ports to a public machine where they are accessable: rust server on windows behind firewalls <- putty tunnel -> linux with no firewalls <- rust client somewhere on a PC

the rust server runs on port 28015. all works fine locally "client.connect localhost 28015". locally there is also tcp port 28016 for rcon, and i think some magic on udp 28015 - i'm not sure if that is really needed.

with putty i have created a tunnels from windows to the remote linux machine: R28015 127.0.0.1:28015, R28016 127.0.0.1:28016 i can test them using telnet localhost 28015 and telnet localhost 28016. i do NOT get connection refused, so i think the tunnel works. right? i changed the settings in SSHD config, so that also telnet linuxhostname 28015 works.

sadly, it is not possible to connect with the rust client "client.connect linuxhostname 28015". i get timeout.

maybe rust needs the UDP as well. so i try to use socat to get UDP through the TCP tunnel.

i set up another putty tunnel: R50053 127.0.0.1:50053 and used socat to a) on windows map udp 28015 to tcp 50053 locally command: socat udp-listen:28015,reuseaddr,bind=127.0.0.1,fork tcp:127.0.0.1:50053 b) on linux map tcp 50053 to udp 28015 command: socat tcp4-listen:50053,reuseaddr,fork,bind=127.0.0.1 UDP:127.0.0.1:28015

at least that was the plan. after some testing, i'm stuck at a point where i get an error message on linux side: socat[954671] E bind(5, {AF=2 127.0.0.1:50053}, 16): Address already in use.

what's wrong? the whole idea or just the use (config) of socat?

  • 2
    Why don't you simply configure the firewall in front of the Windows server so that it allows connections to the ports you need? – Lacek Feb 16 '23 at 15:49
  • 1
    If configuring firewall(s) is not an option, then you should use a VPN for the traffic. Much less hacky than socat over SSH tunnel. – Tero Kilkanen Feb 17 '23 at 07:31
  • I considered using a VPN but was faced with relatively high costs for what I want to use it. The putty + socst solution should do the job with no extra cost (only a little extra configuration effort). Configuration of the firewalls is not possible. – weiss100 Feb 19 '23 at 11:47

0 Answers0