Forward incoming UDP Packets on Windows Server to client on different interface
I have the following setup with 2 networks and 3 clients:
-
Network A: 192.168.0.0/16
-
Network B: 172.16.0.0/12
-
Client 1 is connected to Network A (192.168.0.1)
-
Client 2 (Windows Server) is connected to Network A (192.168.0.2) and Network B (172.16.0.2)
-
Client 3 is connected to Network B (172.16.0.1)
In my setup Client 2 acts as a bridge between the two networks. I can't modify the existing network structure, install any software on Client 1 or 3 or modify the system in any way.
Client 1 is sending UDP Packets to Client 2 (192.168.0.2) to Port 1202. Now I want to forward the Packets to Client 3 (172.16.0.1) to Port 1202. If possible, this should also work in the opposite direction.
The following command using netsh should have made this work.
netsh interface portproxy add v4tov4 listenaddress=192.168.0.2 listenport=1202 connectaddress=172.16.0.1 connectport=1202
However, this only works for TCP traffic and not for UDP.
I also found a program called Simple UDP proxy/pipe found on this website, however I could not get it to forward any traffic.
I would recommend using socat... this program also exists for windows link. It takes a little time to read into that tool, but it is really powerful.
Here is an explanation how to forward udp traffic with socat.
There exists another way: you could turn your windows server into a network router. This article explains how. You would need the correct routes installed at client 1 & 3 - so this option is more complicated.