Skip to content

Instantly share code, notes, and snippets.

@marek-saji
Last active February 26, 2024 16:12
Show Gist options
  • Star 35 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save marek-saji/6808114 to your computer and use it in GitHub Desktop.
Save marek-saji/6808114 to your computer and use it in GitHub Desktop.
Configure local DNS server to serve #dev #TLD #ubuntu #linux

Configure local wildcard DNS server

  1. Install Dnsmasq: sudo apt-get install dnsmasq
  2. Since Ubuntu's NetworkManager uses dnsmasq, and since that messes things up a little for us, open up /etc/NetworkManager/NetworkManager.conf and comment out (#) the line that reads dns=dnsmasq. Restart NetworkManager afterwards: sudo restart network-manager.
  3. Make sure Dnsmasq listens to local DNS queries by editing /etc/dnsmasq.conf, and adding the line listen-address=127.0.0.1.
  4. Create a new file in /etc/dnsmasq.d (eg. /etc/dnsmasq.d/dev), and add the line address=/dev/127.0.0.1 to have dnsmasq resolve requests for *.dev domains. Restart Dnsmasq: sudo /etc/init.d/dnsmasq restart.

source: http://brunodbo.be/blog/2013/04/setting-up-wildcard-apache-virtual-host-wildcard-dns

@Yggdrasil
Copy link

Since .local is also problematic due to dual use in multicast DNS and as an internal domain, we've switched to using the .test TLD, which is officially reserved by the IETF for software testing. Because it's officially reserved we should be safe using it internally.

From wikipedia:

The name was reserved by the Internet Engineering Task Force (IETF) in RFC 2606 (June 1999) and is not intended to ever be installed into the global Domain Name System (DNS) of the Internet.[1] Because neither test nor any of its subdomains can be registered, they can be used for testing purposes without fear of conflicts with current or future domain names.

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