I am using iptables recent match for my work as it saves ip addresses and there last seen value which I require. But now I need to remove some entries from the iptables recent list and those entries are there in an ipset. Can anyone tell me is it possible or not? And if yes then how can I do it? Thanks.
You can remove within iptables rules with:
... -m recent --remove ...
e.g. to remove entries with less then 5 packets / hour:
-A TEST -m recent --rcheck --seconds 3600 --hitcount 5 --rsource -j RETURN
-A TEST -m recent --remove
The first rule matches source ips with >= 5 pkts/hour and leaves TEST chain via RETURN target. The second rule removes not matched / not filtered packets ( with rate below 5 pkts/hour) from default recent list.
You can remove from userland with:
echo -addr >/proc/net/xt_recent/DEFAULT
to remove addr from the DEFAULT list
echo / >/proc/net/xt_recent/DEFAULT
to flush the DEFAULT list (remove all entries).
e.g. to remove ip 192.168.4.7 from default recent list:
echo -192.168.4.7 >/proc/net/xt_recent/DEFAULT
see also:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With