Install dnsmasq:
apt install dnsmasqadd to your /etc/resolv.conf the following:
nameserver 192.168.0.1Edit /etc/dnsmasq.conf and add the following at the end of the file:
address=/real-domain-that-we-want-to-fake-for-testing.com/192.168.0.14The DNS request will ask first dnsmasq for a domain and if it is configured (for instance horizon9.org) it will return answer with 192.168.0.14 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.
address=/horizon9.org/192.168.0.2
address=/google.com/192.168.0.14
Now you can test your webserver by using this 192.168.0.1 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=':
#interface=
and make it like this
interface=eth0
Replace eth0 with the right interface you want then restart dnsmasq.
No comments:
Post a Comment