I have 2 servers, called A
and B
. All (tcp/udp) traffic will be redirected (via SNAT) from A
to B
(except SSH).
The clients will be connected to A. However, the response will return from B. This is okay. It works thanks to SNAT.
However, I'd like to limit data usage per ip. Let's say, the client can download maximum 10MB.
There is an iptables module, called quota
. The quota
module works on INPUT
chain on iptables. However, SNAT
works on PREROUITING
chain.
PREROUITING
works before INPUT
chain. Therefore, I can't limit the data usage on the A
server.
How can I limit data usage on the A
server per ip?