0

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.

0

No. You would not be able to do that with iptables. What you're wanting would require writing an actual program to listen on those ports and interact with the packets on its own, as well as tracking key:value pairs for the instant response.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.