Skip to content

Instantly share code, notes, and snippets.

@addiedx44
Created June 1, 2016 18:03
Show Gist options
  • Save addiedx44/557ff3f1a5599d265fd132f0786da3e3 to your computer and use it in GitHub Desktop.
Save addiedx44/557ff3f1a5599d265fd132f0786da3e3 to your computer and use it in GitHub Desktop.
Set up Dnsmasq on Mac OS X
$ # Install dnsmasq
$ brew update && brew install dnsmasq
$ # Edit dnsmasq config, paste contents
$ mkdir -p /usr/local/etc && vim /usr/local/etc/dnsmasq.conf
$ # Start dnsmasq (it will restart at startup)
$ sudo brew services start dnsmasq
==> Successfully started `dnsmasq` (label: homebrew.mxcl.dnsmasq)
$ # Verify dnsmasq is running
$ ps -ef | grep dnsmasq
-2 50 1 0 2:28PM ?? 0:00.11 /usr/local/opt/dnsmasq/sbin/dnsmasq --keep-in-foreground -C /usr/local/etc/dnsmasq.conf
$ # Find your current DNS settings
$ scutil --dns
DNS configuration (for scoped queries)
resolver #1
nameserver[0] : x.x.x.x
nameserver[1] : y.y.y.y
nameserver[2] : z.z.z.z
if_index : 4 (en0)
flags : Scoped, Request A records, Request AAAA records
Reachable, Local Address
$ # (Optional) List existing network services
$ networksetup -listallnetworkservices
An asterisk (*) denotes that a network service is disabled.
Wi-Fi
Bluetooth PAN
Thunderbolt Bridge
$ # Prepend DNS servers with localhost
$ networksetup -setdnsservers Wi-Fi 127.0.0.1 x.x.x.x y.y.y.y z.z.z.z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment