Tuesday, June 28, 2022

Fake DNS with dnsmasq for testing purposes on Debian/Devuan

Install dnsmasq:

apt install dnsmasq
add to your /etc/resolv.conf the following:
Edit /etc/dnsmasq.conf and add the following at the end of the file:
The DNS request will ask first dnsmasq for a domain and if it is configured (for instance it will return answer with IP address. If domain is not found in dnsmasq configuration then it will pass dns request to real dns servers in /etc/resolv.conf file.

Now you can test your webserver by using this for dns queries.

If you are accessing dnsmasq server from different network you will get REFUSED messages on the dns queries. If you want to fix that edit /etc/dnsmasq.conf and find the already commented line starting with 'interface=':

and make it like this

Replace eth0 with the right interface you want then restart dnsmasq.

No comments: