Page 1 of 1

Raspberry Pi Router not Resolving DNS

Posted: Mon Apr 01, 2019 11:01 pm
by burnedfaceless
I followed these instructions to a T

https://killtacknine.com/building-an-ub ... art-5-dns/

Initially everything was working.

After I restarted my Pi earlier the Pi quit resolving.

When I run dig on my laptop it lists the Raspberry Pi as the DNS server (and DNS Sec works so I know DNS-Crypt is working).

However running dig (or sudo apt update) on this Raspberry Pi (which is my DNS server etc) will give an error.

In summary this Pi is resolving domains for my network but not for itself.

Re: Raspberry Pi Router not Resolving DNS

Posted: Tue Apr 02, 2019 1:46 am
by default_user8
I'm sure someone will correct me if i'm wrong, but I think your pi doesn't technically have access to the internet while it is acting as a router. It's taking the ip address on eth0 and sharing that address with the connected clients on the wlan0 through the DHCP server. So even though you are connecting to your pi by the ip address you assigned the "router" that ip address isn't part of the DHCP server.

Re: Raspberry Pi Router not Resolving DNS

Posted: Tue Apr 02, 2019 2:27 am
by NGC6543
Your Pi/router should be able to resolve locally.

What happens if you enter (on the router):

dig @127.0.0.1 google.com

If it works, BIND is listening locally and probably all you need to do is tell the rest of the Pi what its DNS resolver is... 127.0.0.1.

In Raspbian that's done in /etc/dhcpcd.conf under the interfaces. If you're actually running Ubuntu, you'll have to find out where that puts its own DNS resolver address. That's my guess, anyway.

P.s. I'm not a Linux guru by any means, but I've set up one of mine as a Pihole with DSNCrypt Proxy (and Unbound but there are issues using that with some nameservers out there) and a few other services like a gps disciplined stratum-1 ntp server. I've hacked around it a fair bit so I tend to know where things are.

Re: Raspberry Pi Router not Resolving DNS

Posted: Tue Apr 02, 2019 3:17 pm
by burnedfaceless
NGC6543 wrote:
Tue Apr 02, 2019 2:27 am
Your Pi/router should be able to resolve locally.

What happens if you enter (on the router):

dig @127.0.0.1 google.com

If it works, BIND is listening locally and probably all you need to do is tell the rest of the Pi what its DNS resolver is... 127.0.0.1.

In Raspbian that's done in /etc/dhcpcd.conf under the interfaces. If you're actually running Ubuntu, you'll have to find out where that puts its own DNS resolver address. That's my guess, anyway.

P.s. I'm not a Linux guru by any means, but I've set up one of mine as a Pihole with DSNCrypt Proxy (and Unbound but there are issues using that with some nameservers out there) and a few other services like a gps disciplined stratum-1 ntp server. I've hacked around it a fair bit so I tend to know where things are.
Thanks

So dig @127.0.0.1 google.com works.

If I open /etc/resolv.conf it lists nameserver as 127.0.2.1.

I edited /etc/dhcpcd.conf. Nameserver was listed as 127.0.2.1 - I listed the correct name server.

After rebooting my Pi it still lists nameserver as 127.0.2.1 under /etc/resolv.conf.

I am running Raspbian.

Re: Raspberry Pi Router not Resolving DNS

Posted: Tue Apr 02, 2019 7:29 pm
by NGC6543
You probably know this, but just to make sure:

127.0.2.1 is what DNSCrypt is listening on. BIND is configured to use 127.0.2.1 as its upstream server, but BIND itself listens on 127.0.0.1. So, 127.0.0.1 is what you want to set as the Pi's nameserver.

Why it would change back after you edited /etc/dhcpcd.conf I don't know. Are you sure you removed any comment # character and saved the file? I don't mean to be condescending or anything with that, but it really shouldn't change. /etc/resolve.conf, on the other hand, is auto-configured and should reflect what you put in /etc/dhcpcd.conf.

There's a page here that explains setting the Pi's DNS server: https://pimylifeup.com/raspberry-pi-dns-settings/

Re: Raspberry Pi Router not Resolving DNS

Posted: Tue Apr 02, 2019 9:44 pm
by burnedfaceless
NGC6543 wrote:
Tue Apr 02, 2019 7:29 pm
You probably know this, but just to make sure:

127.0.2.1 is what DNSCrypt is listening on. BIND is configured to use 127.0.2.1 as its upstream server, but BIND itself listens on 127.0.0.1. So, 127.0.0.1 is what you want to set as the Pi's nameserver.

Why it would change back after you edited /etc/dhcpcd.conf I don't know. Are you sure you removed any comment # character and saved the file? I don't mean to be condescending or anything with that, but it really shouldn't change. /etc/resolve.conf, on the other hand, is auto-configured and should reflect what you put in /etc/dhcpcd.conf.

There's a page here that explains setting the Pi's DNS server: https://pimylifeup.com/raspberry-pi-dns-settings/
There are no comments covering up what I wrote, but the interface (i.e. Eth 0) has a different IP Address than the one that is listed. A local IP Address is listed and my public IP Address is eth0 (it's plugged into internet).

Also when I try to restart DHCPCD I get this error when I type journalctl -xe

Apr 02 17:40:24 router dhcpd[889]: uid lease 192.168.42.27 for client b8:27:eb:bd:2f:3f is duplicate on 192.168.42.0/24