How to add pi.hole to /etc/hosts

  • Well first I need to describe my actual config:


    I have installed pihole on a docker ( MacVLAN to use port 80; I use 192.168.1.3 as IP for this docker) that works very well for all the LAN and all PC and devices.


    I configure pihole not only as a DNS Server, I configure as DHCP server too.


    My NAS have IP 192.168.1.4 255.255.255.0 and use as DNS Server 8.8.8.8 (configured in OMV WebGUI), this is because if use 192.168.1.3 that is the IP of my pihole DNS Server I have some errors on OMV boot (probably due OMV need to resolve DNS and docker still is not ready).


    So actual config works well except that my NAS can't resolve http://pi.hole or http://pihole because I use google DNS in OMV


    I want to add 192.168.1.3 pi.hole to /etc/hosts but file says:


    So my question is:


    how to add line 192.168.1.3 pi.hole so my NAS (PDNS) know to resolve pihole address without lose on reboots / updates?.

  • how to add line 192.168.1.3 pi.hole so my NAS (PDNS) know to resolve pihole address without lose on reboots / updates?.

    Isn't this 192.168.1.4 PDNS.local PDNS auto generated from the network in OMV's GUI.


    To do what you want to do I think you would have to change the way pi-hole is set up using the MacVlan, I found this on Docker I tried setting the DHCP on Pi-Hole and it just didn't work for me, I now use the dnsmasq plugin and point the DNS server to Pi-Hole.

    Raid is not a backup! Would you go skydiving without a parachute?

  • Isn't this 192.168.1.4 PDNS.local PDNS auto generated from the network in OMV's GUI.

    NO, PDNS is the name of my NAS and is well resolved, the only not resolved is pi.hole if I try to use from PDNS if I try to use from a normal PC works fine ( because PC are DHCP and use 192.168.1.3 as DNS resolver).


    So my question is: how to add line 192.168.1.3 pi.hole PIHOLE so my NAS (PDNS) know to resolve pihole address without lose on reboots / updates?

  • NO, PDNS is the name of my NAS and is well resolved

    I understand that, but that entry is made/added automatically by OMV using the information in your Network>>>Interfaces. That's why I referenced the link to Docker re the Macvlan, OMV is not aware of Pi-Hole's name or ip address, therefore Pi-Hole will not appear in the hosts file. I'm not very good at explaining, but put as a reference you need a symlink that will create an entry in the hosts file.
    So my understanding would be is that the MacVlan would need to be a MacVlan-Bridge which might create the entry in the hosts file.

    Raid is not a backup! Would you go skydiving without a parachute?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!