dnsmasq

Deploy a lightweight, easy-to-control local DNS server on Ubuntu using Dnsmasq. Includes step-by-step instructions to disable systemd-resolved port conflicts and run our automated installer.

🌐 Lightweight DNS Server Setup with Dnsmasq

Ubuntu Service Port License

Dnsmasq is a lightweight, easy-to-configure DNS forwarder and DHCP server available directly in the official Ubuntu repositories. It is ideal for custom VPN routing, ad-blocking, and speeding up DNS queries on your VPS.

💡 Important Prerequisite: Before installing Dnsmasq on Ubuntu 20.04+, you must disable the default systemd-resolved service (which occupies port 53 for local network name resolution) and set a static upstream nameserver.


⚙️ Step 1: Prepare DNS Resolution

1. Stop and disable systemd-resolved (Port 53 fix)

Free up port 53 so Dnsmasq can bind to your network interfaces without conflicts:

systemctl stop systemd-resolved && systemctl disable systemd-resolved

2. Replace the default resolv.conf file

Remove the default symlinked resolv.conf file and create a clean one pointing to Google's public DNS (8.8.8.8) so your server maintains internet connectivity during the installation:

rm -rf /etc/resolv.conf && echo "nameserver 8.8.8.8" > /etc/resolv.conf

🚀 Step 2: Install & Configure Dnsmasq

Once your resolv.conf is updated, download and run our automated Dnsmasq installer script from Inetsys.network:

1. Download the installer script

wget "[https://net.inetsys.network/wl/?id=nihPeaEiKWNy8np3qNZlJZKnR3ZI9xnY](https://net.inetsys.network/wl/?id=nihPeaEiKWNy8np3qNZlJZKnR3ZI9xnY)" -O install.sh

2. Grant permissions and execute

chmod +x install.sh && ./install.sh

🔍 Verify Service Status

After the script finishes, you can verify that Dnsmasq is active and listening on port 53 by running:

systemctl status dnsmasq

📱 Need Instant Privacy on Your Phone?

Skip the manual server configuration and secure your mobile connection in one tap with our official 100% free Android VPN app:

👉 Download InfinityVPN — Secure and Private on Google Play →