If you have Pi-hole on your network, that means you also have Dnsmasq, and therefore can have some local DNS fun.
Today I was wanting to wildcard a local domain to my NAS. I added a dnsmasq conf file to the box running Pi-hole containing:
Where the 192.168.xxx.xxx is the local ip of the NAS. Now on the local network whateveriwant.nas points at the NAS.
Finding this very useful.
It's also worth noting that Dnsmasq will respect the /etc/hosts file on the machine running Pi-hole. You can use it just like the hosts file on your computer, but it will apply across the local net.
I use this all the time to keep up with all the little devices on the LAN. For instance say I have an Odroid SBC I need to shell into, and I've setup an entry for it in Pi-hole's hosts file. Now rather than,
I can do something like,
@rho I have no idea how to do this, but, I'm about to check it out. Thanks for the tip.
@rho Doesn't this break things with the DNS cache once you leave the network? Then it tries to get to a 192.x IP when it should use the NAT IP
@Matter Yeah, this is very much a local network only solution. Leaving the local net won't really break anything so much, but rather just wont work.
I don't have my NAS exposed outside the LAN at the moment. When/if I ever do I would use a registered domain, and get rid of the pointers in Dnsmasq (since upstream DNS would be handling it.)
@rho IPv6 saved me for this: you can't access your IPv4 if you're in the NAT (on most routers), but when I set up IPv6 on my server everything suddenly started working even on the local network
Much better UX than telling users they can't sync when they're next to the server but should go home to get it to work 😆
Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.