# Question conditional forwarding

**URL:** <https://discourse.pi-hole.net/t/question-conditional-forwarding/32086>\
**Category:** Help\
**Created:** [May 12, 2020, 6:01am UTC](https://discourse.pi-hole.net/t/question-conditional-forwarding/32086 "2020-05-12T06:01:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Schwefelholz](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/schwefelholz/32/7652_2.png) [@Schwefelholz](https://discourse.pi-hole.net/u/Schwefelholz)\
**Post date:** [May 12, 2020, 6:01am UTC](https://discourse.pi-hole.net/t/question-conditional-forwarding/32086/1 "2020-05-12T06:01:33Z")

</div>

Hi there,

I have a question regarding conditional forwarding:

I'm running two pi-hole instances, simply for redundance, one of which serves as DHCP server. Both instances hold the same local copy of /etc/hosts to resolve servers with fix IP addresses.

pi-hole1 - DHCP service  
pi-hole2 - no DHCP service

Now, pi-hole2 can resolve local hosts listed in /etc/hosts, but not the hosts that received a DHCP lease by pi-hole1.

To mitigate this issue, I configured conditional forwarding on pi-hole2 to pi-hole1, and pi-hole2 is now able to resolve any hosts (fix IP hosts and DHCP-configured hosts), but once pi-hole1 is not available, pi-hole2 does not even resolve the computers listed in /etc/hosts anymore.

However, from a redundance point of view, this would be very welcome. Is there any way to achieve this?

It would even be greater if both setups could run the DHCP service and both would be able to resolve all the local hosts, but this seems to be clearly beyond dnsmasq's capabilities and intentions...

Cheers  
T.

---

<div class="post-metadata">

**Author:** ![yubiuser](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/yubiuser/32/12100_2.png) [@yubiuser](https://discourse.pi-hole.net/u/yubiuser)\
**Post date:** [May 12, 2020, 9:06am UTC](https://discourse.pi-hole.net/t/question-conditional-forwarding/32086/2 "2020-05-12T09:06:18Z")

</div>

How do you enter your your hosts in `/etc/hosts`? With `hostname.domain`? Or only `hostname? If you specify a `.domain`and it is the same you use for conditional forwarding pihole2 will likely send queries for the local domain to pihole1 and ignore`/etc/hosts`.

How many host do you have (fixed, DHCP)? If there are just a few you might want to checkout the "Local DNS Record" function pihole v5.0 came with. You could specify local DNS records on one pi and share with the other by copying the `custom.list` between them. As pihole DHCP is deterministic your devices should always get the same IP from DHCP and therefore you wouldn't have to change the entries in "Local DNS Records".

For redundancy and availability in general see here:

> [@High availability (HA) for Pi-hole (running two Pi-hole's)](https://discourse.pi-hole.net/t/high-availability-ha-for-pi-hole-running-two-pi-holes/3138):
>
> Migrating [this feature request from GitHub](https://github.com/pi-hole/pi-hole/issues/648): I'd love to see the option of running multiple PiHoles in your network and a means to keep all of them in sync (whitelists, etc). Ideally, only one would serve the Web Interface, and it would show stats for multiple PiHoles. (the other PiHoles could be "satellite" PiHoles or something) The use case is the following: I have PiHole running flawlessly in an Ubuntu Server 16.04 VM in Hyper-V. But this is a single point of failure - when I reboot my Hy…

---

<div class="post-metadata">

**Author:** ![Schwefelholz](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/schwefelholz/32/7652_2.png) [@Schwefelholz](https://discourse.pi-hole.net/u/Schwefelholz)\
**Post date:** [May 12, 2020, 12:49pm UTC](https://discourse.pi-hole.net/t/question-conditional-forwarding/32086/3 "2020-05-12T12:49:43Z")

</div>

I like the idea of making use of /etc/pihole/custom.list.

If I had a script that populated /etc/pihole/custom.list on pi-hole2 with IPs and names of /etc/pihole/dhcp.leases on pi-hole1, the name resolution should be the same on both pi-hole instances.

Do we know if pihole-FTL needs a restart on pi-hole2 if I populate custom.list "behind its back"?

---

<div class="post-metadata">

**Author:** ![yubiuser](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/yubiuser/32/12100_2.png) [@yubiuser](https://discourse.pi-hole.net/u/yubiuser)\
**Post date:** [May 12, 2020, 3:22pm UTC](https://discourse.pi-hole.net/t/question-conditional-forwarding/32086/4 "2020-05-12T15:22:48Z")

</div>

Yes.

`pihole restartdns reload` (`pihole restartdns reload-lists` might be sufficient but not sure)

---

<div class="post-metadata">

**Author:** ![Schwefelholz](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/schwefelholz/32/7652_2.png) [@Schwefelholz](https://discourse.pi-hole.net/u/Schwefelholz)\
**Post date:** [May 13, 2020, 5:45pm UTC](https://discourse.pi-hole.net/t/question-conditional-forwarding/32086/5 "2020-05-13T17:45:42Z")

</div>

**pihole restartdns** seems to be necessary.

If anybody intends to do the same:  
custom.list needs to be provided with the FQDN of the dhcp clients. At first I had only the simple hostname added and on some DNS clients it worked, while on others it did not. Apparently, Windows, Linux and Android act differently there.  
Having used the FQDN it seems to be working for all OS's now.

I used this to create a custom.list from the dhcp leases:

```auto
cat /etc/pihole/dhcp.leases | cut -d " " -f 3-4 | grep -v \*$ | sed "s/$/.your.domain/" > custom.list

```

---

<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:** [June 3, 2020, 5:45pm UTC](https://discourse.pi-hole.net/t/question-conditional-forwarding/32086/6 "2020-06-03T17:45:44Z")

</div>

Closed on June 3, 2020, 5:45pm UTC

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