# Block domains that resolve to malicious IPs like Control D

**URL:** <https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416>\
**Category:** Community Help\
**Created:** [July 8, 2022, 7:40pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416 "2022-07-08T19:40:27Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![dns\_guy01](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/d/5daacb/32.png) [@dns\_guy01](https://discourse.pi-hole.net/u/dns_guy01)\
**Post date:** [July 8, 2022, 7:40pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/1 "2022-07-08T19:40:27Z")

</div>

Hi everyone,

is there any way to have PiHole block domains that resolve to lists of IPs? Basically resolve each domain and match the A records against an IP blocklist.

ControlD has this feature, and the only reason I ask is because Im too poor to pay for Control D, so I wish Pihole supported this.

---

<div class="post-metadata">

**Author:** ![jfb](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jfb/32/4332_2.png) [@jfb](https://discourse.pi-hole.net/u/jfb)\
**Post date:** [July 8, 2022, 7:54pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/2 "2022-07-08T19:54:53Z")

</div>

> [@dns\_guy01](#):
>
> to have PiHole block domains that resolve to lists of IPs?

That is essentially how Pi-hole works. All domain names lead to IP's. Pi-hole blocks domain names, and thus blocks the matching IP's.

---

<div class="post-metadata">

**Author:** ![dns\_guy01](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/d/5daacb/32.png) [@dns\_guy01](https://discourse.pi-hole.net/u/dns_guy01)\
**Post date:** [July 8, 2022, 8:10pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/3 "2022-07-08T20:10:28Z")

</div>

Well, not exactly. Yes I can load in a whole bunch of domain lists, and block them from resolving. What Im asking is the ability to also load IP lists (in cidr notation) and have Pihole also match the resolved IPs from domains that were not blocked by domain lists, against these IP lists. If there is a match (A record is in the "bad IPs" list), block it.

I wanna use the Spamhaus DROP lists (and a few other IP intelligence feeds) to do additional blocking on top of domain lists. [https://www.spamhaus.org/drop/](https://www.spamhaus.org/drop/)

Hope that explains it better.

---

<div class="post-metadata">

**Author:** ![dns\_guy01](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/d/5daacb/32.png) [@dns\_guy01](https://discourse.pi-hole.net/u/dns_guy01)\
**Post date:** [July 8, 2022, 8:16pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/4 "2022-07-08T20:16:18Z")

</div>

To add to the above, specifically point #6 in the Control D knowledge base: [https://kb.controld.com/en/faq#so-this-is-like-pi-hole](https://kb.controld.com/en/faq#so-this-is-like-pi-hole)

---

<div class="post-metadata">

**Author:** ![jfb](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jfb/32/4332_2.png) [@jfb](https://discourse.pi-hole.net/u/jfb)\
**Post date:** [July 8, 2022, 8:24pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/5 "2022-07-08T20:24:57Z")

</div>

> [@dns\_guy01](#):
>
> the ability to also load IP lists (in cidr notation) and have Pihole also match the resolved IPs from domains that were not blocked by domain lists, against these IP lists.

Pi-hole will not do that.

A firewall or router (with the correct software) can block IP's.

---

<div class="post-metadata">

**Author:** ![dns\_guy01](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/d/5daacb/32.png) [@dns\_guy01](https://discourse.pi-hole.net/u/dns_guy01)\
**Post date:** [July 8, 2022, 8:43pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/6 "2022-07-08T20:43:36Z")

</div>

Sure, but why can't Pi-Hole support this, it's clearly possible and a good security feature imo. Im no developer but matching 1-5 IPs that most DNS records resolve to against a list of IPs seems rather trivial.

---

<div class="post-metadata">

**Author:** ![jpgpi250](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jpgpi250/32/286_2.png) [@jpgpi250](https://discourse.pi-hole.net/u/jpgpi250)\
**Post date:** [July 8, 2022, 8:45pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/7 "2022-07-08T20:45:11Z")

</div>

Asked and rejected in july 2019, see [here](https://discourse.pi-hole.net/t/pihole-ftl-block-ips-from-lists/21319), read the arguments...

edit  
I now use pfsense + pfBlockerNG (the IP part only) to achieve IP address based blocking.  
/edit

---

<div class="post-metadata">

**Author:** ![dns\_guy01](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/d/5daacb/32.png) [@dns\_guy01](https://discourse.pi-hole.net/u/dns_guy01)\
**Post date:** [July 8, 2022, 8:55pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/8 "2022-07-08T20:55:28Z")

</div>

Hmm, maybe Im daft, but I didnt see any real arguments against why its a bad idea except for multiple domains sharing an IP, which to me is not a deal breaker or a problem. Its rare for an IP to be hosting a bunch of legit site and distribute malware at the same time. If that exists, Im willing to bite the bullet and this is entirely user configurable. Most domain blocklists are full of stuff that shouldn't be blocked but is, I don't see how this is any different.

I was really hoping not needed to run more software, but looks like this is the only option....

---

<div class="post-metadata">

**Author:** ![yegor](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/yegor/32/31639_2.png) [@yegor](https://discourse.pi-hole.net/u/yegor)\
**Post date:** [July 8, 2022, 9:06pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/9 "2022-07-08T21:06:54Z")

</div>

Hi folks,

Control D guy here, someone linked me to this thread. Funny enough, your thread ([pihole-FTL: block IP's from lists](https://discourse.pi-hole.net/t/pihole-ftl-block-ips-from-lists/21319)) was the reason why we added this feature.

Is it bulletproof and prevents malicious software running on your network from resolving malicious domains that point to bad IPs, through a hardcoded resolver/DoH? Nope, but the same is true for "malware domain" blocklists most people run on their Pi-Hole. To us, it just seemed like a no-brainer addition that takes advantages of many existing IP threat intelligence feeds. Can you bet your life on it, absolutely not. Is it still useful? We thought so.

Mind you, there IS a performance hit if you need to parse the A/AAAA records against IP blocklists (especially if they're in CIDR notation since this is not a O(1) lookup), but the difference is ~1ms, so we felt it was worth it.

---

<div class="post-metadata">

**Author:** ![jpgpi250](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jpgpi250/32/286_2.png) [@jpgpi250](https://discourse.pi-hole.net/u/jpgpi250)\
**Post date:** [July 8, 2022, 9:16pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/10 "2022-07-08T21:16:59Z")

</div>

> [@yegor](#):
>
> through a hardcoded resolver/DoH?

read this [document](https://jpgpi250.github.io/piholemanual/doc/Block%20DOH%20with%20pfsense.pdf) about blocking (o)DoH, daily generated [IPv4](https://raw.githubusercontent.com/jpgpi250/piholemanual/master/DOHipv4.txt) and [IPv6](https://raw.githubusercontent.com/jpgpi250/piholemanual/master/DOHipv6.txt) lists on [GitHub](https://github.com/jpgpi250/piholemanual), RPZ [file](https://raw.githubusercontent.com/jpgpi250/piholemanual/master/DOH.rpz) also available for use with unbound ([how to](https://jpgpi250.github.io/piholemanual/doc/Unbound%20response%20policy%20zones.pdf)), knot-resolver, bind, ...

---

<div class="post-metadata">

**Author:** ![DanSchaper](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/danschaper/32/91_2.png) [@DanSchaper](https://discourse.pi-hole.net/u/DanSchaper)\
**Post date:** [July 8, 2022, 9:38pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/11 "2022-07-08T21:38:42Z")

</div>

To be fair, 2019 was quite a while ago and things have vastly changed since then. Both in mindset of the team and capabilities with improved codebase.

That FR is 3 years old now and it's still open. I don't think it's fair to say the idea was rejected since we move FRs to not-implemented and close them down if they are truly dead.

---

<div class="post-metadata">

**Author:** ![yegor](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/yegor/32/31639_2.png) [@yegor](https://discourse.pi-hole.net/u/yegor)\
**Post date:** [July 11, 2022, 5:47pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/12 "2022-07-11T17:47:55Z")

</div>

I mean you CAN totally do all of this, but that defeats the whole point of Pi-Hole's simplicity. Not a lot of people run pfSense as their router, and the barrier to entry is a LOT higher than installing Pi-Hole.

---

<div class="post-metadata">

**Author:** ![jpgpi250](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jpgpi250/32/286_2.png) [@jpgpi250](https://discourse.pi-hole.net/u/jpgpi250)\
**Post date:** [July 27, 2022, 2:49pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/13 "2022-07-27T14:49:41Z")

</div>

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](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/10) (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:

```auto
$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:

```auto
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:

```auto
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:  
 ![iprpz](https://discourse.pi-hole.net/uploads/default/original/3X/3/c/3c110aa82c11ddbbf22e9682b7f7724d914f938d.gif)

you never mentioned the source of your IP blacklist(s). I've been using [talos](https://talosintelligence.com/documents/ip-blacklist) (warning: there is a limit of the number of downloads in a given time) and [firehol](https://iplists.firehol.org/files/firehol_level3.netset). I download (refresh) these lists once a day, currently using them in pfblockerng (pfsense).

according to [this](https://askubuntu.com/questions/557098/bash-command-to-convert-ip-addresses-into-their-reverse-form) 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...

---

<div class="post-metadata">

**Author:** ![yegor](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/yegor/32/31639_2.png) [@yegor](https://discourse.pi-hole.net/u/yegor)\
**Post date:** [July 27, 2022, 5:34pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/14 "2022-07-27T17:34:05Z")

</div>

Heya,

I can't speak to any of the above, as we use a custom built DNS server + blocklist parser. We don't work with RPZ files or have any upstream dependencies.

While doing IP matching, you have to perform a DNS lookup and wait for the results, this can add anywhere from 1ms (cached) to 1s (full recursive lookup) of latency. The matching behavior adds about ~1ms of latency on top of that with these sources that we currently have in production.

"[https://www.spamhaus.org/drop/drop.txt](https://www.spamhaus.org/drop/drop.txt)",  
"[https://www.spamhaus.org/drop/edrop.txt](https://www.spamhaus.org/drop/edrop.txt)",  
"[https://www.spamhaus.org/drop/dropv6.txt](https://www.spamhaus.org/drop/dropv6.txt)",  
"[http://lists.blocklist.de/lists/dnsbl/all.list](http://lists.blocklist.de/lists/dnsbl/all.list)",  
"[https://feodotracker.abuse.ch/downloads/ipblocklist.txt](https://feodotracker.abuse.ch/downloads/ipblocklist.txt)",  
"[https://rules.emergingthreats.net/blockrules/compromised-ips.txt](https://rules.emergingthreats.net/blockrules/compromised-ips.txt)",  
"[https://raw.githubusercontent.com/ktsaou/blocklist-ipsets/master/firehol\_level1.netset](https://raw.githubusercontent.com/ktsaou/blocklist-ipsets/master/firehol_level1.netset)",  
"[https://raw.githubusercontent.com/firehol/blocklist-ipsets/master/firehol\_level2.netset](https://raw.githubusercontent.com/firehol/blocklist-ipsets/master/firehol_level2.netset)",  
"[https://snort.org/downloads/ip-block-list](https://snort.org/downloads/ip-block-list)"

This list will be expanded when our lists are open sourced in the next little while, however they will be published in a flat file format (line per CIDR). Converting them to RPZ format is pretty trivial, probably a ~50 line script would do the job.

---

<div class="post-metadata">

**Author:** ![DanSchaper](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/danschaper/32/91_2.png) [@DanSchaper](https://discourse.pi-hole.net/u/DanSchaper)\
**Post date:** [July 27, 2022, 6:17pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/15 "2022-07-27T18:17:11Z")

</div>

> [@jpgpi250](#):
>
> I had a conversation with a developer, aparently this (the feature request and your request in this topic) isn't going to happen. Primary reason (and I agree):

Can you share that conversation with me?

---

<div class="post-metadata">

**Author:** ![jpgpi250](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jpgpi250/32/286_2.png) [@jpgpi250](https://discourse.pi-hole.net/u/jpgpi250)\
**Post date:** [July 27, 2022, 7:34pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/17 "2022-07-27T19:34:23Z")

</div>

done...

---

<div class="post-metadata">

**Author:** ![DanSchaper](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/danschaper/32/91_2.png) [@DanSchaper](https://discourse.pi-hole.net/u/DanSchaper)\
**Post date:** [July 27, 2022, 7:38pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/18 "2022-07-27T19:38:03Z")

</div>

I just read that private thread. I really don't think it's fair to @DL6ER to distill all of what he said to a one sentence quote that takes everything out of context.

I've asked you before and I'm reminding you again, if you publicly post things from private conversations with developers then the likelyhood of the developers continuing to discuss things in private with you will vastly decrease. Please don't do this.

---

<div class="post-metadata">

**Author:** ![jpgpi250](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jpgpi250/32/286_2.png) [@jpgpi250](https://discourse.pi-hole.net/u/jpgpi250)\
**Post date:** [July 27, 2022, 7:43pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/19 "2022-07-27T19:43:59Z")

</div>

Sorry for that, I just assumed this argument would reflect the "why not" as good and short as possible, thus avoiding people, including me, getting their hope up to ever see this request being part of pihole. I therefore presented an alternative, which, by the look of it isn't a good alternative (increased latency)...

quotes will not happen again (quote removed)...

---

<div class="post-metadata">

**Author:** ![system](https://discourse.pi-hole.net/uploads/default/original/3X/7/c/7c8792f649eeb921c5d2b4c41564ffa873d9a2b8.png) [@system](https://discourse.pi-hole.net/u/system)\
**Post date:** [August 17, 2022, 7:44pm UTC](https://discourse.pi-hole.net/t/block-domains-that-resolve-to-malicious-ips-like-control-d/56416/20 "2022-08-17T19:44:47Z")

</div>

Closed on August 17, 2022, 7:44pm UTC

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
