Spoofing DNS using DnsMasq
Written by: Kimberlee Model, posted: 2017-11-10, last modified: 2019-09-28. Tags: How I configured, Home Server, Raspberry Pi.In this entry I will be configuring DNS Masq on a raspberry pi server in my red-radio project.
first off make sure the system up to date
$ sudo apt-get update && sudo apt-get dist-upgrade
Now install Dns Masq
$ sudo apt-get install dnsmasq
then make sure that dnsmasq is stopped. and back up its default configuration file
$ sudo systemctl stop dnsmasq
$ sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.bkup
now I just install my DNS Masq configuration files from my red radio config files repository here. Each file explains what it does.
$ wget https://redbow.kim/gitbucket/kimee/red-radio-infrastructure/raw/master/dnsmasq/${file}
$ sudo mv ${file} /etc/${file}
Last thing to do is to reconfigure resolvconf, which is a tool that configures the DNS resolver of the system. It also attempts to predict the upstream DNS server of DNS Masq to be the same upstream as itself, which seems to cause the DNS queries to bounce between the wifi router and DNS Masq a few times before one resolves it. comment out the following line, and it will prevent resolvconf from interfering with DNS Masq's configuration
# dnsmasq_resolv=/var/run/dnsmasq/resolv.conf
now just start dnsmasq again and it should be working
$ sudo systemctl start dnsmasq
and check its working:
$ sudo systemctl status dnsmasq
updated 2018-06-26: resolveconf overriding DNS Masq resolver configuration