Skip to content

Instantly share code, notes, and snippets.

@hakjoon
Forked from drye/enable_dnsmasq_on_osx.sh
Last active September 25, 2018 14:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hakjoon/b3c5f7b60fe5372fee6fb54500958e18 to your computer and use it in GitHub Desktop.
Save hakjoon/b3c5f7b60fe5372fee6fb54500958e18 to your computer and use it in GitHub Desktop.
# bash <(curl -s https://gist.github.com/drye/5387341/raw/ec72cddfe43ec3d39c91a3c118cb68ab14a049f8/enable_dnsmasq_on_osx.sh)
# ----------------------
# installing dnsmasq and enable daemon
# ----------------------
brew install dnsmasq
sudo brew services start dnsmasq
# ----------------------
# adding resolver for DOMAIN domain
# ie. domain = *.local.example.com
# ----------------------
[ -d /etc/resolver ] || sudo mkdir -v /etc/resolver
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/local.example.com'
# ----------------------
# configuring dnsmasq
# ----------------------
echo 'address=/.local.example.com/127.0.0.1' >> $(brew --prefix)/etc/dnsmasq.conf
# ----------------------
# launching dnsmasq
# ----------------------
sudo brew services restart dnsmasq
#flush dns
sudo killall -HUP mDNSResponder
# check
ping -c 1 www.google.com
ping -c 1 g.local.example.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment