I have below iptable rule
iptables -A PRIO_IN -p tcp -s 203.0.113.0 --sport 5432 -d 203.0.113.0 --dport 5432 -j ACCEPT -m limit --limit 100000/sec
When i run this rule, i get error as Rate too fast 100000/sec
.
So I want to what is the minimum and maximum value we can pass to --limit
option with per sec, per min and per hour
TL;DR: The max value is 10000
Looking at the source code, in
xt_limit.h
the constantXT_LIMIT_SCALE
is defined as:with the comment:
The constant is then used in the
parse_rate()
function inlibxt_limit.c
, which parses the argument:In your case this means:
mult
is defined as1
forseconds
, so the equation ends up as:The result is then
0.1
which is then rounded to0
, raising the error message.So basically the maximum for each time period is the number of seconds in the time period * 10000