0

I need to forward UDP port 28015 of my local machine to another machine with port UDP 28021. Rust Game Server. (Redirect incoming traffic on a specific port to a different IP address with altern port)

Tried: sysctl -w net.ipv4.ip_forward=1 sudo iptables -t nat -A PREROUTING -p udp --dport 28015 -j DNAT --to-destination another_server:28021 iptables -t nat -A POSTROUTING -j MASQUERADE

the traffic is redirected, but when you enter the server itself, the "Steam Auth Failed" error pops up.

The problem is not in the server, because when trying to redirect not to mine, but to any other server, the same error pops up.

2
  • Look up rathole on GitHub. Not totally sure, but that might do what you’re looking for
    – cocomac
    Commented Aug 28, 2023 at 1:34
  • No, I need to do a redirect without access to the final server. Commented Aug 28, 2023 at 12:59

1 Answer 1

0

you can do this using socat, no need to NAT in this case

$ socat udp-listen:28015,reuseaddr,fork udp:another_server:28021  

If you do want to use iptables you can use the following

$ sudo iptables -t nat -A OUTPUT -m addrtype --src-type LOCAL --dst-type LOCAL -p udp --dport 28015 -j DNAT --to-destination another_server:28021
$ sudo iptables -t nat -A POSTROUTING -m addrtype --src-type LOCAL --dst-type UNICAST -j MASQUERADE
$ sysctl -w net.ipv4.conf.all.route_localnet=1
1
  • Or using the program udppm from a great package 3proxy (3proxy.ru): udppm -d 28015 another_server 28021
    – raj
    Commented Sep 5, 2023 at 16:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .