Creating a wildcard DNS lookup for .local pointing to 127.0.01

To allow you to create dynamic on the fly dev hosts. This is part of a bigger post coming soon..  The end goal is to document how I create a new vhost in my local nginx configuration just by creating a new directory.

For the DNS,  I need every *.local subdomain to resolve to 127.0.0.1 without me having to go into /etc/hosts and add it each time.

In /etc/dnsmasq.conf

listen-address=127.0.0.2
port=53
address=/.local/127.0.0.1
bind-interfaces
server=8.8.8.8

In /etc/systemd/resolved.conf

DNSStubListener=no

In /etc/resolv.conf

nameserver 127.0.0.2

Then restart both services.

sudo systemctl restart NetworkManager
systemctl restart dnsmasq

 

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.