Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

seanwu's avatar

make Valet work on local network

Hi guys,

I have Valet up and running and everything is awesome (lego theme song).

Now I wish to set up a router level DNS so that all devices connect to the local network will be able to access my *.dev domains.

The server's local IP is 10.1.1.10, I tried changing my router's settings to use 10.1.1.10 as primary DNS. After that, when I ping *.dev from my other devices (which don't have any hosts entries), I get response from 127.0.0.1 (instead of 10.1.1.10)

Anyone has experiences on this?

Thanks in advance

0 likes
5 replies
jimmck's avatar

Make your Router 10.1.1.1 (Router setup will handle that) that will be your DNS entry point. What is router manufacturer. And reading the manual will help. The manuals can be found on line.

seanwu's avatar

@jimmck thanks, my router is already 10.1.1.1. and if I set 10.1.1.1 as the DNS server, how does the router know to use my server (@10.1.1.10) as the DNS server? PS. The router is a gigabit n600 dual band.

I suspect the router level set up is OK, but if I can somehow make valet(dnsmasq) to point *.dev to 10.1.1.10 instead of 127.0.0.1 , it'd work

Am I on the right track?

jimmck's avatar

@seanwu The router is the switch for your network. Your server is just one computer on your network. Valet uses dnsmasq to do what it does. And thanks to the Laravel world for pointing out how they did it! I was looking for exactly how to do this on my network for testing. I just did not need all the other stuff.

Note Valet is for Macs. I develop on a Mac so here my raw notes and dnsmasq.conf file. Hopefully it will help you with work.

echo 'address=/.dev/127.0.0.1' > $(brew --prefix)/etc/dnsmasq.conf


sudo cp $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons

sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

Create a resolver for .dev domains on your localhost. This tells OS X to check with dnsmasq if it’s looking for a .dev domain.

sudo mkdir /etc/resolver

sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/dev'

sudo ifconfig lo0 alias 10.254.254.254


sudo launchctl stop homebrew.mxcl.dnsmasq

sudo launchctl start homebrew.mxcl.dnsmasq

dnsmasq.conf

address=/.dev/10.254.254.254

dotramses's avatar

@jimmck If I use the terminal commands as described above will I be able to access my sites from my MacBook Pro on an iPhone connected to the network?

Please or to participate in this conversation.