We have a lot of computer in our network. Our network speed is not too much. Sometimes especially in mornings our internet connection slows down. How can solve this with some dns related tricks? Dns is one of the mostly used network protocol. It can effect the internet speed. Making some optimizations will develop your internet experience. Caching is to hold resolved dns queries in our dns server. There are different type and feature dns servers in the wild. Dnsmasq is one them which is very light. Dnsmasq can be used tftp and dhcp server too.
Install
We can install dnsmasq easily like below.
Ubuntu, Debian, Kali
$ sudo apt-get install dnsmasq

CentOS, Fedora
$ sudo yum install dnsmasq
Add New DNS Server
Add new dns servers for the next hop for dnsmasq. Keep in mind to add these configuration we need root privilege
$ echo "nameserver 8.8.8.8" >> /etc/resolv.conf $ cat /etc/resolv.conf ; generated by /usr/sbin/dhclient-script nameserver 192.168.122.1 nameserver 8.8.8.8
Restart Dnsmasq
By default dnsmasq
is not started after installation. We will start the dnsmasq with the systemctl restart
command like below.
$ systemctl restart dnsmasq
Test With Dig
In order to see whether the dnsmasq is active we will use dig
for domain name query. We will make a dns query for www.poftut.com
$ dig www.poftut.com

DNS Request To dnsmasq
In the first DNS request this will be returned from the global DNS servers and stored in the dnsmasq
. If we resolve in the second time the same domain name this will be returned from dnsmasq
. This will make
$ dig www.poftut.com

We can see that Query time:
is about 67 miliseconds which is better than from previous DNS request which is 211 miliseconds.
Install Dnsmasq As Cache Dns Server Infografic
