Robo Robok
Robo Robok

Reputation: 22755

Using dnsmasq with wildcard on Mac

I'd like to point all *.test domains to my Laravel Homestead machine on 192.168.10.10. I used to have it working with *.dev domains, but after new *.dev policy implemented by Chrome 63, I prefer to change it to *.test.

I fail to understand how local DNS works, as it seems to use trillion different configs and caches. What I did is:

  1. Making sure 192.168.10.10 with HTTP Host set to me.test works. It works.
  2. In /usr/local/etc/dnsmasq.conf, I do have an entry address=/.test/192.168.10.10 (I also tried with 127.0.0.1)
  3. In /etc/resolver/test file, I put nameserver 127.0.0.1 - it used to work this way with /etc/resolver/dev. I still don't understand why it's 127.0.0.1 and not 192.168.10.10. I tried both anyway.
  4. Clearing DNS cache with sudo killall -HUP mDNSResponder; sudo killall mDNSResponderHelper; sudo dscacheutil -flushcache
  5. Restarting dnsmasq with sudo launchctl stop homebrew.mxcl.dnsmasq; sudo launchctl start homebrew.mxcl.dnsmasq.
  6. Trying to visit http://me.test/.

It doesn't work. The domain will take forever to be loaded and nothing happens.

What am I doing wrong?

My OS is High Sierra, dnsmasq installed via homebrew.

Upvotes: 2

Views: 1974

Answers (1)

joepferguson
joepferguson

Reputation: 1088

I don't use dnsmasq, but I believe you want to edit /usr/local/etc/dnsmasq.conf and have listen-address=127.0.0.1 set so dnsmasq is listening on that IP, but have address=/.test/192.168.10.10 so that .test is routed to 192.168.10.10.

Then make sure System Preferences -> Advanced you have 127.0.0.1 as the first DNS server entry for your connection.

Make sure you're restarting dnsmasq every time you edit the configuration file.

Upvotes: 4

Related Questions