Linux control packet size for specific IP address

I would like to get Linux tool/script to control packet size of specific IP or MAC. For example if IP reach 10 MB then DROP packages with IP tables. I have idea how to DROP, but I don't have idea how to control packet size for specific multiple IP address


You want to read man iptables-extensions and man ipset. You can use ipsets to track IP addresses (iptables with --add-set) along with a counter and a timeout. Then you make an iptables rule with -m set --match-set (read the docs) and --bytes-gt