LoginSignup
6
4

More than 3 years have passed since last update.

macでdnsmasq

Posted at

やりたいこと

/etc/hostsにワイルドカードが書けないので、同じような挙動を実現したい。
*.example.com 192.168.0.1
をやりたい

Homebrewでインストール

brew install dnsmasq

設定

/usr/local/etc/dnsmasq.conf
に下記を追加
address=/example.com/192.168.0.1

sudo mkdir -p /etc/resolver
cd /etc/resolver/
sudo vi example.com
中身↓
nameserver 127.0.0.1

scutil --dns
で、

resolver #8
  domain   : example.com
  nameserver[0] : 127.0.0.1
  flags    : Request A records, Request AAAA records
  reach    : 0x00030002 (Reachable,Local Address,Directly Reachable Address)

があればOK

6
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4