# FTLDNS™: Pi-hole's Own DNS/DHCP server

**URL:** <https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442>\
**Category:** Announcements\
**Created:** [February 22, 2018, 12:00pm UTC](https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442 "2018-02-22T12:00:03Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![postmaster](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/postmaster/32/11_2.png) [@postmaster](https://discourse.pi-hole.net/u/postmaster)\
**Post date:** [February 22, 2018, 12:00pm UTC](https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442/1 "2018-02-22T12:00:04Z")

</div>

Originally published at: [https://pi-hole.net/2018/02/22/coming-soon-ftldns-pi-holes-own-dns-dhcp-server/](https://pi-hole.net/2018/02/22/coming-soon-ftldns-pi-holes-own-dns-dhcp-server/)

# What Is FTLDNS™?
In a sentence, FTLDNS™ is `dnsmasq` blended with Pi-hole's special sauce. We bring the two pieces of software closer together while maintaining maximum compatibility with any updates Simon adds to `dnsmasq`.
# The Problems
We have used `dnsmasq` as our DNS/DHCP server since Pi-hole began. However, as the project has grown and evolved, we reached a point where we started looking into providing our own powerful resolver for a few reasons:
- With FTL, we generate a variety of statistics by interpreting `dnsmasq`'s log file. While this works, doing it through a middleman (a log file) is obviously quite inefficient
- If a user chooses to disable logging, we're unable to compute any statistics at all
- There are some details of the DNS server we do not have access to (like cache usage) through the log file alone
- Each OS distribution provides a different version of `dnsmasq` and this can prevent users for getting a flawless Pi-hole experience

# The Solution
All these problems lead us to the idea of actually _integrating_ a DNS resolver directly into FTL. The obvious choice for this is, of course, to base it on `dnsmasq`. We have a proof-of-concept implementation of FTL already developed and running. So we're officially announcing **_FTL_DNS™** and you can **find it right [here](https://github.com/pi-hole/FTL/pull/238).** 

 ![](https://discourse.pi-hole.net/uploads/default/original/3X/6/8/6879a197c9b5496e22e90b6be65fce849456cacf.png)

One of the [many ways to support us](https://pi-hole.net/donate/) is purchasing from our Swag Store. Get your hands on this sweet mug to help spread the word.

## The Non-technical Details

### **_FTL_DNS has many benefits for you as user:**

- No more `dnsmasq` [version compatibility issues](https://discourse.pi-hole.net/t/how-do-i-revert-to-a-previous-version-of-pi-hole/7168) since we develop and provide the DNS resolver and FTL together
- Upstream updates to `dnsmasq` can easily be integrated into our code since we don't modify its code heavily
- Processing will be much faster since we interact directly with the resolver instead of periodically parsing a log file
- We can provide [stats on cache usage](https://discourse.pi-hole.net/t/cache-server-statistics/6092) and probably much more, which has been previously unavailable
- Due to the direct integration into the resolver (using "FTL hooks"), we can compute statistics without any need for a log file. Instead of a "must have", the log file will become an "opt-in" feature!

## The Technical Details
We implement `dnsmasq` into our code using the modular nature of the C language. FTL v4.0 has always been multi-threaded for speed and efficiency. On startup, it launches a number of threads, each dedicated for specific tasks. We extend the already existing multi-threading in FTL to provide an even faster experience. After the historic information has been imported from the database, we start the DNS/DHCP resolver.
The daemon itself will behave exactly as `dnsmasq` with the addition of having threads orbiting it that provide the known FTL statistics on a dedicated Unix socket as well as on a Telnet-like interface. Furthermore, we add some minor speed improvements to enhance the user's experience on low-performance devices when using huge blocking lists.

We keep our changes inside the code base of `dnsmasq` to the functional minimum to be able to easily upgrade to any future `dnsmasq` releases.

Note: this also means that we are not looking into making big changes to the resolver (like implementing regular expressions support). Although this seems advantageous at first sight, it will make upgrading `dnsmasq` later on almost impossible as these customizations would have to be reimplemented and carefully tested each time. Also, changing parts of the resolver's source code could introduce new bugs to a code base that is extensively tested. We clearly want to avoid that! Stability and speed are the two drivers for the development of _FTL_DNS.

##### 

##### **_FTL_DNS** **( FTL v4.0 ),**  **with its integrated resolver**  **is beneficial in many ways**

- We can never be sure which version we can expect on user's systems as they run a variety of operating systems. This makes adding new features problematic as old versions of `dnsmasq` could, _[and have ,](https://discourse.pi-hole.net/t/how-do-i-revert-to-a-previous-version-of-pi-hole/7168)_ fail(ed) if provided with unknown options. This will be resolved as we are in direct control of which version of the resolver is getting compiled into our binary. It makes both development and bug-tracing _much_ easier
- We will still leave logging enabled in the early days of FTL v4.0 to ease debugging in cases where it is needed. However, the user will be free to disable the logging at any time without losing any statistics
- Due to that fact that everything is one binary, we have full access to the resolver's internal data structure and can easily provide users with more information, e.g. on cache usage (which has been [a feature request](https://discourse.pi-hole.net/t/cached-queries-percentage-statistic-on-dashboard/2206) for some time now). Although this additional functionality might not be there in the initial release, it will come soon afterwards

---

<div class="post-metadata">

**Author:** ![taxick](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/taxick/32/2660_2.png) [@taxick](https://discourse.pi-hole.net/u/taxick)\
**Post date:** [February 24, 2018, 11:02am UTC](https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442/2 "2018-02-24T11:02:42Z")

</div>

Will the FTLDNS v4.0 support openvpn interface like dnsmasq do??

EDIT: Did you have a timeplan for when FTLDNS 4.0 will be ready?

EDIT2: When its ready, can i update from current version or will i have to reinstall the server

---

<div class="post-metadata">

**Author:** ![claudioita](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/claudioita/32/1943_2.png) [@claudioita](https://discourse.pi-hole.net/u/claudioita)\
**Post date:** [February 24, 2018, 11:38pm UTC](https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442/3 "2018-02-24T23:38:30Z")

</div>

Estimated release date?

---

<div class="post-metadata">

**Author:** ![PromoFaux](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/promofaux/32/1545_2.png) [@PromoFaux](https://discourse.pi-hole.net/u/PromoFaux)\
**Post date:** [February 24, 2018, 11:44pm UTC](https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442/4 "2018-02-24T23:44:14Z")

</div>

As with all requests for ETAs:

> soon™

---

<div class="post-metadata">

**Author:** ![claudioita](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/claudioita/32/1943_2.png) [@claudioita](https://discourse.pi-hole.net/u/claudioita)\
**Post date:** [February 25, 2018, 9:46am UTC](https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442/5 "2018-02-25T09:46:32Z")

</div>

I thought that was a Google trade mark

---

<div class="post-metadata">

**Author:** ![PromoFaux](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/promofaux/32/1545_2.png) [@PromoFaux](https://discourse.pi-hole.net/u/PromoFaux)\
**Post date:** [February 25, 2018, 10:37am UTC](https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442/6 "2018-02-25T10:37:21Z")

</div>

[https://wow.gamepedia.com/Soon](https://wow.gamepedia.com/Soon)

---

<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:** [February 25, 2018, 11:26pm UTC](https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442/7 "2018-02-25T23:26:15Z")

</div>

> [@taxick](#):
>
> Will the FTLDNS v4.0 support openvpn interface like dnsmasq do??

Yes, `FTLDNS` will support everything you know from `dnsmasq`.

> [@taxick](#):
>
> When its ready, can i update from current version or will i have to reinstall the server

We're not yet able to say this. There is nothing at the moment that seems to point at having to reinstall.

---

<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:** [March 25, 2018, 2:02pm UTC](https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442/8 "2018-03-25T14:02:48Z")

</div>

5 posts were split to a new topic: [Ftdns - conntrack?](https://discourse.pi-hole.net/t/ftdns-conntrack/8266)

---

<div class="post-metadata">

**Author:** ![borekon](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/borekon/32/2828_2.png) [@borekon](https://discourse.pi-hole.net/u/borekon)\
**Post date:** [March 25, 2018, 2:37pm UTC](https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442/9 "2018-03-25T14:37:01Z")

</div>

Edit: Added as a wildcard blacklist solved the problem

---

<div class="post-metadata">

**Author:** ![0110](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/0110/32/3203_2.png) [@0110](https://discourse.pi-hole.net/u/0110)\
**Post date:** [March 27, 2018, 9:23pm UTC](https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442/10 "2018-03-27T21:23:23Z")

</div>

hi, I have just updated to FTLDNS but my ads are back. There were no errors when updating and I am on Raspbian Jessie. My bottom footer says Pi-hole Version vDev (FTLDNS, v3.3-65-g295ac49) Web Interface Version vDev (FTLDNS, v3.1-411-g517fa24) FTL Version vDev (FTLDNS, vDev-a26da52)

Not sure what isn't working. Help please!  
Pihole and DNS are both enabled.

---

<div class="post-metadata">

**Author:** ![Mcat12](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mcat12/32/20_2.png) [@Mcat12](https://discourse.pi-hole.net/u/Mcat12)\
**Post date:** [April 4, 2018, 1:06am UTC](https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442/11 "2018-04-04T01:06:41Z")

</div>

A post was split to a new topic: [Error when starting FTLDNS](https://discourse.pi-hole.net/t/error-when-starting-ftldns/8556)

---

<div class="post-metadata">

**Author:** ![Eideen](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/e/df705f/32.png) [@Eideen](https://discourse.pi-hole.net/u/Eideen)\
**Post date:** [July 25, 2018, 4:06pm UTC](https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442/12 "2018-07-25T16:06:55Z")

</div>

What settings does it for the upstream nameserver?

---

<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 25, 2018, 4:28pm UTC](https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442/13 "2018-07-25T16:28:30Z")

</div>

You have a choice of eight pre-configured, or you can specify your own. The screen shot shows the options - this particular Pi-Hole is configured to use `unbound` as it's local recursive resolver.

 ![image](https://discourse.pi-hole.net/uploads/default/original/2X/8/84e0c5ddd428747c97bafe1eed344744d5368b37.jpeg)

---

<div class="post-metadata">

**Author:** ![Eideen](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/e/df705f/32.png) [@Eideen](https://discourse.pi-hole.net/u/Eideen)\
**Post date:** [July 25, 2018, 4:36pm UTC](https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442/14 "2018-07-25T16:36:51Z")

</div>

Ok, so it will follow the "server=" "/etc/dnsmasq.d" settings.  
It was confusing for me if the unbound server also did the DNS forwarding.

---

<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 25, 2018, 4:44pm UTC](https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442/15 "2018-07-25T16:44:19Z")

</div>

If you configure unbound per the instructions at [FTLDNS and Unbound Combined For Your Own All-Around DNS Solution](https://discourse.pi-hole.net/t/ftldns-and-unbound-combined-for-your-own-all-around-dns-solution/10222), unbound will be your local recursive resolver. It will go to the appropriate authoritative servers to find the IP for the domain (replacing a third party DNS service).

Pi-Hole then uses unbound as it's resolver.

The path: Client requests DNS --- Pi-Hole processes request from cache/blacklist or asking unbound --- unbound finds the address and sends it back to Pi-Hole --- Pi-Hole returns it to the client.

If you don't use unbound for this and use Google as your upstream DNS server (for example), in the path above substitute Google DNS for unbound.

---

<div class="post-metadata">

**Author:** ![Eideen](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/e/df705f/32.png) [@Eideen](https://discourse.pi-hole.net/u/Eideen)\
**Post date:** [July 25, 2018, 5:03pm UTC](https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442/16 "2018-07-25T17:03:18Z")

</div>

So if i have trust in my local DNS server. i don't need unbound, or set "127.0.0.1#5353" as custom DNS server?

---

<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 25, 2018, 5:28pm UTC](https://discourse.pi-hole.net/t/ftldns-pi-holes-own-dns-dhcp-server/7442/17 "2018-07-25T17:28:07Z")

</div>

If you have trust in your local DNS server, just put its IP address in Custom 1 (and Custom 3 if there is an IPV6 address as well).

The 127.0.0.1#5353 address is for when you have unbound configured on that port. It listens on port 5353 at the Pi's loopback address 127.0.0.1 (explanation of that address here: [http://www.tech-faq.com/127-0-0-1.html](http://www.tech-faq.com/127-0-0-1.html)).
