Blocking a list of IP addresses with iptables
In case you need to quickly ban a list of IP addresses from connecting to your server, iptables is perfect for the job.
iptables is a user-space firewall that can control incoming and outgoing connections with policies and filter rules.
Blocking ingress from a single IP is easily done with a single iptables rule. We can use this same command to automate the creation of many rules with a bash script that will read our list of IP addresses from a file.