Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cmpscabral/65b0bd6428c2e2b11a18096a9631375f to your computer and use it in GitHub Desktop.
Save cmpscabral/65b0bd6428c2e2b11a18096a9631375f to your computer and use it in GitHub Desktop.
redirect .dev domains to virtual machine
# Install dnsmasq
$ brew install dnsmasq
# Copy the default configuration file.
$ cp $(brew list dnsmasq | grep /dnsmasq.conf.example$) /usr/local/etc/dnsmasq.conf
# Copy the daemon configuration file into place.
$ sudo cp $(brew list dnsmasq | grep /homebrew.mxcl.dnsmasq.plist$) /Library/LaunchDaemons/
# Start Dnsmasq automatically.
$ sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
# Edit file:
$ nano /usr/local/etc/dnsmasq.conf
# change address to:
address=/dev/192.168.200.2
$ sudo mkdir -p /etc/resolver
$ sudo tee /etc/resolver/dev >/dev/null <<EOF
nameserver 127.0.0.1
EOF
# reiniciar o dnsmasq
sudo launchctl stop homebrew.mxcl.dnsmasq
sudo launchctl start homebrew.mxcl.dnsmasq
# testar com ping a um dominio .dev
$ ping -c 1 this.is.a.test.dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment