LoginSignup
17
20

More than 5 years have passed since last update.

DNS系備忘録

Posted at

/etc/resolv.confの仕様を調べる

man 5 resolver
man 5 resolv.conf

/etc/resolv.confは、編集しても上書かれることが多い

ubuntuでは、
http://qiita.com/uchiko/items/eb0665f528e2bb792f47
のように、/etc/network/interfacesで設定する。
macでは、システム環境設定で設定する。

getaddrinfoの優先順位設定

/etc/gai.conf
man 5 gai.conf

nsswitch.conf で名前解決の優先順位設定

/etc/nssitch.conf
hosts: files myhostname dns

のように設定
files : /etc/hostsの設定
myhostname : これいれとけば、/etc/hostsに自分のHostの名前いれなくていい
dns : /etc/resolv.confで設定したdnsに聞く

man nsswitch.confで仕様確認できる。

注意事項としては、nsswitch.confを変更しても、nslookupやhost、digの動作はかわらない(らしい)ということ。

これらのツールでデバッグするとハマる。

gethostbyname()やgetaddrinfo()の動作は、nsswitch.confで変わる。
しかし、nslookupやhost,digはこれらのAPI使わず直接DNS確認している模様。

/etc/host.conf

現在は、/etc/nsswich.confに置き換えられているらしいが、どちらが使われているかをどうやって調べればよいのかは不明。

AAAAレコードの確認

nslookup -type=AAAA www.kame.net
dig www.kame.net AAAA

その他参考文献

17
20
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
17
20