burnedfaceless
Posts: 25
Joined: Tue Feb 12, 2019 12:31 pm

Raspberry Pi Router not Resolving DNS

Mon Apr 01, 2019 11:01 pm

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.

User avatar
default_user8
Posts: 644
Joined: Mon Nov 18, 2013 3:11 am

Re: Raspberry Pi Router not Resolving DNS

Tue Apr 02, 2019 1:46 am

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.
Two heads are better than one, unless one's a goat head.

User avatar
NGC6543
Posts: 75
Joined: Thu Feb 28, 2019 7:30 pm
Location: Lancashire, UK

Re: Raspberry Pi Router not Resolving DNS

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.

burnedfaceless
Posts: 25
Joined: Tue Feb 12, 2019 12:31 pm

Re: Raspberry Pi Router not Resolving DNS

Tue Apr 02, 2019 3:17 pm

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.

User avatar
NGC6543
Posts: 75
Joined: Thu Feb 28, 2019 7:30 pm
Location: Lancashire, UK

Re: Raspberry Pi Router not Resolving DNS

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/

burnedfaceless
Posts: 25
Joined: Tue Feb 12, 2019 12:31 pm

Re: Raspberry Pi Router not Resolving DNS

Tue Apr 02, 2019 9:44 pm

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

Return to “Networking and servers”