how to add multiple IPs to iptables

hardbrasil

Regular Pleskian
hello fellas,

i have a list of bad Ips and would like to add it into iptables,
but i dont went to enter one-by-one or by command line,
i would like to insert into list file of iptables editing a file or something like that,

could you share where and how i can procedure to do this?


thanks!
 
You can use the iprange module in combination with '--src-range' like:

# iptables -A INPUT -i eth0 -m iprange --src-range 192.168.1.90-192.168.1.101 -j DROP
 
I do not know the solution. Maybe someone else will advise something useful?
 
You can try to use this script:

Code:
#!/bin/bash
for IP in `cat /root/iplist.txt`; do
    /sbin/iptables -A INPUT -s $IP -j DROP
done
 
Back
Top