Skip to main content

ipset for iptables huge sets filtering

Start by installing the necessary software: apt-get install zip unzip ipset

Next, create a hash set: ipset create hash_block hash:net

To block TCP connections, use the following command:

iptables -I INPUT -p tcp --dport 25565 -m set --match-set sfs_block src -j DROP

This might be useful with proxy lists (a similar mechanism works on, for example, with the StopForumSpam list:

ipset destroy temporably
ipset create hash_block hash:net
ipset create temporably hash:net
wget -N -P /tmp
unzip /tmp/ -d /tmp/
sed 's:^:add tempset :' /tmp/listed_ip_7.txt > /tmp/listed_ip_7_importfile.txt
ipset restore < /tmp/listed_ip_7_importfile.txt
rm /tmp/listed_ip_7_importfile.txt /tmp/listed_ip_7.txt /tmp/
ipset swap tempset hash_block
comments powered by Disqus