Table of Contents
dnsmasq
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.
address=/.server.local/192.168.12.180
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:
no-dhcp-interface= address=/.steve.beandog.org/127.0.0.1
cp /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
Configure OS X to resolv all *.name.beandog.org
to use the localhost DNS server:
mkdir -p /etc/resolver echo nameserver 127.0.0.1 > /etc/resolver/name.beandog.org
HOWTO
Remove a DHCP lease
- Stop
dnsmasq
- Edit
dhcpd.leases
aand remove the entry - Start
dnsmasq