• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

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