ipset is an excellent tool that can be used to efficiently block a list of IP addresses at the firewall level (it uses iptables). It really helps in easily adding IP addresses and maintaining IP address blocklists.
The below guide sets up ipset to block a list of IP addresses