DNS server that replies the same address ("" by default) to all type A queries
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



DNS server that replies the same address ("" by default) to all type A queries and NXDOMAIN to any other query.


It's often useful during development to access local services using a local domain. Existing options are:

  1. Add them all to /etc/hosts (quickly becomes a mess, have to list all subdomains)
  2. Run a DNS server like BIND (complex configuration)
  3. Run a DNS proxy like Dnsmasq (reasonable option but still needs configuration)

Using devdns you just need to download a binary and run it. It works best with the OS X resolver system (see below).


Build (or download the OS X binary) and then run ./devdns. By default it listens on (UDP), you can specify an alternative address as follows: ./devdns -addr="".

On OS X you can use the resolver system (man 5 resolver) to resolve only a chosen few domains to this local server:

sudo mkdir -p /etc/resolver

# all domains ending in ".dev"
sudo vi /etc/resolver/dev

Contents of /etc/resolver/dev:

port 5300

If you want to change the resolved address from the default to another (virtual) machine you can change it as follows: ./devdns -ip="".

Should you need to specify different resolved addresses for different host names you can run multiple instances of devdns on different listening addresses and change the /etc/resolver config accordingly. However at that point it might be easier to use Dnsmasq.


Build using the standard go tools:

go get .
go build

Use go build -ldflags "-w" to build a version without debug symbols (smaller binary).