A fake DNS server only has handful of use cases, but in case you find yourself in need of them, here are some instructions!
The primary usage for something like this would be if you're interested in changing what IP a domain resolves to, such as redirecting an embedded's devices HTTP request to phone-home.private-protocol.proprietary.net
to your own machine rather than the actual page.
The first step is to install dnsmasq
with your package manager. This will usually be apt-get
, yum
, or brew install dnsmasq
.
For every domain that you want to manually redirect, create a file in /etc/dnsmasq.d/
, for instance /etc/dnsmasq.d/serebii.net
.
In that file you can put a list of the domains, such as:
address=/serebii.net/192.168.1.100
address=/youtube.com/192.168.1.101
And those domains will be resolved to the respective IP by any devices that use your fake DNS server.
Any domains that are not added here, will be resolved using the DNS server on the same machine. Usually this is specified in /etc/resolv.conf
.
If you want to block all domains, you can use the following dnsmasq entry:
address=/#/127.0.0.1