6

I have a piHole set up on my network with address 192.168.2.10 My router is 192.168.2.1 and the DNS settings on the router point to 192.168.2.10 meaning all traffic that goes via the router (which is everything) uses the local pihole for DNS (see screenshot below)

enter image description here

The router's firmware is DD-WRT v3.0-r33413 mini (09/27/17)

This is working great and ads are being blocked as expected, however, I want to add some local network DNS entries.

As an example, I want to be able to type http://router in a web browser and have that resolve to http://192.168.2.1

I have followed this tutorial as well as the advice in the comments of this post and now my etc/pihole/lan.list looks like this

192.168.2.1 router.lan router

I had to also made some DnsMasq changes on my DD-WRT router as follows

enter image description here

and now I am able to ping and nslookup router.lan from devices on my network. However, I am not able to ping or nslookup router as I get ping request could not find host router. Please check the name and try again.

What am I missing?

12
  • Is this problem unique to your router. If you put an entry for some other computer on your LAN in the /etc/pihole/lan.list does that work? (Also note that there were warnings in the comments about editing /etc/hosts when using this set-up.)
    – Brick
    Sep 23, 2019 at 16:11
  • Output from nslookup router.local, nslookup router.local 192.168.2.10, as in the answer by kcrk would help. Also nslookup in both formats for a public site, like, say, nslookup www.google.com and nslookup www.google.com 192.168.2.10.
    – Brick
    Sep 23, 2019 at 17:14
  • Thanks for suggestions, I have updated the question
    – SE1986
    Sep 23, 2019 at 18:44
  • I'm guessing you have more than one issue. Part one: Your Windows machine seems to be using a different DNS by default. Can you do nslookup stackexchange.com on your Windows machine? (It looks like WIndows knew the address when you specified your local DNS as an explicit argument to nslookup but not when you let is use its default.)
    – Brick
    Sep 23, 2019 at 18:53
  • Question updated
    – SE1986
    Sep 23, 2019 at 19:09

3 Answers 3

9
+25

I would try to change the domain to .lan.

This is possibly an issue with mDNS (Avahi, Bonjour, etc) that use the .local domain. It could be that Windows tries to resolve the .local domain using mDNS.

The other possibility is that the responses are rejected due to lack of DNSSec.

Try to use nslookup router.local and nslookup router.local 192.168.2.10 on the windows machine in the command line and check the responses there.

3

Relative to where you started, here are some issues that I think were part of your problem (and have been written into your updated question now):

  • The router was providing multiple DNS servers. Although your internal server was listed first, this is not a binding order of search on the router. See, e.g., https://superuser.com/questions/1177175/change-dns-search-order-on-mac-el-capitan, including the answer and comments. (Although the question started about Mac OS, the answer ultimately gets into the standards that apply to all clients.)
  • The Windows machines, and likely other machines, are using your router as their primary DNS. That's potentially OK as long as the router forwards those requests to your PiHole, which is what you accomplish by listing only that DNS as an option to your router.
  • The host names were properly resolved when you forced nslookup to use your PiHole directly. That suggests that the PiHole is properly functioning and you have some other network issue involved.

Unfortunately you still have some problem left beyond what was handled above. I suspect that is no long an issue related to your PiHole, however, and that it's a networking or routing issue at your router. To get further, I think you'll need to apply heavier tools such as monitoring the actual traffic on your network with Wireshark to see exactly which messages are passed and along which route.

2

I'm not familiar with PiHole and DD-WRT router so I cannot say much about your specific setup. But as I see the last problem is only that the local DNS name resolver does not append the default domain to a generic host name. So lets have a step by step look at this issue.

To configure the local name resolver there is /etc/resolv.conf used. With only local setup you can have one with this contents:

nameserver 192.168.2.10
search lan

The second line defines what domain to append if you only query a host name. Nowadays there are services like dhcpcd (default on Raspbian), openresolv, resolvconf or systemd-resolved that will receive settings from the DHCP server and set it to /etc/resolv.conf. This is the reason why it doesn't help if you edit the file. It will be overwritten at least on the next lease refresh from the DHCP server. The goal now is to tell your DHCP server to send the search domain option to its clients. The general DHCP reference server is the ISC DHCP server. So I will use it as example. A configuration subnet block in /etc/dhcp/dhcpd.conf could look:

subnet 192.168.2.0 netmask 255.255.255.0 {
    range 192.168.2.21 192.168.2.70;
    option broadcast-address 192.168.2.255;
    option subnet-mask 255.255.255.0;
    option routers 192.168.2.1;
    option domain-name-servers 192.168.2.10;
    option domain-search "lan";
}

This would give your configuration to clients including the domain search option if using an ISC DHCP server. It is now up to you to find out how to set the domain search option on your DHCP server so that it will send it with a lease to its clients. If it works you should find the entry in /etc/resolv.conf on every client/RasPi that uses DHCP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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