Pi as DNS server - local names not resolving through DHCP


Recommended Posts

I really don't know that much about networking, but somehow I've managed to get this far and it works bar one bugbear. I'm not sure if it's a DDWRT issue, or I've set the network up wrong. Local DNS names don't seem to work when offered via the router DHCP.

 

So, I have a Raspberry Pi which acts as the DNS server for my home network. This is fixed at IP address 192.168.1.10. 

If I tell my devices to use that DNS server, everything works as expected and I can access my pi by using local dns name http://pi.sky/

 

However, I'd like to not have to change the device config, rather get that served from the router. I run DDWRT, and under Router IP settings I've changed the DNS to 192.168.1.10, and also in the DHCP Server settings I've changed it. See below:

Screenshot 2016-06-29 at 20.16.43.png

 

Now, DNS works fine across all devices, and they're genuinely using the Pi as their DNS server (can see the requests on the Pi itself). However, I can't access it anymore using the local name. I just get a "Name not resolved" error. I have to browse to it using the IP address instead. Is this some sort of DDWRT quirk, or am I missing something in the setup (likely something basic!)?


Please help me oh wise gurus!!!? 

Seems you are running DHCP on both the Pi and the router, only one should be handling DHCP, is that's the case turning it off on the router will get you access back to the Pi because there is a conflict going on at the moment 

What can you not access your dd-wrt by its name?  Did you create a record in your dns running on pi to point to the dd-wrt router?

 

What dns are you running on the pi?  On a side note, IMHO single label not a good idea.. .sky is your tld and seems your only using that.. how about home.sky so it would be pi.home.sky or something like that. 

So, to try and clarify a few things:

The Pi is running something called Pi-Hole. It's a DNS adblocker with a web-gui. It's accessible through it's IP address or via http://pi.hole/

If on my devices, I manually point DNS to the Pi IP, I can access the web-gui by that short address. 

 

The issue arises when I don't set them manually and let the router DHCP does it's job. I've pointed DDWRT to use the the Pi as the DNS server. Any devices on the network are definitely using the Pi as the DNS server this way as I can see the requests coming in. But that is when the short address stops working - I can only access it via the IP address.

 

I'm pretty much at my limit of knowledge with this sort of thing now. But I see it where I'm at the point this may be a good opportunity to understand things a bit better - I'm not just after a quick fix.

 

so get down to some basics...

ping - this command allows you to test basic communications between the device/computer you are on to a remote device.  If you get replies, this signifies two things...the computer you are on can query the network to translate a host name to an ip and it can communicate with the remote device

 

nslookup - this command allows you to query the dns server named in your ip properties for a name or address that you type in.

 

examples of both commands:

 

ping www.google.com

ping 172.217.2.196

 

nslookup www.google.com

nslookup 172.27.2.196

 

these two commands will give you some basic information that will allow you to further troubleshoot network issues.  So using these commands you want to make sure that "pi.hole" is resolving to the right ip addresses and that the dns query is quering the proper server when looking up "pi.hole"

so if you do a query to your pi for pi.hole do you get a response?

 

What are you using to test your dns with? Dig, nslookup, drill, host, just a ping?

 

I would suggest you grab dig very easy to use, then do a query to your pi for what your looking up.  What records have you setup for your local network in this dns, are you clients setup to self register?

 

So if I query my pfsense box which is running my dns, which is unbound in resolver mode and I ask it for its own name.. I get a response..

dnsquery.jpg

 

So from here you can see TON of info that would help you troubleshoot your issue.  So you can see what I asked for in the query section, you can see the answer I got back, you can see what server I asked, what the response time was in ms.  You can see the TTL on the record I looked up.  You see the status dns returned back, the flags on the settings for example that recursion was asked for, etc.

 

What are you clients actually pointing too for dns?  Simple enough to see with ipconfig /all

 

dnsviadhcp.jpg

 

So you can see what dns client is pointing too, you see it got IP from dhcp server, you see what search suffix it might be using which could throw off your dns query.

 

 

true dig is not native windows, but it takes all of 10 seconds to install and is so much better than nslookup ;)  Grab bind from isc, install just the tools.

 

https://www.isc.org/downloads/

 

 

installdig.jpg

This is the output (using another pi) when using router assigned DNS:

 

pi@raspberrypi:~ $ dig 192.168.1.10

; <<>> DiG 9.9.5-9+deb8u6-Raspbian <<>> 192.168.1.10
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63436
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;192.168.1.10.                  IN      A

;; ANSWER SECTION:
192.168.1.10.           0       IN      A       192.168.1.10

;; Query time: 8 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Thu Jun 30 16:56:48 UTC 2016
;; MSG SIZE  rcvd: 57

pi@raspberrypi:~ $ dig pi.hole

; <<>> DiG 9.9.5-9+deb8u6-Raspbian <<>> pi.hole
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20115
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;pi.hole.                       IN      A

;; Query time: 5 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Thu Jun 30 16:57:41 UTC 2016
;; MSG SIZE  rcvd: 36

 

Edited by Biohead

Same again, this time changing to use a static IP + DNS pointing directly at 192.168.1.10

 

pi@raspberrypi:~ $ dig 192.168.1.10

; <<>> DiG 9.9.5-9+deb8u6-Raspbian <<>> 192.168.1.10
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24012
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;192.168.1.10.                  IN      A

;; ANSWER SECTION:
192.168.1.10.           300     IN      A       192.168.1.10

;; Query time: 16 msec
;; SERVER: 192.168.1.10#53(192.168.1.10)
;; WHEN: Thu Jun 30 17:50:03 UTC 2016
;; MSG SIZE  rcvd: 57

pi@raspberrypi:~ $ dig pi.hole

; <<>> DiG 9.9.5-9+deb8u6-Raspbian <<>> pi.hole
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26984
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;pi.hole.                       IN      A

;; ANSWER SECTION:
pi.hole.                300     IN      A       192.168.1.10

;; Query time: 5 msec
;; SERVER: 192.168.1.10#53(192.168.1.10)
;; WHEN: Thu Jun 30 17:51:15 UTC 2016
;; MSG SIZE  rcvd: 52

 

you notice when you don't get an answer for pi.hole your asking your router at 192.168.1.1, not .10

 

So no why would it have a record?

 

To be honest there really shouldn't even be A records for IP addresses so not sure why your getting such an answer..  If you want do a query for an IP you need to do a PTR, with dig you can do that with -x option

 

see

 


Budman@I5-WIN C:\Users\budman                                            
> dig -x 192.168.9.100                                                   
                                                                         
; <<>> DiG 9.10.4-P1 <<>> -x 192.168.9.100                               
;; global options: +cmd                                                  
;; Got answer:                                                           
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10652                
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1  
                                                                         
;; OPT PSEUDOSECTION:                                                    
; EDNS: version: 0, flags:; udp: 4096                                    
;; QUESTION SECTION:                                                     
;100.9.168.192.in-addr.arpa.    IN      PTR                              
                                                                         
;; ANSWER SECTION:                                                       
100.9.168.192.in-addr.arpa. 3600 IN     PTR     i5-win.local.lan.        
                                                                         
;; Query time: 0 msec                                                    
;; SERVER: 192.168.9.253#53(192.168.9.253)                               
;; WHEN: Fri Jul 01 07:46:09 Central Daylight Time 2016                  
;; MSG SIZE  rcvd: 85                                                   

 

In your first query that devices is not asking your pi, its asking your dd-wrt.. Maybe it did not update its lease, maybe it has dns set static.. What is the output of its ipconfig /all

 

I noticed that... it's as though even though the router is told is use the Pi as the DNS server for the local network it's not directly telling connected devices - rather acting as a middleman. Which is what lead me to think it's possibly a router issue - is this something worth asking over on the ddwrt board?

I don't think it being a Pi comes into play at all. It just so happens this software was built in mind for a pi - it can run on most linux distros.

 

It's the fact devices are showing the router as the DNS server, despite me telling the router to use the Pi address. I can see the live dns requests coming in on the pi from the devices, so clearly it's doing it's job - just the router isn't. When I take the router out of the equation (i.e. use static IP + manually set DNS) everything works as expected.

dude post up your ipconfig /all from this device.. It clearly is not asking your pi so clearly its set to ask your router.  Did it update your lease since you set your dhcp server to point to the pi?

Sorry, I thought I'd replied this morning. I'm away now so can't post the output. 

However I did manage to resolve the problem - in ddwrt theres an option in the dhcp setup "Use DNSMasq for DNS". 

It's enabled by default, but if you're using an alternative DNS it has to be disabled to point clients directly to the other DNS server - otherwise the router is still a DNS server, just sending it's requests to the other one. 

When I did an ipconfig before, the DNS server was listed as 192.168.1.1, now it's listing as 192.168.1.10 as I hoped for.

 

Thanks for the help guys, never knew of the dig tool before and it looks quite useful. 

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Rockstar gives last-gen GTA V players free upgrades tomorrow by Pulasthi Ariyasinghe Rockstar is preparing to launch Grand Theft Auto VI later this year, but ahead of that, the company has revealed a new offer for some Grand Theft Auto V owners. It today announced that Xbox One and PlayStation 4 version owners of the 2013-released title will soon be receiving a free upgrade to the current generation version. The studio released the Xbox Series X|S and PlayStation 5 version of Grand Theft Auto V back in 2022, bringing significant upgrades to the original console editions. This included 60 FPS gameplay at up to 4K resolution, as well as major upgrades to textures, draw distance, and audio. Faster load times, ray tracing elements, and HDR support were also added with it. While this new and enhanced version needed a new purchase of the game to jump in, now Rockstar has decided to make it a free upgrade, dropping the $40 price tag entirely on consoles. "Beginning tomorrow, those who own any PS4 version or the digital Xbox One version of Grand Theft Auto V will be able to upgrade to the PS5 or Xbox Series X|S versions at no additional cost, and experience the best versions of GTA V and GTA Online," said the company in an official blog post. The free upgrade offer will be released tomorrow, June 18, for all Xbox One and PlayStation 4 owners of Grand Theft Auto V. Players who will be jumping in on the offer will want to check how to migrate their GTA Online profile from last-generation to current-generation consoles by heading over here. The offer lands ahead of The Kortz Center Heist hitting Grand Theft Auto Online, where players and crews will be tasked with stealing priceless international art from a prestigious gallery in Pacific Bluffs. It doesn't look like Rockstar plans to stop updating its previous game even with Grand Theft Auto VI being on the horizon. The latest title is slated to launch on November 19, 2026, across Xbox Series X|S and PlayStation 5.
    • Now comes with a money back guarantee instead of a replacement! Hah
    • Rufus 4.15.2391 Beta by Razvan Serea Rufus is a small utility that helps format and create bootable USB flash drives, such as USB keys/pendrives, memory sticks, etc. Despite its small size, Rufus provides everything you need! Oh, and Rufus is fast. For instance it's about twice as fast as UNetbootin, Universal USB Installer or Windows 7 USB download tool, on the creation of a Windows 7 USB installation drive from an ISO (with honorable mention to WiNToBootic for managing to keep up). It is also marginally faster on the creation of Linux bootable USBs from ISOs. A non-exhaustive list of Rufus supported ISOs is available here. It can be especially useful for cases where: you need to create USB installation media from bootable ISOs (Windows, Linux, UEFI, etc.) you need to work on a system that doesn't have an OS installed you need to flash a BIOS or other firmware from DOS you want to run a low-level utility Rufus 4.15.2391 Beta changelog: Improve the guards for using the "silent" option Improve the ability to cancel during write retries Fix unrestricted XML entity expansion and integer overflow in ezxml parser (courtesy of @esadowski4) [GHSA-55r2-34wg-8mv9] Fix "silent" Windows installation failing at 75% in most cases [#2960] Fix a crash during boot when using UEFI:NTFS on Snapdragon X based ARM64 platforms [#2934] Fix the first WUE option always being checked by default [#2965] Fix an infinite loop when using Windows ISOs that contain multiple WIMs Fix "Enable runtime UEFI media validation" checkbox not always being properly enabled Other WUE improvements/fixes for OneDrive removal and username validation (with thanks to @christian8641) [#2984, #2991] Download: Rufus 4.15 Beta | 1.9 MB (Open Source) Links: Rufus Home Page | Project Page @GitHub | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Media Player Classic - Home Cinema 2.7.3 by Razvan Serea Media Player Classic - Home Cinema (MPC-HC) is a free and open-source video and audio player for Windows. MPC-HC is based on the original Guliverkli project (which is no longer maintained) and contains many additional features and bug fixes. As the continuation of the original Media Player Classic, MPC-HC isn’t flashy but it works with nearly any media format. MPC-HC uses DXVA technology to pass decoding operations to your modern video card, enhancing your viewing experience. And MPC-HC supports both physical and software DVDs with menus, chapter navigation, and subtitles. Overview of features A lot of people seem to be unaware of some of the awesome features that have been added to MPC-HC in the past years. Here is a list of useful options and features that everyone should know about: Dark interface Menu > View > Dark Theme When using dark theme it is also possible to change the height of the seekbar and size of the toolbar buttons. Options > Advanced Video preview on the seekbar Options > Tweaks > Show preview on seek bar Adjust playback speed Menu > Play > Playback rate The buttons in the player that control playback rate take a 2x step by default. This can be customized to smaller values (like 10%): Options > Playback > Speed step Adjusting playback speed works best with the internal audio renderer. This also has automatic pitch correction. Options > Playback > Output > Audio Renderer MPC-HC can remember playback position, so you can resume from that point later Options > Player > History You can quickly seek through a video with Ctrl + Mouse Scrollwheel. You can jump to next/previous file in a folder by pressing PageUp/PageDown. You can perform automatic actions at end of file. For example to go to next file or close player. Options > Playback > After Playback (permanent setting) Menu > Play > After Playback (for current file only) A-B repeat - You can loop a segment of a video. Press [ and ] to set start and stop markers. You can rotate/flip/mirror/stretch/zoom the video Menu > View > Pan&Scan This is also easily done with hotkeys (see below). There are lots of keyboard hotkeys and mouse actions to control the player. They can be customized as well. Options > Player > Keys Tip: there is a search box above the table. You can stream videos directly from Youtube and many other video websites You can stream videos directly from Youtube and many other video websites Put yt-dlp.exe or youtube-dl.exe in the MPC-HC installation folder. Then you can open website URLs in the player: Menu > File > Open File/URL You can even download those videos: Menu > File > Save a copy Tip: to be able to download in best quality with yt-dlp/youtube-dl, it is recommended to also put ffmpeg.exe in the MPC-HC folder. Several YDL configuration options are found here: Options > Advanced This includes an option to specify the location of the .exe in case you don't want to put it in MPC-HC folder. Play HDR video This requires using madVR or MPC Video Renderer. After installation these renderers can be selected here: Options > Playback > Output Ability to search for and download subtitles, either automatically or manually (press D): Options > Subtitles > Misc Besides all these (new) features, there have also been many bugfixes and internal improvements in the player in the past years that give better performance and stability. It also has updated internal codecs. Support was added for CUE sheets, WebVTT subtitles, etc. Media Player Classic - Home Cinema 2.7.3 changelog: Updated LAV Filters to version 0.82 Updated MPC Video Renderer to version 0.10.4.2550 Updated MPC Audio Renderer A few crash fixes, bug fixes and small improvements. Download: MPC-HC 2.7.3 (x64) | Standalone | ~20.0 MB (Open Source) Download: MPC-HC 2.7.3 (x86) | Standalone Links: MPC-HC Home Page | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • One Month Later
      Vincian earned a badge
      One Month Later
    • First Post
      Jocimo earned a badge
      First Post
    • Week One Done
      suprememobiles48 earned a badge
      Week One Done
    • One Month Later
      Windows Guy earned a badge
      One Month Later
    • One Month Later
      Prasann earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      510
    2. 2
      +Edouard
      172
    3. 3
      PsYcHoKiLLa
      89
    4. 4
      Steven P.
      76
    5. 5
      neufuse
      69
  • Tell a friend

    Love Neowin? Tell a friend!