# Pi-hole install script and dhcpcd.conf

**URL:** <https://discourse.pi-hole.net/t/pi-hole-install-script-and-dhcpcd-conf/48047>\
**Category:** Community Help\
**Created:** [July 5, 2021, 2:49pm UTC](https://discourse.pi-hole.net/t/pi-hole-install-script-and-dhcpcd-conf/48047 "2021-07-05T14:49:11Z")\
**Posts on this page:** 1\
**Showing post:** 12

<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:** [July 5, 2021, 11:44pm UTC](https://discourse.pi-hole.net/t/pi-hole-install-script-and-dhcpcd-conf/48047/12 "2021-07-05T23:44:02Z")

</div>

> [@Roo](#):
>
> For whatever reason, when you issue `sudo` on Ubuntu, it does a name lookup. With the way that pi-hole goes and whacks the DNS when it configures a static IP for you - it breaks the ability to look up the /etc/hostname name. That's messed up

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.

> [@Roo](#):
>
> which is why I hacked /etc/hosts to fix it for my configuration

Thats not hacking, thats the only proper way or a variant of it (I use `127.0.1.1` to the same effect):

```auto
pi@ph5b:~ $ cat /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

```

---

_[View the full topic](https://discourse.pi-hole.net/t/pi-hole-install-script-and-dhcpcd-conf/48047)._
