Install dnsmasq on Ubuntu

dnsmasq is a very powerful tool that can provide basic dns services/caching, act as dhcp server and also as tftp server.

To install dnsmasq, run

When you start dnsmasq, if it complain about port 53 alreay in use

This is because some other service is running on port 53. To find what service is listening on port 53, run

In this case, it is systemd-resolved. To stop it, run

Now you can start dnsmasq with

After starting dnsmasq, if you try resolve a domain, it will fail

This is because default configuration don’t have anything enabled. To enable DNS caching/resolver, you need to edit file

Add line

Restart dnsmasq

Now you will be able to resolve domain name using localhost as the dns server.

If you need dnsmasq listen to only local ip, add following in /etc/dnsmasq.conf and restart dnsmasq.

If you need to override MX record for a domain, you can add following to dnsmasq.conf

To set txt record for a domain

See dnsmasq

Need help with Linux Server or WordPress? We can help!

Leave a Reply

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