# Local DNS resolves as 0.0.0.0 for itself

**URL:** <https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039>\
**Category:** Community Help\
**Created:** [February 26, 2025, 9:26am UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039 "2025-02-26T09:26:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juraj\_jiv](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/juraj_jiv/32/45213_2.png) [@Juraj\_jiv](https://discourse.pi-hole.net/u/Juraj_jiv)\
**Post date:** [February 26, 2025, 9:26am UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/1 "2025-02-26T09:26:53Z")

</div>

I upgraded to v6 recently and after fixing the problems I am left with 1 annoyance which I cannot solve. I use pihole local DNS to access my few servers.  
They are added via web Local DNS records:

```auto
server1.lan 192.168.1.2
server2.lan 192.168.1.3

```

The problem is, the pihole is running on server2 and pihole returns address for this query as 0.0.0.0, see the example:

```auto
#nslookup server2.lan
Server: 127.0.0.53
Address: 127.0.0.53#53

Non-authoritative answer:
Name: server2.lan
Address: 0.0.0.0

```

I think this is because hostname is set also to server2 so it return own host address (0.0.0.0). The problem is, if I do command from server1:  
ssh server2.lan  
it tries to connect to itself (server1) cause it resolves server2 as 0.0.0.0.

How can I fix this or is there a workaround?

---

<div class="post-metadata">

**Author:** ![Bucking\_Horn](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/bucking_horn/32/18719_2.png) [@Bucking\_Horn](https://discourse.pi-hole.net/u/Bucking_Horn)\
**Post date:** [February 26, 2025, 9:41am UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/2 "2025-02-26T09:41:28Z")

</div>

How did that nslookup register in Pi-hole's _Query Log_?

```auto
sudo grep server2.lan /var/log/pihole/pihole.log

```

---

<div class="post-metadata">

**Author:** ![Juraj\_jiv](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/juraj_jiv/32/45213_2.png) [@Juraj\_jiv](https://discourse.pi-hole.net/u/Juraj_jiv)\
**Post date:** [February 26, 2025, 9:53am UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/3 "2025-02-26T09:53:24Z")

</div>

Feb 26 10:35:43 dnsmasq[58]: query[A] server2.lan from 192.168.1.8  
Feb 26 10:35:43 dnsmasq[58]: Pi-hole hostname server2.lan is 0.0.0.0

---

<div class="post-metadata">

**Author:** ![Bucking\_Horn](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/bucking_horn/32/18719_2.png) [@Bucking\_Horn](https://discourse.pi-hole.net/u/Bucking_Horn)\
**Post date:** [February 26, 2025, 11:55am UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/4 "2025-02-26T11:55:08Z")

</div>

Please upload a debug log and post **just the token URL** that is generated after the log is uploaded by running the following command from the Pi-hole host terminal:

```auto
pihole -d

```

or if you run your Pi-hole as a Docker container:

```auto
docker exec -it <pihole-container-name-or-id> pihole -d

```

where you substitute `<pihole-container-name-or-id>` as required.

---

<div class="post-metadata">

**Author:** ![Juraj\_jiv](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/juraj_jiv/32/45213_2.png) [@Juraj\_jiv](https://discourse.pi-hole.net/u/Juraj_jiv)\
**Post date:** [February 26, 2025, 2:10pm UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/5 "2025-02-26T14:10:01Z")

</div>

debug log - [https://tricorder.pi-hole.net/b2UfrjzO/](https://tricorder.pi-hole.net/b2UfrjzO/)

notes about real dns names.  
pihole runs on hostname "rp3" with IP 192.168.1.3  
the 0.0.0.0 is returned for rp3.lan

---

<div class="post-metadata">

**Author:** ![Bucking\_Horn](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/bucking_horn/32/18719_2.png) [@Bucking\_Horn](https://discourse.pi-hole.net/u/Bucking_Horn)\
**Post date:** [February 26, 2025, 4:02pm UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/6 "2025-02-26T16:02:18Z")

</div>

Your debug log shows that you run your Pi-hole as a Docker container.

Your local DNS record definitions look ok:

```auto
     hosts = [
       (…+6 names…)
       "192.168.1.3 rp3",
       "192.168.1.3 rp3.lan"
     ] ### CHANGED, default = []

```

But even though pihole-FTL/dnsmasq reads the resulting definitions from `custom.list` during startup, it is replying with `0.0.0.0`:

```auto
   Feb 26 08:52:09 dnsmasq[58]: using only locally-known addresses for lan
   Feb 26 08:52:09 dnsmasq[58]: read /etc/hosts - 8 names
   Feb 26 08:52:09 dnsmasq[58]: read /etc/pihole/hosts/custom.list - 8 names
   Feb 26 08:52:13 dnsmasq[58]: query[A] rp3.lan from 192.168.1.8
   Feb 26 08:52:13 dnsmasq[58]: Pi-hole hostname rp3.lan is 0.0.0.0

```

Run from your Pi-hole machine, what's the output of

```auto
docker exec -it <pihole-name-or-id> cat /etc/hosts

```

where you substitute `<pihole-name-or-id>` with your Pi-hole container's name or id (as listed e.g. by `docker ps`).

---

<div class="post-metadata">

**Author:** ![Juraj\_jiv](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/juraj_jiv/32/45213_2.png) [@Juraj\_jiv](https://discourse.pi-hole.net/u/Juraj_jiv)\
**Post date:** [February 26, 2025, 4:38pm UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/7 "2025-02-26T16:38:56Z")

</div>

Yes, its docker.

```auto
rp3:~$ docker exec -it pihole cat /etc/hosts

# Your system has configured 'manage_etc_hosts' as True.
# As a result, if you wish for changes to this file to persist
# then you will need to either
# a.) make changes to the master file in /etc/cloud/templates/hosts.debian.tmpl
# b.) change or remove the value of 'manage_etc_hosts' in
# /etc/cloud/cloud.cfg or cloud-config from user-data
#

127.0.1.1 rp3 rp3
127.0.0.1 localhost

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

```

---

<div class="post-metadata">

**Author:** ![MostFrabjous](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mostfrabjous/32/46320_2.png) [@MostFrabjous](https://discourse.pi-hole.net/u/MostFrabjous)\
**Post date:** [February 26, 2025, 7:34pm UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/8 "2025-02-26T19:34:23Z")

</div>

Watching this closely as I experience the same issue. I think I'd help if nsswitch were preferring dns over files, as my Pihole is using DHCP and I configured it to forward requests to my router.

So the own hostname in /etc/hosts is 127.0.1.1 (which is very common) and Pihole prefers (nsswitch) files over dns, so if I lookup Pihole's FQDN i get 127.0.0.1. (Lucky the pi.hole lookup returns the real IP).

Noteable difference to OP: I've an empty custom.list

---

<div class="post-metadata">

**Author:** ![Juraj\_jiv](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/juraj_jiv/32/45213_2.png) [@Juraj\_jiv](https://discourse.pi-hole.net/u/Juraj_jiv)\
**Post date:** [February 26, 2025, 7:46pm UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/9 "2025-02-26T19:46:09Z")

</div>

For me even pi.hole lookup returns zeroes.

```auto
$ nslookup pi.hole
Server: 127.0.0.53
Address: 127.0.0.53#53

Non-authoritative answer:
Name: pi.hole
Address: 0.0.0.0

```

interestingly, if I choose different name as hostname and add that one for 192.168.1.3, it returns correctly:

```auto
$ nslookup cubieboard2.lan
Server: 127.0.0.53
Address: 127.0.0.53#53

Non-authoritative answer:
Name: cubieboard2.lan
Address: 192.168.1.3

```

---

<div class="post-metadata">

**Author:** ![Bucking\_Horn](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/bucking_horn/32/18719_2.png) [@Bucking\_Horn](https://discourse.pi-hole.net/u/Bucking_Horn)\
**Post date:** [February 26, 2025, 10:53pm UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/10 "2025-02-26T22:53:29Z")

</div>

> [@MostFrabjous](#):
>
> Pihole prefers (nsswitch) files over dns

Pi-hole is DNS exclusively, it does not concern itself with nsswitch at all, but it reads /etc/hosts.

Are you running your Pi-hole as a container, MostFrabjous?

* * *

Juraj\_jiv, I tried to recreate your issue by editing /etc/hosts in a Pi-hole v6 container, but my domains still resolve.

Your 0.0.0.0 answer could indicate that Pi-hole would block the domain, but putting `pi.hole`on a blocklist still wouldn't trigger you condition.

However, it made me remember that while ago we had issues in some v5 container's returning `0.0.0.0` for `pi.hole`.

Please share your docker compose or docker run script used to start your Pi-hole container.

---

<div class="post-metadata">

**Author:** ![MostFrabjous](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mostfrabjous/32/46320_2.png) [@MostFrabjous](https://discourse.pi-hole.net/u/MostFrabjous)\
**Post date:** [February 26, 2025, 11:36pm UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/11 "2025-02-26T23:36:03Z")

</div>

So nss is out of the picture. Good to know.

I'm running pihole in a container too. I'm forwarding requests from my local LAN to my router whichs also serving DHCP and DNS. The queries for all the hosts on my network get forwarded to my router and work well, but pihole's FQDN (pi.beeb.at) gets resolved to 127.0.0.1. wipi is a cname

## Lookups

pi.hole

```auto
# lookup
NAME TYPE	CLASS	TTL	ADDRESS NAMESERVER TIME TAKEN 
pi.hole.	A IN 0s 10.0.0.2	10.0.0.2:53	5ms       	

# log
00:32:25: query[A] pi.hole from 10.0.1.1
00:39:05: Pi-hole hostname pi.hole is 10.0.0.2

```

pi.beeb.at (FQDN via DHCP)

```auto
# lookup
NAME TYPE	CLASS	TTL	ADDRESS NAMESERVER TIME TAKEN 
pi.beeb.at.	A IN 0s 127.0.1.1	10.0.0.2:53	5ms       	

# log
00:37:40: query[A] pi.beeb.at from 10.0.1.1
00:37:40: /etc/hosts pi.beeb.at is 127.0.1.1

```

## Config

### docker run

```auto
sudo podman run -d \
    -p 80:80 \
    -p 53:53/tcp \
    -p 53:53/udp \
    -v pihole:/etc/pihole \
    -v dnsmasq:/etc/dnsmasq.d \
    -e TZ=Europe/Vienna \
    -e WEBPASSWORD=REDACTED \
    -e FTLCONF_local_ipv4=10.0.0.2 \
    -e DNSMASQ_LISTENING=all \
    --restart=unless-stopped \
    --name=pihole \
    pihole/pihole

```

### pihole -d

[https://tricorder.pi-hole.net/RNVj2eFM/](https://tricorder.pi-hole.net/RNVj2eFM/)

### hosts

Inside container

```auto
27.0.0.1	localhost
::1	localhost ip6-localhost ip6-loopback
ff02::1	ip6-allnodes
ff02::2	ip6-allrouters
127.0.1.1	pi wipi
10.88.0.1	host.containers.internal
10.88.0.24	1ef2dd547223 pihole

```

Host

```auto
127.0.0.1	localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

127.0.1.1	pi wipi

```

---

<div class="post-metadata">

**Author:** ![rdwebdesign](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/rdwebdesign/32/51363_2.png) [@rdwebdesign](https://discourse.pi-hole.net/u/rdwebdesign)\
**Post date:** [February 27, 2025, 12:54am UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/13 "2025-02-27T00:54:13Z")

</div>

> [@MostFrabjous](#):
>
> ` -e FTLCONF_local_ipv4=10.0.0.2 \`

This variable is invalid.

Did you mean `FTLCONF_dns_reply_host_IPv4`?

Also, why are you using this specific IP?

---

<div class="post-metadata">

**Author:** ![Juraj\_jiv](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/juraj_jiv/32/45213_2.png) [@Juraj\_jiv](https://discourse.pi-hole.net/u/Juraj_jiv)\
**Post date:** [February 27, 2025, 6:11am UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/15 "2025-02-27T06:11:51Z")

</div>

My start script for docker:

```auto
$ cat run.sh 
docker run -itd \
--name=pihole \
--restart=always \
--net=host \
-v /opt/pihole/etc-pihole:/etc/pihole \
-v /opt/etc-dnsmasq.d:/etc/dnsmasq.d \
-e TZ=Europe/Bratislava \
pihole/pihole:latest

```

---

<div class="post-metadata">

**Author:** ![MostFrabjous](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mostfrabjous/32/46320_2.png) [@MostFrabjous](https://discourse.pi-hole.net/u/MostFrabjous)\
**Post date:** [February 27, 2025, 6:28am UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/16 "2025-02-27T06:28:59Z")

</div>

This line is a leftover from testing. I should have removed that. But as the line is invalid, it's not impacting our issue. 10.0.0.2 is Pi-hole's ip, that it gets from DHCP

---

<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 27, 2025, 8:39am UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/17 "2025-02-27T08:39:04Z")

</div>

Per @rdwebdesign 's suggestion, have you tried the `FTLCONF_dns_reply_host_IPv4` environment variable?

---

<div class="post-metadata">

**Author:** ![MostFrabjous](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mostfrabjous/32/46320_2.png) [@MostFrabjous](https://discourse.pi-hole.net/u/MostFrabjous)\
**Post date:** [February 27, 2025, 8:20pm UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/18 "2025-02-27T20:20:13Z")

</div>

Yes, now I had time to test:

- removed invalid FTLCONF\_local\_ipv4
- test with `FTLCONF_dns_reply_host_IPv4=10.0.0.2` \> 😡 NOT OK
- test with `FTLCONF_LOCAL_IPV4=10.0.0.2` \> 😡 NOT OK
- test with Juraj\_jiv's Docker run command ([Local DNS resolves as 0.0.0.0 for itself - #15 by Juraj\_jiv](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/15)) \> 😡 NOT OK, I get 0.0.0.0 for Pihole's FQDN

Another option - regarding to this thread - is to run macvtap: [How to change broadcasted DNS IP address in DHCP (v6) - #2 by niaw](https://discourse.pi-hole.net/t/how-to-change-broadcasted-dns-ip-address-in-dhcp-v6/75994/2)

[EDIT: Made a mistake and thought the proper IP was returned during testing, but it wasn't, so NOK]

---

<div class="post-metadata">

**Author:** ![Juraj\_jiv](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/juraj_jiv/32/45213_2.png) [@Juraj\_jiv](https://discourse.pi-hole.net/u/Juraj_jiv)\
**Post date:** [February 28, 2025, 8:01am UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/20 "2025-02-28T08:01:55Z")

</div>

I did full clean start and it works there. I have no idea why.  
I added my 5 custom list and 6 local hostnames and replaced with old docker. So it works now. If someone wants to investigate I can zip old and new etc-pihole folder for investigation.

---

<div class="post-metadata">

**Author:** ![MostFrabjous](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mostfrabjous/32/46320_2.png) [@MostFrabjous](https://discourse.pi-hole.net/u/MostFrabjous)\
**Post date:** [March 2, 2025, 9:37am UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/21 "2025-03-02T09:37:22Z")

</div>

> [@Juraj\_jiv](#):
>
> there. I have no idea why.  
> I added my 5 custom list and 6 local hostnames and replaced with old docker. So it works now. If someone wants to investigate I can zip old

I'd like to diff them!

---

<div class="post-metadata">

**Author:** ![canton7](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/canton7/32/46576_2.png) [@canton7](https://discourse.pi-hole.net/u/canton7)\
**Post date:** [March 2, 2025, 12:33pm UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/22 "2025-03-02T12:33:20Z")

</div>

I had what I think is the same problem: my pihole is set to resolve unknown domains from my router, and the router is configured to provide IP addresses various .lan hostnames. However after upgrading, the pihole was successfully resolving the IP form the router (as seen in the logs), but then replying with "0.0.0.0" to all requests.

I found the expert setting DNS \> DNS domain settings \> Pi-hole domain name, which was set to "lan". I cleared this, and the problem was resolved.

---

<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:** [March 23, 2025, 12:34pm UTC](https://discourse.pi-hole.net/t/local-dns-resolves-as-0-0-0-0-for-itself/77039/23 "2025-03-23T12:34:00Z")

</div>

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