Server 1 and Server 2 (Centos 7) both host the same application, which listens on UDP port 1514. Server 1 receives traffic on this port. The goal is for the application on Server 2 to receive a copy of this traffic.
Server 1 uses iptables to duplicate traffic on UDP 1514 and send it to Server 2:
iptables -t mangle -A PREROUTING -i ens160 -p udp --dport 1514 -j TEE --gateway 10.88.72.40 [server 2]
A tcpdump on Server 2 reveals all of the traffic coming in; HOWEVER, the destination IP is still 10.88.72.41, so the listening application does not detect the traffic. Please help me find a solution so that the application on the second server can detect this traffic. On Server 2, I have tried this policy to rewrite the destination IP of the incoming packets:
iptables -t nat -A PREROUTING -p udp -d 10.88.72.41 --dport 1514 -j NETMAP --10.88.72.40
On Server 1 I have tried similar commands to rewrite (or DNAT) the destination IP of the outgoing packets. I have been working on this for days - if you can solve it I will be eternally grateful!