# Pihole overrides hostname without being instructed to do so

**URL:** <https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455>\
**Category:** Help\
**Created:** [June 15, 2023, 1:07pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455 "2023-06-15T13:07:51Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![PhilIsHere](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/p/aeb1de/32.png) [@PhilIsHere](https://discourse.pi-hole.net/u/PhilIsHere)\
**Post date:** [June 15, 2023, 1:07pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/1 "2023-06-15T13:07:51Z")

</div>

## Expected Behaviour:

Pi-Hole using "debianserver" as the hostname; this was set in the Debian 11 installation and works, when Pi-Hole is NOT used as a DNS Server.

## Actual Behaviour:

The moment when I set my Pi-Hole Machine (a older laptop which runs a lot of services) as the DNS Server in the **FRITZ!Box 7530 Router** Networksettings machine can't be accsessed under "debianserver" anymore, after I restart my Router.

Pi-Hole automatically assigns pi.hole as the hostname.  
 ![piholehostname](https://discourse-cdn.pi-hole.net/images/transparent.png)

However: Pihole was never instructed to use that hostname. Staying on pi.hole Hostname is not an option and it literally doesn't even show up anywhere.

![fritzsettings](https://discourse-cdn.pi-hole.net/images/transparent.png)

```auto
$ cat /etc/pihole/pihole-FTL.conf
#; Pi-hole FTL config file
#; Comments should start with #; to avoid issues with PHP and bash reading this file
PRIVACYLEVEL=0
RATE_LIMIT=1000/60

```

```auto
$ cat /etc/host

```

```auto
$ cat /etc/hostname
debianserver

```

I'm not really sure how to solve that issue because for me it doesn't really make sense.

I hope someone can help me out on this one.  
Thank you!

## Debug Token:

o0pN7iU9

---

<div class="post-metadata">

**Author:** ![chrislph](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/chrislph/32/32723_2.png) [@chrislph](https://discourse.pi-hole.net/u/chrislph)\
**Post date:** [June 15, 2023, 1:42pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/2 "2023-06-15T13:42:15Z")

</div>

> [@PhilIsHere](#):
>
> Pi-Hole automatically assigns pi.hole as the hostname.

The original hostname still works and still applies. Pi-hole adds `pi.hole` as a consistent internal hostname for its own operations.

---

<div class="post-metadata">

**Author:** ![PhilIsHere](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/p/aeb1de/32.png) [@PhilIsHere](https://discourse.pi-hole.net/u/PhilIsHere)\
**Post date:** [June 15, 2023, 2:30pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/4 "2023-06-15T14:30:40Z")

</div>

> [@chrislph](#):
>
> The original hostname still works and still applies

Well. No it does not because it returns the localhost adress which breaks everything.

I assume it's the IP Adress of the Loopback Adapter, which is for whatever reason returned. I did however selected eno0 (my LAN Interface) when setting up Pihole via the install script.

```auto
$ ping debianserver

Ping wird ausgeführt für debianserver.fritz.box [127.0.1.1] mit 32 Bytes Daten:
Antwort von 127.0.1.1: Bytes=32 Zeit<1ms TTL=128
Antwort von 127.0.1.1: Bytes=32 Zeit<1ms TTL=128
Antwort von 127.0.1.1: Bytes=32 Zeit<1ms TTL=128
Antwort von 127.0.1.1: Bytes=32 Zeit<1ms TTL=128

Ping-Statistik für 127.0.1.1:
    Pakete: Gesendet = 4, Empfangen = 4, Verloren = 0
    (0% Verlust),
Ca. Zeitangaben in Millisek.:
    Minimum = 0ms, Maximum = 0ms, Mittelwert = 0ms

```

Pi.Hole Pinging is also not returning the correct IP

```auto
 ping pi.hole

Ping wird ausgeführt für pi.hole [fe80::REDACTED:REDACTED:REDACTED:REDACTED%20] mit 32 Bytes Daten:
Antwort von fe80::REDACTED:REDACTED:REDACTED:REDACTED%20: Zeit<1ms
Antwort von fe80::REDACTED:REDACTED:REDACTED:REDACTED%20: Zeit<1ms
Antwort von fe80::REDACTED:REDACTED:REDACTED:REDACTED%20: Zeit<1ms
Antwort von fe80::REDACTED:REDACTED:REDACTED:REDACTED%20: Zeit<1ms

Ping-Statistik für fe80::REDACTED:REDACTED:REDACTED:REDACTED%20:
    Pakete: Gesendet = 4, Empfangen = 4, Verloren = 0
    (0% Verlust),
Ca. Zeitangaben in Millisek.:
    Minimum = 0ms, Maximum = 0ms, Mittelwert = 0ms

```

What I find interesting however is the escaped character **%20** at the end of the IPv6 adress. I have no idea where that comes from

And this behaviour only applies when I setup the IPv4 Adress of my Machine as a local DNS Server.

---

<div class="post-metadata">

**Author:** ![chrislph](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/chrislph/32/32723_2.png) [@chrislph](https://discourse.pi-hole.net/u/chrislph)\
**Post date:** [June 15, 2023, 3:41pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/5 "2023-06-15T15:41:18Z")

</div>

> [@PhilIsHere](#):
>
> it returns the localhost adress

That's not a Pi-hole artifact, this would also be the case if you were pinging the hostname of the localhost before you installed Pi-hole. It's configured in `/etc/hosts`. Eg some Linux setups here all resolve the hostname to `127.0.1.1`:

```plaintext
pi@piaware:~ $ ping piaware
PING piaware (127.0.1.1) 56(84) bytes of data.
64 bytes from piaware (127.0.1.1): icmp_seq=1 ttl=64 time=0.110 ms

```

```plaintext
chris@testmint:~$ ping testmint
PING testmint (127.0.1.1) 56(84) bytes of data.
64 bytes from testmint (127.0.1.1): icmp_seq=1 ttl=64 time=0.023 ms

```

```plaintext
pi@pihole:~ $ ping pihole
PING pihole (127.0.1.1) 56(84) bytes of data.
64 bytes from pihole (127.0.1.1): icmp_seq=1 ttl=64 time=0.180 ms

```

---

<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:** [June 15, 2023, 3:57pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/6 "2023-06-15T15:57:09Z")

</div>

One can clearly see that `fe80::REDACTED:REDACTED:REDACTED:REDACTED%20` is a correct IP address of your Pi-hole host machine. Compared to that, an incorrect IP address would of course be something like `fe80::REDACTED:REDACTED:REDACTED:REDACTED%20`, whereas `fe80::REDACTED:REDACTED:REDACTED:REDACTED%20` on the other hand could suggest an inappropriately configured static IPv6... 😁

In all honesty:  
I presume that you are seeing a valid IP address for your host machine.

> [@PhilIsHere](#):
>
> `ping debianserver`

Note that in general, _`ping`_ isn't adequate to analyse DNS issues, even when using hostnames, as it resolves hostnames through a variety of sources, not just DNS.

Use _`nslookup`_ or _`dig`_ to analyse DNS issues.

As for your naming issue:  
The debian installer creates an entry associating `127.0.1.1` with your hostname in `/etc/hosts` (see Debian's docs at [5.1.1. The hostname resolution](https://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_hostname_resolution)), and Pi-hole is reading that file.

If you are not running software on that host machine that may depend on that value, you may safely remove that `127.0.1.1 debianserver` line from your `/etc/hosts`.  
(_This should usually be the case for headless server installations_)

---

<div class="post-metadata">

**Author:** ![PhilIsHere](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/p/aeb1de/32.png) [@PhilIsHere](https://discourse.pi-hole.net/u/PhilIsHere)\
**Post date:** [June 15, 2023, 4:32pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/7 "2023-06-15T16:32:57Z")

</div>

> [@chrislph](#):
>
> It's configured in `/etc/hosts`. Eg some Linux setups here all resolve the hostname to `127.0.1.1`:

> [@Bucking\_Horn](#):
>
> As for your naming issue:  
> The debian installer creates an entry associating `127.0.1.1` with your hostname in `/etc/hosts` (see Debian's docs at [5.1.1. The hostname resolution](https://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_hostname_resolution)), and Pi-hole is reading that file.

ICYMI:  
I showed that my /etc/host is indeed empty in my initial Post

> [@PhilIsHere](#):
>
> ```auto
> $ cat /etc/host
> 
> ```

This was not done by me, it was simply empty.

> [@Bucking\_Horn](#):
>
> Use _`nslookup`_ or _`dig`_ to analyse DNS issues.

The first one is without Pi-Hole being the local DNS Server, second one is with Pi-Hole as DNS Server.

```auto
$ ip address show

```

And I really don't understand why the Pi-Hole is shown instead of the Router. I only use Pihole in DNS mode, DHCP is done by my Router and I do input the IP-Adresses of the Machine into the DNS-Fields of the Router.

> [@Bucking\_Horn](#):
>
> One can clearly see that `fe80::REDACTED:REDACTED:REDACTED:REDACTED%20` is a correct IP address of your Pi-hole host machine

Well that wasnt helpful of me was it. It's local adresses anyways so I gues Its fine to show them. I hope it helps you more to see everything. I was under the assumption that's what the logtoken is for: to see everything needed.

---

<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:** [June 15, 2023, 4:35pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/8 "2023-06-15T16:35:34Z")

</div>

> [@PhilIsHere](#):
>
> I showed that my /etc/host is indeed empty in my initial Post

That file is different from `/etc/hosts` - note the trailing `s`. 😉

Please try removing that `127.0.1.1` line as suggested.  
You'd then have to restart Pi-hole's DNS resolver, e.g. by running `pihole restartdns`.

Also, you can send DNS requests to a specific DNS server, e.g.

```auto
nslookup debianserver 192.168.178.1

```

(assuming that `192.168.178.1` is your router's IPv4 address).

That way, you won't have to switch DNS servers in your router to analyse an issue.

> **A few remarks, not necessarily related to your observation (click for more).**
>
> > [@PhilIsHere](#):
> >
> > Well that wasnt helpful of me was it. It's local adresses anyways so I gues Its fine to show them
> 
> With IPv6, it's wise to keep them redacted, as they may contain your device's MAC address. Part of yours do, so you may want to redact them.  
> I'd customarily show the last hex digits, so that anyone still can tell IPs apart, and we potentially still can align that with stuff from your debug log. 😉  
> And the `%20` at the end of link-local IPv6 is a zone index, which is used for routing and usually ties the address to a network interface (of which there may be more than one for a given MAC).
> 
> > [@Bucking\_Horn](#):
> >
> > I presume that you are seeing a valid IP address for your host machine.
> 
> My point here was that resolution works as expected, as Pi-hole would make sure that it answers the correct local address on your host in relation to the interface that a request arrives on. This makes me confident that what you see is indeed a correct IP address, regardless what it actually looks like.

---

<div class="post-metadata">

**Author:** ![PhilIsHere](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/p/aeb1de/32.png) [@PhilIsHere](https://discourse.pi-hole.net/u/PhilIsHere)\
**Post date:** [June 15, 2023, 5:28pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/9 "2023-06-15T17:28:19Z")

</div>

> [@Bucking\_Horn](#):
>
> That file is different from `/etc/hosts` - note the trailing `s`. 😉

Oh my god... It works now thank you!!

---

<div class="post-metadata">

**Author:** ![deHakkelaar](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dehakkelaar/32/674_2.png) [@deHakkelaar](https://discourse.pi-hole.net/u/deHakkelaar)\
**Post date:** [June 15, 2023, 6:49pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/10 "2023-06-15T18:49:24Z")

</div>

> [@Bucking\_Horn](#):
>
> If you are not running software on that host machine that may depend on that value, you may safely remove that `127.0.1.1 debianserver` line from your `/etc/hosts`.  
> (_This should usually be the case for headless server installations_)

Am not sure if thats recommended.  
That would mean that if processes on the own host try to lookup their own name **debianserver** , they wont be able to connect without resorting to external DNS records.  
And some use that line to configure the FQDN for the own host:

```auto
pi@ph5b:~ $ man hostname
[..]
   THE FQDN
       The FQDN (Fully Qualified Domain Name) of the system is the name
       that the resolver(3) returns for the host name, such as, ursula.ex‐
       ample.com. It is usually the hostname followed by the DNS domain
       name (the part after the first dot). You can check the FQDN using
       hostname --fqdn or the domain name using dnsdomainname.

       You cannot change the FQDN with hostname or dnsdomainname.

       The recommended method of setting the FQDN is to make the hostname
       be an alias for the fully qualified name using /etc/hosts, DNS, or
       NIS. For example, if the hostname was "ursula", one might have a
       line in /etc/hosts which reads

              127.0.1.1 ursula.example.com ursula

```

Better to just instruct embedded **dnsmasq** to not read the **hosts** file with below directive:

```auto
pi@ph5b:~ $ man dnsmasq
[..]
       -h, --no-hosts
              Don't read the hostnames in /etc/hosts.

```

EDIT: I have this one ~~disabled~~ enabled anyway bc we have local DNS records now 😉

```auto
pi@ph5a:~ $ cat /etc/dnsmasq.d/99-no-hosts.conf
no-hosts

```

EDIT2: Ow and you most likely break **sudo** :

> [@Pi-hole install script and dhcpcd.conf](https://discourse.pi-hole.net/t/pi-hole-install-script-and-dhcpcd-conf/48047/12):
>
> That is an issue with sudo and not Pi-hole. If setup a Linux host properly without Pi-hole, your suppose to provide the own hostname in both the /etc/hostname & /etc/hosts files anyway like you did. That would have probably fixed your sudo issue. The /etc/hosts file has precedence over DNS name resolution meaning a ping, curl or netcat will first look at the hosts file before forwarding an A or AAAA query to a DNS server. Thats not hacking, thats the only proper way or a variant of it (I u…

---

<div class="post-metadata">

**Author:** ![chrislph](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/chrislph/32/32723_2.png) [@chrislph](https://discourse.pi-hole.net/u/chrislph)\
**Post date:** [June 15, 2023, 7:26pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/11 "2023-06-15T19:26:21Z")

</div>

I've removed it in the past and it did impact `sudo`, which gave an error every time it was invoked, so I put it back.

I believe the order of resolution is controlled in `/etc/nsswitch.conf` (the `hosts` line) but I'm not sure if that is still relevant in modern Debian-based OSs. I've never needed to touch it because everything works fine out the box almost all of the time.

The hostname is in `/etc/hostname`.

_(I know you know that, just mentioning for completeness for future visitors finding this thread in case it's useful)_

---

<div class="post-metadata">

**Author:** ![deHakkelaar](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dehakkelaar/32/674_2.png) [@deHakkelaar](https://discourse.pi-hole.net/u/deHakkelaar)\
**Post date:** [June 15, 2023, 7:57pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/12 "2023-06-15T19:57:22Z")

</div>

This is what I always do for systems with static IP details like Pi-hole:

> [@Sudo: unable to resolve host {hostname}: Name or service not known](https://discourse.pi-hole.net/t/sudo-unable-to-resolve-host-hostname-name-or-service-not-known/52416/11):
>
> Figure out your hostname: pi@ph5b:~ $ hostname ph5b Figure out your DNS search/suffix domain: pi@ph5b:~ $ pihole-FTL dhcp-discover [..] domain-name: "home.dehakkelaar.nl" Edit below file so it resembles: pi@ph5b:~ $ sudo nano /etc/hosts 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters 127.0.1.1 ph5b.home.dehakkelaar.nl ph5b Check: pi@ph5b:~ $ hostname -f ph5b.home.dehakkelaar.nl

EDIT: Ow you could do an extra:

```auto
pi@ph5b:~ $ hostname -i
127.0.1.1

```

```auto
pi@ph5b:~ $ hostname -I
10.0.0.4

```

---

<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:** [June 15, 2023, 8:13pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/13 "2023-06-15T20:13:47Z")

</div>

> [@deHakkelaar](#):
>
> That would mean that if processes on the own host try to lookup their own name **debianserver** , they wont be able to connect without resorting to external DNS records.

Local processes could also make use of `/etc/hostname` to retrieve the hostname.

Associating `127.0.1.1` with that hostname is really a Debian-specific hack, to overcome limitations of some (supposedly) desktop software packages (GNOME in particular).

But you are correct - I forgot about the _`sudo`_ implications.  
It doesn't break _`sudo`_, though. Without that hostname \<-\> IP associaton, it just prints out a message any time it is run, which can get annoying.  
(_I forgot because I replaced_ `hostname` _with_ `unbound` _in most of my Pi-hole installations (and my `unbound` is listening on that_ 127.0.1.1, _so Pi-hole's UI would print that name as upstream in its dashboard)_).

Rather than removing that line, the correct way to address this would have been to replace `127.0.1.1` with the host's fixed IP, as recommended by the Debian docs I've linked above:

> For a system with a permanent IP address, that permanent IP address should be used here instead of `127.0.1.1` .

---

<div class="post-metadata">

**Author:** ![deHakkelaar](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dehakkelaar/32/674_2.png) [@deHakkelaar](https://discourse.pi-hole.net/u/deHakkelaar)\
**Post date:** [June 15, 2023, 8:25pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/14 "2023-06-15T20:25:11Z")

</div>

> [@Bucking\_Horn](#):
>
> Associating `127.0.1.1` with that hostname is really a Debian-specific hack, to overcome limitations of some (supposedly) desktop software packages (GNOME in particular).

Red Hat (127.0.0.1 instead of 127.0.1.1):

```auto
$ cat /etc/hosts
127.0.0.1 magellanic magellanic.localdomain magellanic magellanic.localdomain4
::1 magellanic magellanic.localdomain magellanic magellanic.localdomain6

```

~~[Chapter&nbsp;5.&nbsp;Network setup](https://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_hostname_resolution)~~

Wrong link:

[https://www.redhat.com/sysadmin/set-hostname-linux](https://www.redhat.com/sysadmin/set-hostname-linux)

> [@Bucking\_Horn](#):
>
> Rather than removing that line, the correct way to address this would have been to replace `127.0.1.1` with the host's fixed IP, as recommended by the Debian docs I've linked above:

I wouldnt understand why you would prefer to have this local traffic be broadcasted over an ethernet interface instead of the way way faster **lo** loopback interface.  
It just makes no sense.  
Whats wrong with the **no-hosts** option?

---

<div class="post-metadata">

**Author:** ![deHakkelaar](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dehakkelaar/32/674_2.png) [@deHakkelaar](https://discourse.pi-hole.net/u/deHakkelaar)\
**Post date:** [June 15, 2023, 8:36pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/15 "2023-06-15T20:36:05Z")

</div>

I believe the bit they are referring to is 127.0.1.1 instead of 127.0.0.1 to fix Gnome.  
Not sure though 😉

> Subject: Fwd: /etc/hosts and resolving of the local host/domainname - 127.0.0.1  
> vs. 127.0.1.1

> **[\#719621 - debian-reference: /etc/hosts description too old. - Debian Bug...](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=719621)**

---

<div class="post-metadata">

**Author:** ![deHakkelaar](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dehakkelaar/32/674_2.png) [@deHakkelaar](https://discourse.pi-hole.net/u/deHakkelaar)\
**Post date:** [June 15, 2023, 8:47pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/16 "2023-06-15T20:47:25Z")

</div>

Ow and another aspect of **lo** vs ethernet, if ethernet disconnects for some reason, processes cant talk to one another internally until connection is restored.

---

<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:** [June 15, 2023, 8:59pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/17 "2023-06-15T20:59:30Z")

</div>

> [@deHakkelaar](#):
>
> I believe the bit they are referring to is 127.0.1.1 instead of 127.0.0.1 to fix Gnome.

Yes, and that is exactly what **PhilIsHere** was observing and what my suggestion is trying to fix:

> [@PhilIsHere](#):
>
> ```auto
> ping debianserver
> 
> Ping wird ausgeführt für debianserver.fritz.box [127.0.1.1] mit 32 Bytes Daten:
> Antwort von 127.0.1.1: Bytes=32 Zeit<1ms TTL=128
> 
> ```

EDIT

> [@deHakkelaar](#):
>
> Whats wrong with the **no-hosts** option?

Nothing, it's a valid alternative.  
It could even be worth to consider changing this to be Pi-hole's default.  
But that may potentially break a lot of existing installations relying on /etc/hosts to be honored as a source for Pi-hole's DNS.

---

<div class="post-metadata">

**Author:** ![deHakkelaar](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dehakkelaar/32/674_2.png) [@deHakkelaar](https://discourse.pi-hole.net/u/deHakkelaar)\
**Post date:** [June 15, 2023, 9:05pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/18 "2023-06-15T21:05:28Z")

</div>

BIGEDIT: Oops I missed your last edit 😉  
But leave below comment as is.

So apply the **no-hosts** directive instead of degrading (by not using all the advantages that come with **lo** ).  
Thats the source for that **127.0.1.1** address.  
You can always add your own additional records (EDIT: or aliases).  
Thats not too difficult is it?

EDIT: I always found this bit particular with Pi-hole.  
Most of the resolvers that I know dont read the **hosts** file (OOTB).  
But I was told in the past it was to ensure not breaking legacy setups that still use the **hosts** file for importing other records.

---

<div class="post-metadata">

**Author:** ![deHakkelaar](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dehakkelaar/32/674_2.png) [@deHakkelaar](https://discourse.pi-hole.net/u/deHakkelaar)\
**Post date:** [June 15, 2023, 10:23pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/19 "2023-06-15T22:23:24Z")

</div>

Another argument to drop reading of that **hosts** file: OOTB the loopback addresses contained in them are useless for your other clients on the network.  
Only time when its useful to have that **127.0.1.1** address registered in Pi-hole is if you would configure local **/etc/resolv.conf** to point to **127.0.0.1**.  
EDIT: Making the Pi-hole host the only potential client that would use that record.  
Which it would not if configured the **hosts** file correctlly in which case DNS isnt addressed.

Of course **localise-queries** will do the rest 😉

```auto
pi@ph5b:~ $ man dnsmasq
[..]
       -y, --localise-queries
              Return answers to DNS queries from /etc/hosts and --inter‐
              face-name and --dynamic-host which depend on the interface
              over which the query was received. If a name has more than
              one address associated with it, and at least one of those
              addresses is on the same subnet as the interface to which
              the query was sent, then return only the address(es) on that
              subnet. This allows for a server to have multiple addresses
              in /etc/hosts corresponding to each of its interfaces, and
              hosts will get the correct address based on which network
              they are attached to. Currently this facility is limited to
              IPv4.

```

---

<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:** [July 6, 2023, 10:23pm UTC](https://discourse.pi-hole.net/t/pihole-overrides-hostname-without-being-instructed-to-do-so/63455/20 "2023-07-06T22:23:58Z")

</div>

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