Above is bit confusing?
Sounds as if something is/was missconfigured in below files which the Pi-hole installer doesnt touch:
/etc/hostname
/etc/hosts
The nslookup
tool doesnt read/resolve names in the /etc/hosts
file.
Instead it default queries the nameserver
(s) defined in below file (which is usualy populated by your installed network manager) if dont specify a DNS server as an extra argument:
/etc/resolv.conf
Above code only applies if the network manager called dhcpcd5
is installed and active (like for the Pi-OS distro).
My Debian laptop uses an entirely different network manager called NetworkManager
thus above code would not apply.
And most likely, your Ubuntu distro uses netplan
as a network manager.
Not everyone boots up his/her Pi-hole instance as a DHCP client OOTB.
When I setup a Pi-hole host on a Raspi, my Pi will not query DHCP at any stage.
Instead once I've written the Pi-OS image for my Raspi, I mount the SD card partitions on another host and set a static IP manually plus activate sshd
before I insert the SD card in the Pi and boot.
Many hypervisors allow to boot up a VM guest already configured with a static IP.
That code snippet clearly states "Do you want to use your current network settings as a static address?".
And "Otherwise, we need to ask the user to input their desired settings.".
So the PI_HOLE_DNS1
& PI_HOLE_DNS2
IP's is/are derived from what you've chosen it to be.
These settings/DNS IP's are unrelated to what you choose as upstream DNS servers for the pihole-FTL
daemon during install (or via the GUI).
These are settings that also need to be in place if you were not running Pi-hole on the host just like any OS thats connected and needs DNS settings.
You have to keep in mind that at first, the host is only a DNS client and depends on an external DNS server for resolution.
Once you've installed Pi-hole, the host functions as a DNS client AND server.
And the host can be a client to its own services if you choose so.
But this is not necessary for your other network clients to function properly.
I for example have configured an external PI_HOLE_DNS1
IP (my router) because when tinkering (which I do allot) and break Pi-hole again, I still have DNS available for local running software.
As it feels like your question was based on wrong assumptions, could you rephrase your question again pls?