• We value your experience with Plesk during 2025
    Plesk strives to perform even better in 2026. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2025.
    Please take this short survey:

    https://survey.webpros.com/

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