I have a server set up to forward all of its packets on a certain port to another host with the following command;
iptables -t nat -A PREROUTING -p udp --dport PORT -j DNAT --to-destination IP:PORT
There's quite a delay caused by this due to how far away the servers are from eachother, and the data is almost always the same. I was wondering if iptables has some kind of method so if it receives a UDP packet, it can cache the response and then send that back to all identical requests.
For example, if the server receives "hello" in a UDP packet, it then forwards it to another server and receives "world" from that server (as all of it's traffic on that port is forwarded). Then I want it to respond with "world" everytime it receives "hello" without forwarding it to the second server again. Eg, all subsequent requests are cached.
Hopefully someone can point me in the right direction with this. Thanks.