dnsmasq on pihole for wildcards

Say you’re a developer and you want all domains that end in “.test” to be redirected to 127.0.0.1

in the past, we’d edit /etc/hosts file and call it a day.

But now, with multiple web services, and code that’s shared between multiple sites, we may want something a little more robust.

DNSMasq to the rescue. I won’t go into details on how to install it, as it’s automatic with pihole.

I’m using Pi Hole FTL version 5.2. (Date as of writing is 2020-Nov-04)

  1. create a new file called /etc/dnsmasq.d/99-custom.conf

$> sudo nano /etc/dnsmasq.d/99-custom.conf

2. The contents of the file should be this single line

address=/.test/127.0.0.1

the “.test” is the wildcard notation. 127.0.0.1 is the address you want it to map to.

3. Restart pihole FTL

$> sudo service pihole-FTL restart

Now, on your local machine, ping anything.TEST to make sure it’s working.


Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *