I would like to allow two clients (on the left side) to talk to one remote entity (on the right). All entities besides the linux PC are not configurable w.r.t. to listening ports.
I imagined the solution to be as follows
And use the following iptables configuration
iptables -t nat -F POSTROUTING
iptables -t nat -F PREROUTING
sudo iptables -t nat -A PREROUTING -i enp10s0 -p udp --sport 55555 -j DNAT --to a.b.c.d:55555
sudo iptables -t nat -A PREROUTING -i enp7s0 -p udp --dport 33333 -j DNAT --to 192.168.11.11:55555
sudo iptables -t nat -A PREROUTING -i enp7s0 -p udp --dport 44444 -j DNAT --to 192.168.11.12:55555
sudo iptables -t nat -A POSTROUTING -o enp7s0 -p udp --dport 55555 -j SNAT --to-source e.f.g.h
sudo iptables -t nat -A POSTROUTING -o enp10s0 -p udp --match multiport --sports 33333,44444 -j SNAT --to-source 192.168.11.2
But that does not work:
- On 192.168.4.1, I see incoming traffic from 192.168.11 and .12
- But on the linux PC I do not see any traffic being received on e.f.g.h to be forwarded to the .11 and .12 clients. Where is my mistake or how can I achieve the desired outcome by other means?