Skip to contentSkip to conversation

nftables rate limit logging and then drop

DISCUSSION Robert Sander 2 participants 2 messages Dec 2, 2015 – Dec 9, 2015

lore
Share & tools
lore
#0 lore raw

Hi,

How do I implement something like this in nftables:

iptables -A INPUT -m conntrack --ctstate INVALID -m limit --limit 3/m --limit-burst 5 -j LOG --log-level debug --log-prefix "INVALID DROP: " iptables -A INPUT -m conntrack --ctstate INVALID -j DROP

Kindest Regards

Signature · 12 lines
Robert Sander
Heinlein Support GmbH
Schwedter Str. 8/9b, 10119 Berlin

http://www.heinlein-support.de

Tel: 030 / 405051-43
Fax: 030 / 405051-19

Zwangsangaben lt. §35a GmbHG: 
HRB 93818 B / Amtsgericht Berlin-Charlottenburg,
Geschäftsführer: Peer Heinlein -- Sitz: Berlin
#1 lore raw
Quoted 6 lines · Robert Sander

Hi,

How do I implement something like this in nftables:

iptables -A INPUT -m conntrack --ctstate INVALID -m limit --limit 3/m --limit-burst 5 -j LOG --log-level debug --log-prefix "INVALID DROP: " iptables -A INPUT -m conntrack --ctstate INVALID -j DROP

The translation is:

nft add rule filter input ct state invalid \
limit rate 3/minute burst 5 packets \
log level debug prefix \"INVALID DROP: \" counter
nft add rule filter input ct state invalid counter drop

Note that rule counters are optional in nftables, unlikely iptables where we always have them on.