1

so despite my numerous attempts at getting Dnsmasq to work, I'm posting here to get some help from the community. Summary: I'm trying to get all .local domains to automatically resolve to localhost or 127.0.0.1.

This is a fresh/clean installation of Sierra on a 2014 MBP 15. I already have Homebrew, Composer, Node, etc installed. Here are the steps I have taken so far following guides from here and here:

  1. brew install dnsmasq
  2. /usr/local/etc already existed when brew was installed, so I nano /usr/local/etc/dnsmasq.conf
  3. Inside this I have:

    address=/local/127.0.0.1 no-resolv strict-order

  4. sudo brew services start dnsmasq

  5. sudo mkdir /etc/resolver
  6. sudo nano /etc/resolver/local --> nameserver 127.0.0.1
  7. I finally restarted my Mac.

Once restarted I opened my zsh terminal, and tried to both ping and dig test.local :

ping -c 2 test.local --> ping: cannot resolve test.local: Unknown host

dig test.local @127.0.0.1 --> connection timed out; no servers could be reached


I've tried adding 127.0.0.1 manually to the top of my DNS Servers under Network Preferences. In dnsmasq.conf, I've also tried address=/.local/127.0.0.1 (notice '.' in front of 'local' being the difference). Finally I've tried restarting dnsmasq: brew services restart dnsmasq ... unfortunately, none of these helped.

Is there a step I missed or misconfigured?

  • Please do not keep both questions open, as cross posting is not allowed per our FAQ. – Rui F Ribeiro Jun 25 '17 at 16:54
  • Apologies, I'll close the other one – Shalan Jun 25 '17 at 18:04
2
brew services restart dnsmasq

This command will run with your current user, thus dnsmasq doesn't have the permission to listen on port 53

I suggest to stop that process first

brew service stop dnsmasq

And then restart dnsmasq with root user

sudo brew service restart dnsmasq

Check service status

sudo brew services list

Name           Status  User Plist
dnsmasq        started root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

Make sure the User is root

1

I was running into a similar issue using OSX High Sierra where dnsmasq wasn't working for me. I also noticed this:

$ dnsmasq

dnsmasq: failed to create listening socket for 169.254.51.195: 
Permission denied

So I tried sudo dnsmasq and now all of a sudden, my local domains are working. I have no idea why.

  • 2
    dnsmasq: command not found – Pmpr Dec 15 '17 at 15:21
  • When dnsmasq installed via brew, it runs as a service. If you need to run as a command you need to have /usr/local/sbin in your $PATH, since that's where it's located. – osman Oct 12 '18 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.