Skip to content

Instantly share code, notes, and snippets.

@mecmartini
Last active January 25, 2021 11:10
Show Gist options
  • Save mecmartini/c6348a087d2af260e326538b89e0ad45 to your computer and use it in GitHub Desktop.
Save mecmartini/c6348a087d2af260e326538b89e0ad45 to your computer and use it in GitHub Desktop.
Setup Dnsmasq for .localdev (Ubuntu)

Setup Dnsmasq for .localdev (Ubuntu)

Ubuntu comes with systemd-resolve which you need to disable since it binds to port 53 which will conflict with Dnsmasq port.

Run the following commands to disable the service:

sudo systemctl disable systemd-resolved
sudo systemctl stop systemd-resolved

Remove the symlinked resolv.conf file:

ls -lh /etc/resolv.conf
sudo rm /etc/resolv.conf

Create new resolv.conf file:

echo nameserver 1.1.1.1 | sudo tee /etc/resolv.conf

Install Dnsmasq:

sudo apt-get install dnsmasq

Configure Dnsmasq:

sudo nano /etc/dnsmasq.conf

add the configuration:

address=/.localdev/127.0.0.1

Create the resolver for the added address:

sudo mkdir /etc/resolver
sudo touch /etc/resolver/localdev
echo nameserver 127.0.0.1 | sudo tee /etc/resolver/localdev

Restart Dnsmasq:

sudo systemctl restart dnsmasq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment