When starting OSX, you can add a resolver for this.
Create the directory /etc/resolver/
and add the file for the domain you want to resolve (for example, example.com). Inside the file, you can specify alternative name servers for use in the specified domain. By default, the file name defines the domain (see the Man page for more details).
$ sudo mkdir -p /etc/resolver $ echo "nameserver 127.0.0.1" | sudo tee /etc/resolver/example.com > /dev/null
You can check if the converter is applied using the scutil --dns
.
Now you need to start a local name server, for example dnsmasq, to ββresolve queries at 127.0.0.1
. You can install dnsmasq via homebrew or run it in a docker container :
$ docker run -p 53:53/tcp -p 53:53/udp --cap-add=NET_ADMIN \ andyshinn/dnsmasq:2.75 \ --host-record=example.com,127.0.0.1
Find more information about the homebrew solution here .
source share