You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FEATURE REQUEST:
I'd like to add easy DNS entrees, so i can reach my local devices over them. Since hostnames are not working after switching DNS from router to pihole, this would be nice. I'm very sorry if i reposted this, i did not find it under open issues.
This template was created based on the work of udemy-dl.
Reacted by Will Pracht, Dave Snyder, Luis Rodriguez, Matt Park, Joel Handwell, spotlesscoder, Bradford, Ian Walter, Damien Goujard, h44z and 23 more
Are you asking to use a custom upstream provider for your DNS server (in place of Google or OpenDNS for example) or are you asking about entering data into the Pi-hole's HOSTS file so that you can reach local machines by their short names?
Okay, I will pass that along as a feature request, it's possible to do now, if you use the Pi-hole's dnsmasq process as your DHCP server, but we need to work out a way to safely edit the /etc/hosts file and determine a process to present those options to the users. If the Pi-hole also acts as the DHCP server, then dnsmasq will automatically add the short name to the resolver's lookups but this would require disabling the DHCP server on the router and passing that function over to the Pi. It's a feature we are talking about, but we want to do it in a sane way that will hopefully avert the possibility of a user locking themselves out, :) If you'd like to open a Feature Request over on discourse then other users will be able to vote and comment on the idea.
This is working very well here. Don't forget to flush DNS on Windows machine when testing.
You cannot enter these values in the webinterface, there only default values are possible (it's the wildcard option). Maybe it could be added to the webinterface.
Reacted by Jason Killam, Jens Kohl, moleN, Niclas, davidjimenez75, Tejonaco, Toby Cowles, Ricardo Carneiro, Ole Reidar Holm, sgerodes and 1 more
You can also make a new file in /etc/dnsmasq.d/ with .conf extentsion. All files in this directory are read by dnsmasq. You can add/map DNS entries just like I said in my previous post like this:
Conf files are sourced lexicographically, so 01 first, but typically they are named with a number leading, so 99 would be sourced last, so a 50-mom.conf would be in the middle and can still be overridden. (dnsmasq will throw errors if commands are duplicated, but should be okay if they are appending.)
If i write this, would it be possible to include this into the project as a
dependency, so others could use this? Maybe it could be used from pihole
itself..?
I'm much more interested in setting a custom DNS entry for https://archive.is/, as seeing how they actively block CloudFlare DNS from querying them (they point to 127.0.0.4).
at present, the cleanest way to add your own dns records would be :
make sure that /etc/dnsmasq.conf contains the line : conf-dir=/etc/dnsmasq.d
create a file in /etc/dnsmasq.d to store your custom dns records :
$ ls -lha /etc/dnsmasq.d
total 57K
drwxr-xr-x 2 root root 7 Oct 31 10:52 .
drwxr-xr-x 95 root root 187 Oct 29 10:27 ..
-rw-r--r-- 1 root root 1.6K Oct 31 10:52 01-pihole.conf
-rw-r--r-- 1 root root 488 Oct 27 11:45 02-pihole-dhcp.conf
-rw-r--r-- 1 root root 1.9K Aug 13 15:57 04-pihole-static-dhcp.conf
-rw-r--r-- 1 root root 47 Jun 22 11:54 98-hostrecords-dns.conf
-rw-r--r-- 1 root root 175 Aug 13 15:59 99-reservations-dhcp.conf
$ cat 98-hostrecords-dns.conf
host-record=mydomain.duckdns.org,192.168.1.10
Add as many host-record lines as you like.
Don't forget to pihole restartdns if you add/remove domains.
Reacted by makeworld, Matt Lorentz, Erik Hennerfors, Nicolas Coutin, János Gyurisán, masukomi (a.k.a. Kay Rhodes), Krasimir Nedelchev, seriouz, Alesh Lerch, Santiago Toledo and 4 more
Reacted by Alesh Lerch, Santiago Toledo and Stev Leibelt
@Zixim then there is a bug, when using the host-records directive the pi-hole manager says the DNS service does not start, which i can see as i can't lookup any addresses anymore?
did you perhaps edit the .conf file with a windows text editor ? dnsmasq --test will do basic syntax checks on the config files
EDIT : hmm...dnsmasq --test doesn't work on pihole. Check syslog for errors ?
EDIT EDIT : pihole-FTL dnsmasq-test is the right syntax for modern Piholes.
Weird... i just tried again and now it works. I prepared to check all logs, FTL, pihole, daemon.log etc. but no error and it works as expected. I only move back the file which i had given the ending .bck to 98-hostrecords-dns.conf and performed a restart. Thanks anyhow!
Activity
dschaper commentedon Dec 9, 2016
Are you asking to use a custom upstream provider for your DNS server (in place of Google or OpenDNS for example) or are you asking about entering data into the Pi-hole's HOSTS file so that you can reach local machines by their short names?
pkramme commentedon Dec 9, 2016
Latter.
AzureMarker commentedon Dec 9, 2016
Add your hosts to your Pi-hole's
/etc/hostsfile.dschaper commentedon Dec 9, 2016
Okay, I will pass that along as a feature request, it's possible to do now, if you use the Pi-hole's
dnsmasqprocess as your DHCP server, but we need to work out a way to safely edit the/etc/hostsfile and determine a process to present those options to the users. If the Pi-hole also acts as the DHCP server, thendnsmasqwill automatically add the short name to the resolver's lookups but this would require disabling the DHCP server on the router and passing that function over to the Pi. It's a feature we are talking about, but we want to do it in a sane way that will hopefully avert the possibility of a user locking themselves out, :) If you'd like to open a Feature Request over on discourse then other users will be able to vote and comment on the idea.jannylund commentedon Jan 18, 2017
@paulkramme an easy workaround for this is to set pihole to use your routers dns instead of google, then your local host config works as before.
pkramme commentedon Jan 18, 2017
MeganerdNL commentedon Jan 30, 2017
Edit the file
/etc/dnsmasq.d/03-pihole-wildcard.confAdd entries like this:
This is working very well here. Don't forget to flush DNS on Windows machine when testing.
You cannot enter these values in the webinterface, there only default values are possible (it's the wildcard option). Maybe it could be added to the webinterface.
ldrrp commentedon Feb 16, 2017
https://www.bountysource.com/issues/39915327-add-custom-dns-entrees
pkramme commentedon Feb 16, 2017
@ldrrp Wow! Thats great, hopefully it will boost this feature.
MeganerdNL commentedon Feb 20, 2017
You can also make a new file in
/etc/dnsmasq.d/with.confextentsion. All files in this directory are read by dnsmasq. You can add/map DNS entries just like I said in my previous post like this:Again: it would be very nice if this was a feature of the web-gui.
pkramme commentedon Feb 20, 2017
I think i will write a program for this, i will link this here when im finished. Can i name the file whatever i want, like
mom.conf?dschaper commentedon Feb 20, 2017
Conf files are sourced lexicographically, so 01 first, but typically they are named with a number leading, so 99 would be sourced last, so a 50-mom.conf would be in the middle and can still be overridden. (
dnsmasqwill throw errors if commands are duplicated, but should be okay if they are appending.)pkramme commentedon Feb 20, 2017
21 remaining items
Zixim commentedon Apr 1, 2019
If you have the possibility to set pihole as your DHCP server, then you can assign hostnames to devices from the DHCP config page.
hopeseekr commentedon Jun 11, 2019
I'm much more interested in setting a custom DNS entry for https://archive.is/, as seeing how they actively block CloudFlare DNS from querying them (they point to 127.0.0.4).
dschaper commentedon Jun 11, 2019
Is there anything currently stopping you from doing so?
[-]Add custom DNS entrees[/-][+]Add custom DNS entries[/+][-]Add custom DNS entries[/-][+]Add custom DNS records[/+]Ilshidur commentedon Aug 23, 2019
There's CLI command for this :
pihole -a hostrecord subdomain.example.com 1.2.3.4EDIT: do not use this, this will only change the hostname, if I understand correctly.
makew0rld commentedon Oct 30, 2019
@Ilshidur Are there commands to list or remove records? I can't find them.
Zixim commentedon Oct 31, 2019
add :
pihole -a hostrecord home.mydomain.de 192.168.1.10list :
grep 'host-record' /etc/dnsmasq.d/01-pihole.confBut listing seems of little use, since you can add just the 1 hostrecord.
remove :
pihole -a hostrecordmakew0rld commentedon Oct 31, 2019
Oh you can only add one? I didn't realize. Thanks!
Zixim commentedon Oct 31, 2019
at present, the cleanest way to add your own dns records would be :
/etc/dnsmasq.confcontains the line :conf-dir=/etc/dnsmasq.d/etc/dnsmasq.dto store your custom dns records :Add as many host-record lines as you like.
pihole restartdnsif you add/remove domains.eitch commentedon Nov 27, 2019
I tried this on my pihole, and somehow the DNS system didn't want to start anymore. I have no added the records to
and now it works as expected
Zixim commentedon Nov 27, 2019
@eitch Don't use local.list , it is a system generated file and will get overwritten sooner or later by updates & such.
eitch commentedon Nov 27, 2019
@Zixim then there is a bug, when using the host-records directive the pi-hole manager says the DNS service does not start, which i can see as i can't lookup any addresses anymore?
Zixim commentedon Nov 27, 2019
did you perhaps edit the .conf file with a windows text editor ?
dnsmasq --testwill do basic syntax checks on the config filesEDIT : hmm...dnsmasq --test doesn't work on pihole. Check syslog for errors ?
EDIT EDIT :
pihole-FTL dnsmasq-testis the right syntax for modern Piholes.eitch commentedon Nov 27, 2019
Weird... i just tried again and now it works. I prepared to check all logs, FTL, pihole, daemon.log etc. but no error and it works as expected. I only move back the file which i had given the ending .bck to 98-hostrecords-dns.conf and performed a restart. Thanks anyhow!