edit
quote removed
/edit
A solution for unbound (tested) and probably bind and knot-resolver (not tested) users:
I already mentioned response policy zones here (just a few entries above this one). I've been using this feature to block domains, however, reading up on this, it turns out you can use rpz to block IP's
an example (test only, remove after testing !!!)
create a response policy zone source file (/var/www/html/ip.rpz) like this:
$TTL 30
@ SOA pi.hole. hostmaster.pi.hole. 2207240509 300 1800 604800 30
NS localhost.
;
32.30.154.239.213.rpz-ip CNAME .
32.31.154.239.213.rpz-ip CNAME .
create another rpz entry (see the doc I've made) entry in the unbound config file:
rpz:
name: iprpz
zonefile: zonefiles/ip.zone
url: http://127.0.0.1/ip.rpz
rpz-action-override: nxdomain
rpz-signal-nxdomain-ra: yes
rpz-log: yes
rpz-log-name: iprpz
restart unbound (once unbound knows about the zone, you can reload the zone with sudo /usr/sbin/unbound-control auth_zone_transfer "iprpz"
)
dig the domain (remember example, remove after test!): dig tweakers.net
result in the unbound log:
Jul 27 15:49:29 unbound[19920:0] info: rpz: applied [iprpz] 213.239.154.30/32 rpz-nxdomain fdaa:bbcc:ddee:2::5552@55159 tweakers.net. A IN
my alerting:
you never mentioned the source of your IP blacklist(s). I've been using talos (warning: there is a limit of the number of downloads in a given time) and firehol. I download (refresh) these lists once a day, currently using them in pfblockerng (pfsense).
according to this article, there are a few methods you can use to convert the IP addresses in these lists into a valid rpz file entry. Maybe a linux expert can even recommend a better way.
This implies of course you need to download the talos, firehol, ... list(s), and use them to create a valid rpz file; I'm sure your system has some spare resouces (night) to perform this task.
thoughts...