Skip to content

How to Set Up Local DNS with Dnsmasq on Debian 12

Netcloud24
Cloud Infrastructure Expert
NetCloud24 Expert Guides Open the dedicated video page

Video transcript: NetCloud24 Expert Guides. Practical knowledge for a reliable cloud. Cloud and VPS expertise, security, performance, and step-by-step tutorials. Learn, deploy, and keep building with NetCloud24.

Prerequisites

Before you begin, ensure you have:

  1. A Debian 12 system
  2. Root or sudo privileges

Step 1: Install Dnsmasq

Install Dnsmasq using the following command:

sudo apt update
sudo apt install -y dnsmasq

Step 2: Configure Dnsmasq

Edit the Dnsmasq configuration file:

sudo nano /etc/dnsmasq.conf

Add the following configuration to the file to specify the DNS server and domain:

server=8.8.8.8
domain=local

You can replace “8.8.8.8” with the IP address of your preferred DNS server.

Step 3: Add Local DNS Entries

Edit the hosts file to add local DNS entries:

sudo nano /etc/hosts

Add entries for your local hosts in the following format:

192.168.1.10    server1.local
192.168.1.11    server2.local

Replace the IP addresses and hostnames with your own values.

Visual overview of How to Set Up Local DNS with Dnsmasq on Debian 12
Visual overview: How to Set Up Local DNS with Dnsmasq on Debian 12

Step 4: Restart Dnsmasq

Restart the Dnsmasq service to apply the changes:

sudo systemctl restart dnsmasq

Step 5: Test DNS Resolution

Test DNS resolution by pinging a local hostname:

ping server1.local

You should see successful ping responses.

Conclusion

Congratulations! You have successfully set up local DNS with Dnsmasq on Debian 12. You can now use local hostnames to access devices and services on your network.

Windows VPS Deutschland

Windows VPS España

Windows VPS Nederland

Windows VPS Italia

Windows VPS Portugal

Key topics covered in How to Set Up Local DNS with Dnsmasq on Debian 12
Key topics covered in this NetCloud24 guide.

VPS Windows Italia

Windows VPS

Windows VPS

Windows VPS Sverige

Windows VPS Norge

Windows VPS

Windows VPS Türkiye

Windows RDS (Remote Desktop Services)

Practical checklist for How to Set Up Local DNS with Dnsmasq on Debian 12
Practical checklist for applying the guidance in this article.

Windows VPS

How to Set Up Local DNS with Dnsmasq on Debian 12
How to Set Up Local DNS with Dnsmasq on Debian 12
Explore more

More on this topic

Netcloud24
Netcloud24
Cloud Infrastructure Expert · NetCloud24

Comments are closed.