Skip to content

Instantly share code, notes, and snippets.

@mamemomonga

mamemomonga/wasabidns.md

Last active Dec 29, 2020
Embed
What would you like to do?
名前解決できないWasabiを解決できる専用DNSサーバをDockerとdnsmasqでつくるメモ

名前解決できないWasabiを解決できる専用DNSサーバをDockerとdnsmasqでつくるメモ

ひとまず名前解決できたという感じ

設定とか

$ cat > resolv.dnsmasq.conf << 'EOS'
nameserver 8.8.8.8
nameserver 8.8.4.4
EOS

$ cat > dnsmasq.conf << 'EOS'
resolv-file=/etc/resolv.dnsmasq.conf
strict-order
server=/wasabisys.com/198.51.44.5
server=/wasabisys.com/198.51.45.5
server=/wasabisys.com/198.51.44.69
server=/wasabisys.com/198.51.45.69
EOS

$ cat > Dockerfile << 'EOS'
FROM alpine:3.12
RUN set -xe && \
    apk --update add dnsmasq && \
    rm -rf /var/cache/apk/*
EOS

$ docker build -t wasabimasq .

$ docker run --rm -d --name wasabimasq \
-v $(pwd)/resolv.dnsmasq.conf:/etc/resolv.dnsmasq.conf:ro \
-v $(pwd)/dnsmasq.conf:/etc/dnsmasq.conf:ro \
-p 127.0.0.1:53:53/tcp -p 127.0.0.1:53:53/udp \
wasabimasq /usr/sbin/dnsmasq -d --all-servers

試す

$ dig @127.0.0.1 yahoo.co.jp +short
183.79.135.206
182.22.59.229

$ dig @127.0.0.1 s3.us-east-2.wasabisys.com +short 
38.73.225.22
38.73.225.20

/etc/hosts.conf の nameserver を nameserver 127.0.0.1 に書き換えれば名前解決できるようになる。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment