What is an efficient alternative to iptables for bulk usage? [migrated]


Suppose I have a list of thousands of ip addresses to block. Right now I know how to iterate through the list and for each one run:

iptables -A INPUT -s XX.XX.XX.XX -j DROP 

But this means I will have to run thousands of processes!

How can I do this more efficiently?