1

I have a Raspberry Pi 2 running Pi Hole 5.2.2 and Cisco Linksys E2000 router running DD-WRT v24-sp2 (08/12/10) std-usb-ftp

I want to be able to have PiHole resolve a DNS entry such as MyDevice to an ip address such as 192.168.2.8 so when i navigate to http://Mydevice I go to the same page as http://192.168.2.8

I have PiHole configured as my DNS and DHCP servers, the router config as below: (pi hole is @ 192.168.2.10)

enter image description here

I have managed to achieve what i want, but only for those devices that are assigned an IP by the PiHole DHCP server, those clients that have their own static IP cannot connect via this method.

I have added

192.168.2.8 MyDevice

to both /etc/hosts and /etc/pihole/local.list

I have added a record to PiHoles DNS Record screen as follows:

enter image description here

and a CNAME record:

enter image description here

From my windows PC with a static IP, this setup allows me to browse to

http://mydevice.local which brings me to the same screen as http://192.168.2.8 but http://mydevice does not resolve.

If I change from a static IP to a dynamic IP, both http://mydevice.local and http://mydevice resolve to http://192.168.2.8 as expected

nslookups and pings from the windows machine:

C:\Users\Me>nslookup mydevice
Server:  PiHole.lan
Address:  192.168.2.10

Name:    mydevice.lan
Address:  192.168.2.8
Aliases:  mydevice


C:\Users\Me>nslookup mydevice.lan
Server:  PiHole.lan
Address:  192.168.2.10

Name:    mydevice.lan
Address:  192.168.2.8


C:\Users\Me>ping mydevice
Ping request could not find host mydevice. Please check the name and try again.

C:\Users\Me>ping mydevice.lan

Pinging mydevice.lan [192.168.2.8] with 32 bytes of data:
Reply from 192.168.2.8: bytes=32 time<1ms TTL=64
Reply from 192.168.2.8: bytes=32 time<1ms TTL=64

I have tried

  • just having the entry in /etc/hosts (with no DNS record or CNAME record)
  • just having the entry in /etc/pihole/local.list (no DNS record or CNAME record)
  • DNS and CNAME record configured but neither /etc/pihole/local.list nor /etc/hosts

and all give the same behaviour (I restarted the DNS after each change with pihole restartdns)

What have I missed?

(I have asked this question on this forum over a year ago and am now revisting the problem. However, due to a new router, different router / pi hole configs and a new major version of PiHole since I asked that question, I felt it warranted a new question)

2
  • 1
    in windows, whats the difference between nslookup mydevice and nslookup mydevice.lan – Jaromanda X Jan 14 at 1:25
  • 1
    @JaromandaX question updated with output – SEarle1986 Jan 14 at 10:38
0

I was just wrestling with the same problem. What seemed to help was flushing the network table of the pi hole. Now domain names in the form of name.tld get resolved seamlessly. Single word domain names are funny though. Some words get resolved and some others don't. I don't know why and so far I haven't been able to determine a pattern on which words work and which don't. This is just with the pi hole local DNS settings.

EDIT: So all the single word domains were pointing to services with ipv6 enabled.

C:\Users>ping xyz
Ping request could not find host xyz. Please check the name and try again.

C:\Users>ping xyz.y

Pinging xyz.y [192.168.1.101] with 32 bytes of data:
Reply from 192.168.1.101: bytes=32 time<1ms TTL=64
Reply from 192.168.1.101: bytes=32 time<1ms TTL=64
Reply from 192.168.1.101: bytes=32 time<1ms TTL=64
Reply from 192.168.1.101: bytes=32 time<1ms TTL=64

Ping statistics for 192.168.1.101:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\Users>ping xyz
Ping request could not find host xyz. Please check the name and try again.

C:\Users>ping xyzxyz
Ping request could not find host xyzxyz. Please check the name and try again.

C:\Users>ping bigdata

Pinging BIGDATA.local [fe80::12bf:48ff:fe8a:95ed%18] with 32 bytes of data:
Reply from fe80::12bf:48ff:fe8a:95ed%18: time<1ms
Reply from fe80::12bf:48ff:fe8a:95ed%18: time<1ms
Reply from fe80::12bf:48ff:fe8a:95ed%18: time<1ms
Reply from fe80::12bf:48ff:fe8a:95ed%18: time=1ms

Ping statistics for fe80::12bf:48ff:fe8a:95ed%18:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 1ms, Average = 0ms

C:\Users>ping monster

Pinging MONSTER [fe80::a547:4d39:e54b:fd66%18] with 32 bytes of data:
Reply from fe80::a547:4d39:e54b:fd66%18: time<1ms
Reply from fe80::a547:4d39:e54b:fd66%18: time<1ms
Reply from fe80::a547:4d39:e54b:fd66%18: time<1ms
Reply from fe80::a547:4d39:e54b:fd66%18: time<1ms

Ping statistics for fe80::a547:4d39:e54b:fd66%18:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
0

after updating your host file you have to run this command.

sudo /opt/pihole/gravity.sh

you need to run the command after each change in your host file..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.