Overview

DNS cache poisoning to redirect a site to alternate address using dnscache and tinydns

Requirements

  • Centos ( or any other Unix/Linux ) Server running dnscache and tinydns
  • Atleast 1 configured IP address on which dnscache/tinydns is running :: Let it be 192.168.1.2
  • A domain that we want to redirect :: Let it be exampledomain.com

Configuration

Step 1

Install tinydns and dnscache, click on below links for help

Step 2

Add the site you want to direct to dnscache as below, so that it will look up the IP inside

root@serv:~# echo “192.168.1.2” > /etc/dnscache/root/servers/exampledomain.com

Step 3

Make records for the domain on tinydns to redirect it to the desired address ( here i’m pointing it to 192.168.1.2 itself )

root@serv:~# cd /etc/tinydns/root/
root@serv:~# add-ns ns1.exampledomain.com 192.168.1.2
root@serv:~# add-host exampledomain.com 192.168.1.2
root@serv:~# make

Step 3

Kill and restart the services and bring the changes into effect

root@serv:~# svc -t /service/*

With this the machines that are using 192.168.1.2 as dns server will get pointed to the IP 192.168.1.2 when accessing exampledomain.com