How to Install Dnsmasq on Linux Mint

Dnsmasq is a lightweight DNS and DHCP server for small networks. It supports static and dynamic address allocation and can be used to serve DNS requests for local networks. In this tutorial, we will walk you through the steps to install dnsmasq on Linux Mint.

Requirements

Step 1: Update the system

Before installing any new packages, it's always a good idea to update the system to the latest version.

Open a terminal and run the following commands:

sudo apt-get update
sudo apt-get upgrade

Step 2: Install dnsmasq

Dnsmasq is available in the default repositories of Linux Mint. To install dnsmasq, run the following command:

sudo apt-get install dnsmasq

Step 3: Configure dnsmasq

After installing dnsmasq, you need to configure it according to your needs. The main configuration file is located at /etc/dnsmasq.conf. You can edit this file with a text editor of your choice.

For example, to configure dnsmasq to serve DNS requests for local network "example.com" and IP range 192.168.1.100-192.168.1.200, add the following lines to dnsmasq.conf:

domain=example.com
dhcp-range=192.168.1.100,192.168.1.200

You can also use dnsmasq to serve DNS requests for your network by adding the following line to /etc/resolv.conf file:

nameserver 127.0.0.1

Once you have made the necessary changes to the configuration file, save the file and restart dnsmasq with the following command:

sudo systemctl restart dnsmasq

Step 4: Verify the installation

To verify that dnsmasq is working as expected, you can use the dig command to perform a DNS query on a local domain. For example, to query the domain "example.com", run the following command:

dig example.com @127.0.0.1

If dnsmasq is working correctly, you should see a response with the IP address of the domain.

Congratulations! You have successfully installed and configured dnsmasq on your Linux Mint system.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!