How to Install DNSmasq on Debian Latest

In this tutorial, we will guide you through the steps of installing dnsmasq on Debian Latest. Dnsmasq is a lightweight, easy-to-use DNS and DHCP server.

Step 1: Update the System

Before installing dnsmasq, we need to ensure that our system is up to date. Open your terminal and run the following command:

sudo apt update && sudo apt upgrade

Step 2: Install DNSmasq

Once the system is up to date, we can proceed to install dnsmasq. Open your terminal and run the following command to install dnsmasq:

sudo apt install dnsmasq

During the installation process, you will be prompted to configure dnsmasq. You can select the default settings or customize them according to your needs.

Step 3: Configure DNSmasq

After installing dnsmasq, we need to configure it to work correctly. The main configuration file for dnsmasq is located in the /etc/dnsmasq.conf directory.

To edit the dnsmasq configuration file, open your terminal and run the following command:

sudo nano /etc/dnsmasq.conf

In this file, you can customize various settings, such as DNS resolution, DHCP options, and more.

After making changes to the configuration file, save the changes by pressing 'CTRL+O', then exit the editor by pressing 'CTRL+X'.

Step 4: Start DNSmasq

Once you have configured dnsmasq, you can start the service by running the following command:

sudo systemctl start dnsmasq

To ensure that dnsmasq starts automatically at boot time, run the following command:

sudo systemctl enable dnsmasq

Step 5: Verify DNSmasq

Lastly, we need to verify that dnsmasq is working correctly. Open your terminal and run the following command:

dig google.com

If dnsmasq is working correctly, you should see the DNS resolution results for google.com.

Congratulations! You have successfully installed and configured dnsmasq on Debian Latest.