DNSMASQ in OSX
Installing Dnsmasq
1
|
|
The installation process will output several commands that you can use to start Dnsmasq automatically with a default configuration. I used the following commands but you should use whichever commands brew tells you to:
Configuring Dnsmasq
Now that you have Dnsmasq installed and running, it’s time to configure it! The configuration file lives at /usr/local/etc/dnsmasq.conf
by default, so open this file in your favourite editor.
One the many, many things that Dnsmasq can do is compare DNS requests against a database of patterns and use these to determine the correct response. I use this functionality to match any request which ends in .dev and send 10.200.200.10
in response. The Dnsmasq configuration directive to do this is very simple:
1
|
|
Insert this into your /usr/local/etc/dnsmasq.conf
file (I put it near the example address=/double-click.net/127.0.0.1
entry just to keep them all together) and save the file.
You may need to restart Dnsmasq to get it to recognise this change. Restarting Dnsmasq is the same as any other service running under launchd
:
1 2 |
|
You can test Dnsmasq by sending it a DNS query using the dig
utility. Pick a name ending in dev
and use dig to query your new DNS server:
1
|
|
You should get back a response something like:
1 2 |
|
Configuring OS X
1 2 3 4 5 |
|
Testing.
1 2 3 4 5 |
|