Stop using /etc/hosts for for local development.

Install

# sudo port install dnsmasq

Включаем сервис, заменяем «Enabled»

# cp ./local/etc/LaunchDaemons/org.macports.dnsmasq/org.macports.dnsmasq.plist /Library/LaunchDaemons/
# sudo vim /Library/LaunchDaemons/org.macports.dnsmasq.plist
sudo launchctl load /Library/LaunchDaemons/org.macports.dnsmasq.plist

Config:

# sudo ln -s /opt/local/etc/dnsmasq.conf /etc
add to /etc/dnsmasq.conf:
"address=/exe/127.0.0.1"

Restart:

sudo launchctl stop org.macports.dnsmasq
sudo launchctl start org.macports.dnsmasq

Test:

1. Test that service started:

ps ax | grep dns

If not, call locally and check for error

/opt/local/sbin/dnsmasq

2. Call DNS:

dig test.exe @127.0.0.1

Use

Two ways:
1. Simple: configure /etc/resolv.conf to point to 127.0.0.1
2. Hardcore: Resolve only local zone there:

$ sudo mkdir -p /etc/resolver
$ sudo echo "nameserver 127.0.0.1" > /etc/resolver/exe
$ /opt 0$ ping -c 1 test.exe
EOF

Thanks

Based on https://passingcuriosity.com/2013/dnsmasq-dev-osx/, adopted for Ports

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *

*


Можно использовать следующие HTML-теги и атрибуты: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>