Dnsmasq is a lightweight, easy to configure DNS forwarder, designed to provide DNS (and optionally DHCP and TFTP) services to a small-scale network. It can serve the names of local machines which are not in the global DNS.

Step 1 : Installing Dnsmasq
yum install dnsmasq
Step 2 : Configure Dnsmasq
vim /etc/dnsmasq.conf
#delete all & insert
cache-size=0
no-resolv
server=208.67.222.222 (we are using  Opendns as a dns resolver)
server=208.67.220.220
server=8.8.8.8 (dnsmasq can set multiple dns resolver,if other resolver fails,it  will ask for others resolver.)
server=8.8.4.4
domain-needed
log-queries
log-facility=/var/log/dnsmasq
no-dhcp-interface=eth0 (your network interface)
conf-dir=/etc/dnsmasq.d/
Cd to dnsmasq.d and create a config file, we will create a redirect.conf here.
To specify a domain, we need a server ip and your domain.
cd /etc/dnsmasq.d/

vim redirect.conf

address=/your-domain.com/1.2.3.4
save & quit
service dnsmasq start
Change your pc’s dns to your dns server ip address, nslookup your domain set just now.
Enjoy !
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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