Hi all - I have something of a puzzle that I hope I can get a few pointers on...
Setup:
Router - Linksys WRT1900ACS running OpenWrt 21.02.1
Pi-Hole - v5.6 running on a Raspberry Pi
Linux laptop - Mint 20.2 Cinnamon v5.0.6 running on an old ThinkPad
My linux machine had been connecting just fine a few weeks ago when I was running OpenWrt 19.x and a several versions out of date pi-hole. In the last couple weeks I updated the router and pi-hole; for the router I had to reset everything from scratch b/c of the version upgrade. Every other device on the network is connecting fine (Windows Dell and ThinkPad laptops, android devices, Roku, NAS...) both wired and wifi, but when I fired up my linux laptop yesterday, it connects to the LAN just fine via wifi but I'm not getting internet access.
More specifically, I seem to not be getting DNS resolution - I can ping IP addresses (e.g. 8.8.8.8) and that seems to work fine, but pinging "openwrt.org" gives me a "Name or service not known" time-out. And I can connect to the router and pi-hole web page interface on the LAN - it's just the WAN web pages and other services (updates, VPN) that are getting blocked.
I'm not a noob, but I am novice enough that I don't even know where to begin to start looking for the problem. The fact that every other device connects fine suggests it's a linux issue, but nothing has changed on the linux machine, so I have to think it's a router or pi-hole setting -- but it seems to be working with everything else (pi-hole logs showing requests blocked/allowed, etc). I'm at a loss, and internet/forum searches have been fruitless - any suggestions on where to start looking would be greatly appreciated.
How is the linux system connected (wired or wireless) and how does it get its IP address info (dhcp or static IP)? What is it reporting for the values of the IP, subnet mask, router/gateway, and DNS?
How is the pihole connected to the network and what is its IP address? if you ssh to the pi, can you resolve dns normally?
Are you using any VLANs or is your network flat?
Please copy the output of the following commands and post it here using the "Preformatted text </> " button:
Remember to redact passwords, MAC addresses and any public IP addresses you may have:
to me it sounds like the linux machine is expecting the router itself to be the DNS server (possibly ignoring part of DHCP information that the other devices are accepting?), but you likely have not configured dnsmasq yet, so that becomes a dead end for DNS requests
to start, just specify which DNS servers you want the router to use for itself
in /etc/config/dhcp under dnsmasq this would be for example list server '8.8.8.8'
in LuCI this would be
Network --> DHCP and DNS --> DNS forwardings
Thanks mpratt14, that's exactly the kind of thing I was looking for. I did not have a DNS server specified in the LAN settings (no list server in the dchp config file), but adding one (either google/cloudfare's IP or the IP of my pi-hole) did not affect the linux connection - it also didn't affect any other connection, so there's that.
I'll add that under Network --> Interfaces --> LAN --> DCHP Server --> Advanced Settings, I do have "6,192.168.1.xxx" set under DHCP-options, which "advertises different DNS servers to clients" -- in this case the IP of the pi-hole. I think that was supposed to take care of that. Not that the linux machine is recognizing that necessarily...
just understand there is a distinction between advertising DNS servers, and configuring DNS forwarding. I personally don't care to add DHCP options and let the router (dnsmasq) do all the work for DNS
frollic: The router is hosting the dhcp; the pi-hole is hosting the DNS.
mpratt: I understand there is a distinction, altho I'm not entirely clear on what that distinction is. Configuring DNS forwarding was the recommended method in the "set up OpenWRT and Pi-Hole" documentation I was following but I don't personally have a preference. And you are correct, still not working even after setting DNS forwarding.
Interestingly, when I tried nslookup on different devices as you recommended:
Windows laptop:
openwrt.org - resolves using pi.hole server IP
openwrt.org 8.8.8.8 - resolves
openwrt.org <router> - resolves
openwrt.org <pi-hole> - resolves
NAS:
openwrt.org - resolves using raspberrypi localhost (127.0.1.1)
openwrt.org 8.8.8.8 - resolves
openwrt.org <router> - resolves
openwrt.org <pi-hole> - resolves
Router:
openwrt.org - resolves using localhost
openwrt.org 8.8.8.8 - resolves
openwrt.org <router> - resolves
openwrt.org <pi-hole> - resolves
RaspberryPi:
openwrt.org - resolves using cloudflare (the pi-hole's upstream DNS server)
openwrt.org 8.8.8.8 - resolves
openwrt.org <router> - resolves
openwrt.org <pi-hole> - resolves
Linux laptop:
openwrt.org - does not resolve
openwrt.org 8.8.8.8 - resolves
openwrt.org <router> - resolves
openwrt.org <pi-hole> - resolves
So maybe this is looking like a linux problem after all?
Follow-up: It was definitely a linux problem. More specifically, it's probably either a communication problem b/t dnsmasq on the linux machine and dnsmasq on the router; or it's a problem with systemd-resolve(d) on that particular flavor of linux. I haven't been able to track down the exact issue yet, but I was finally able to force linux to use the router (and therefor the pi-hole) as the dns server by installing resolvconf. Following that track suggests there are better or at least more elegant solutions, but at least it's working for now. Thanks everyone!