# NXDOMAIN And Null Blocking With FTLDNS

**URL:** <https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634>\
**Category:** Announcements\
**Tags:** ftldns-beta\
**Created:** [May 18, 2018, 10:40am UTC](https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634 "2018-05-18T10:40:19Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![jacob.salmela](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jacob.salmela/32/8_2.png) [@jacob.salmela](https://discourse.pi-hole.net/u/jacob.salmela)\
**Post date:** [May 18, 2018, 10:40am UTC](https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634/1 "2018-05-18T10:40:19Z")

</div>

Originally published at: [https://pi-hole.net/2018/05/18/nxdomain-and-null-blocking-with-ftldns/](https://pi-hole.net/2018/05/18/nxdomain-and-null-blocking-with-ftldns/)  
   
Pi-hole has traditionally returned a blank HTML page in place of advertisements. An alternative method is to return `NXDOMAIN`--[_no such domain_](https://tools.ietf.org/html/rfc8020). This is a behaviour [you asked us to implement](https://discourse.pi-hole.net/t/implement-response-zone-policies-nxdomain-for-end-user-performance-increase/1342) and we have listened.

To use it, you'll need to be running the FTLDNS beta (`pihole -up` if you're already on it):

```
echo "FTLDNS" | sudo tee /etc/pihole/ftlbranch
pihole checkout core FTLDNS 
pihole checkout web FTLDNS
```

You can also checkout the `development` branches, but if you want the most up-to-date code, use the `FTLDNS` branches.

Once you've checked out on the new branches, you need to add this to `/etc/pihole/pihole-FTL.conf` (note you may need to create this file if it does not exist)

```
BLOCKINGMODE=NXDOMAIN
```

or

```
BLOCKINGMODE=NULL
```

depending on which [method you prefer](https://docs.pi-hole.net/ftldns/blockingmode/) and then restart FTLDNS (`pihole-FTL`) to apply the change

```
sudo service pihole-FTL restart
```

# What Is NXDOMAIN?

This is a mechanism built into DNS that can be returned as an answer when the domain doesn't exist. You can see this response by using `nslookup` on a domain that is not likely to be registered:

```
me@pihole:~$ nslookup skfmndfosfmmpofpwmf.com
Server: 8.8.8.8
Address: 8.8.8.8#53

**server can't find skfmndfosfmmpofpwmf.com:** NXDOMAIN**
```

There are benefits and drawbacks to both methods, but `NXDOMAIN` response has been [an open feature request for some time](https://discourse.pi-hole.net/t/implement-response-zone-policies-nxdomain-for-end-user-performance-increase/1342). This functionality is [now available in _FTL_DNS](https://github.com/pi-hole/FTL/pull/259).

## Benefits And Drawbacks Of Serving HTML Or Using A 404 (The current method)

### Benefits

- The block page can be used and is fully functional

### Drawbacks

- Additional software to run the Web server is needed
- Performance _may_ be slightly impacted
- Firewall rules are often needed to [prevent slow loading pages](https://discourse.pi-hole.net/t/why-some-pages-load-slow-when-using-pi-hole-and-how-to-fix-it/6945) (But even then you can still run into issues with certain routers)

## Benefits And Drawbacks Of NXDOMAIN

### Benefits

- Improved speed and performance
- No Web server needed
- No connections made to Pi-hole for blocked domains (except for the DNS request itself)
- No firewall rules needed

### Drawbacks

- Block page will not work
- You may see a browser error for blocked domains
- If you visit a blocked domain directly, your browser may say the domain doesn't exist, which may be confusing
- Some connections will still try to connect to the non-existant domain for a few tries before it times out

# What About Null Blocking?

Another method is null blocking, which responds with 0.0.0.0 or ::1. This [special IP address](https://tools.ietf.org/html/rfc3513#section-2.5.2) is unspecified.

### Benefits And Drawbacks

These are similar to that of `NXDOMAIN` but this is more experimental so your mileage may vary,

Your Support

Thanks to you, we can keep working on Pi-hole and implementing features you want. We're currently running a fundraiser so please [consider donating to our project](https://pi-hole.net/donate/)!

---

<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:** [May 18, 2018, 10:40am UTC](https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634/2 "2018-05-18T10:40:19Z")

</div>

Pinned on May 18, 2018, 10:40am UTC



---

<div class="post-metadata">

**Author:** ![Sander](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@Sander](https://discourse.pi-hole.net/u/Sander)\
**Post date:** [May 18, 2018, 8:41pm UTC](https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634/3 "2018-05-18T20:41:06Z")

</div>

Unfortunately this does not work in my case - and others on [Reddit](https://www.reddit.com/r/pihole/comments/8kc74k/nxdomain_and_null_blocking_with_ftldns/). Still, the IP address of Pi-hole is returned.

```
Current Pi-hole version is v3.3.1-136-ga7e7680
Current AdminLTE version is v3.2.1-195-g4355bde2
Current FTL version is vDev-5ecab0a

```

---

<div class="post-metadata">

**Author:** ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)\
**Post date:** [May 18, 2018, 8:44pm UTC](https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634/4 "2018-05-18T20:44:26Z")

</div>

Note that you may need to run `pihole -g` after updating.

_FTL_DNS will indicate this in its log file but I agree that this is not very visible.

---

<div class="post-metadata">

**Author:** ![Packeteer](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@Packeteer](https://discourse.pi-hole.net/u/Packeteer)\
**Post date:** [May 18, 2018, 9:03pm UTC](https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634/5 "2018-05-18T21:03:37Z")

</div>

> [@jacob.salmela](#):
>
> Once you’ve checked out on the new branches, you need to add this to `/etc/pihole/pihole-ftl.conf` (note you may need to create this file if it does not exist)

Should it be pihole-FTL.conf or doesn't it matter?? [so FTL in upper case]

---

<div class="post-metadata">

**Author:** ![mibere](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mibere/32/18057_2.png) [@mibere](https://discourse.pi-hole.net/u/mibere)\
**Post date:** [May 18, 2018, 9:12pm UTC](https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634/6 "2018-05-18T21:12:39Z")

</div>

> [@Packeteer](#):
>
> Should it be pihole-FTL.conf or doesn’t it matter?? [so FTL in upper case]

It's `pihole-FTL.conf`

---

<div class="post-metadata">

**Author:** ![Sander](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@Sander](https://discourse.pi-hole.net/u/Sander)\
**Post date:** [May 18, 2018, 9:22pm UTC](https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634/7 "2018-05-18T21:22:15Z")

</div>

Yay!  
After renaming pihole-ftl.conf to pihole-FTL.conf (and running pihole -g beforehand) it works!  
I'd recommend editing the original post so pihole-FTL.conf is correctly created.

---

<div class="post-metadata">

**Author:** ![mibere](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mibere/32/18057_2.png) [@mibere](https://discourse.pi-hole.net/u/mibere)\
**Post date:** [May 18, 2018, 9:29pm UTC](https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634/8 "2018-05-18T21:29:53Z")

</div>

> [@Sander](#):
>
> I’d recommend editing the original post so pihole-FTL.conf is correctly created.

Done. Thanks for the hint.

---

<div class="post-metadata">

**Author:** ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)\
**Post date:** [May 18, 2018, 9:44pm UTC](https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634/9 "2018-05-18T21:44:35Z")

</div>

I also edited the original blog article now.

---

<div class="post-metadata">

**Author:** ![SoNic67](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/sonic67/32/3742_2.png) [@SoNic67](https://discourse.pi-hole.net/u/SoNic67)\
**Post date:** [May 18, 2018, 10:57pm UTC](https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634/10 "2018-05-18T22:57:25Z")

</div>

I am using the NXDOMAIN now, instead of the redirection to 127.0.0.1 and everything seems to work faster. Thanks!

---

<div class="post-metadata">

**Author:** ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)\
**Post date:** [May 20, 2018, 7:09am UTC](https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634/11 "2018-05-20T07:09:33Z")

</div>

I'm seeing that certain clients try hard to resolve their domains when Pi-hole returns NXDOMAIN (try try to resolve a given domain a dozen times before they give up). This increased the query log by a notable amount of "query noise". Switching to NULL IP blocking seems to have helped, maybe you should give it a try as well.

---

<div class="post-metadata">

**Author:** ![Packeteer](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@Packeteer](https://discourse.pi-hole.net/u/Packeteer)\
**Post date:** [May 20, 2018, 8:02am UTC](https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634/12 "2018-05-20T08:02:01Z")

</div>

> [@DL6ER](#):
>
> This increased the query log by a notable amount of “query noise”

I was about to post the same thing. I'm seeing that my total % blocked has dropped to nearly half it's previous value now that I've switched from NXDOMAIN to BLOCKINGMODE=NULL (currently running around 36% total queries blocked). Curiously the top 2 worst offenders are Microsoft - not strictly ads!

---

<div class="post-metadata">

**Author:** ![SoNic67](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/sonic67/32/3742_2.png) [@SoNic67](https://discourse.pi-hole.net/u/SoNic67)\
**Post date:** [May 20, 2018, 11:17am UTC](https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634/13 "2018-05-20T11:17:05Z")

</div>

There where several other incidents of "normal" sites when I had to refresh several times the page until it got served.

Thanks for suggestions, I'll try the NULL method now.

---

<div class="post-metadata">

**Author:** ![Crazybyte](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/crazybyte/32/4405_2.png) [@Crazybyte](https://discourse.pi-hole.net/u/Crazybyte)\
**Post date:** [July 30, 2018, 9:37am UTC](https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634/15 "2018-07-30T09:37:21Z")

</div>

**Am I wrong or NXDOMAIN is now the default behavior for pi-hole?**

I was starting to implement this method by following this guide, but I decided to check using nslookup just before doing it... and it seems that my pi-hole is replying with NXDOMAIN instead that its own IP address or 0.0.0.0.

My current setup is:  
Raspbian 9 (stretch)  
Pi-hole version is v3.3.1 (Latest: v3.3.1)  
AdminLTE version is v3.3 (Latest: v3.3)  
FTL version is v3.0 (Latest: v3.0)

---

<div class="post-metadata">

**Author:** ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)\
**Post date:** [July 30, 2018, 9:46am UTC](https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634/16 "2018-07-30T09:46:19Z")

</div>

With _FTL_DNS, the new default method is `NULL` blocking as described [here](https://docs.pi-hole.net/ftldns/blockingmode/).

`NXDOMAIN` turned out to be disadvantageous in some cases where clients tried to resolve hostnames like crazy as they didn't accept `NXDOMAIN` as reply.

---

<div class="post-metadata">

**Author:** ![Crazybyte](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/crazybyte/32/4405_2.png) [@Crazybyte](https://discourse.pi-hole.net/u/Crazybyte)\
**Post date:** [July 30, 2018, 9:57am UTC](https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634/17 "2018-07-30T09:57:29Z")

</div>

Thanks for the useful link.  
In this case, having Pi-hole 3.3.1, would be better for me to switch to dev branch (Pi-hole ver 4+) or as for the guide, use the FTLDNS branch?

---

<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 30, 2018, 10:50am UTC](https://discourse.pi-hole.net/t/nxdomain-and-null-blocking-with-ftldns/9634/18 "2018-07-30T10:50:08Z")

</div>

The dev branch of 4.0 is recommended.
