Table of Contents


dnsmasq is a small domain name server designed to resolve host names on a LAN.

Wildcard Domains

You may want to assign an actual domain to a hostname, to provide wildcard name resolution.

An example would be that a host could be named server.local, but *.server.local should also resolve to the same IP address.

Add an extra domain to /etc/dnsmasq.conf, and then restart the server.


OS X also uses mDNS to do hostname lookups, so you can add an entry for the server as well.

OS X / homebrew

dnsmasq can be setup to do wildcard DNS resolution natively, instead of updating an hosts file.

First, install dnsmasq with homebrew:

brew install dnsmasq

Install the sample config file:

cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf

Add this to configuration file to disable DHCP server, and resolve subdomains locally:

cp /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons
launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

Configure OS X to resolv all * to use the localhost DNS server:

mkdir -p /etc/resolver
echo nameserver > /etc/resolver/


Remove a DHCP lease
  1. Stop dnsmasq
  2. Edit dhcpd.leases aand remove the entry
  3. Start dnsmasq