はじめに
Ubuntu20.04にて、DNS周りについてまとめ。
最終更新日
2022年8月30日
環境の情報
OS
Ubuntu20.04
注意
最新の状態を確認して下さい。
参考さまはこちら
https://manpages.ubuntu.com/manpages/trusty/ja/man5/resolv.conf.5.html
https://yo7612.com/2021/12/29/post-0-111/
https://www.freedesktop.org/software/systemd/man/systemd-resolved.service.html
https://man.archlinux.org/man/resolved.conf.5
https://wiki.archlinux.jp/index.php/Systemd-resolved
https://atmarkit.itmedia.co.jp/fnetwork/dnstips/010.html
https://takuya-1st.hatenablog.jp/entry/2022/03/10/155657
https://www.freedesktop.org/software/systemd/man/resolved.conf.html
https://www.freedesktop.org/software/systemd/man/systemd-resolved.service.html
https://manpages.debian.org/experimental/systemd/systemd-resolved.service.8.en.html
Ubuntuサーバー徹底入門
https://amzn.asia/d/eRJyUa1
調べたこと
DNSサーバー
名前解決する。
ホスト名とIPアドレスとを相互に変換する。
リゾルバ
resolver
プログラム。
ライブラリみたいなもの。
ドメイン名を元にIPアドレスの情報を検索したり、
IPアドレスからドメイン名の情報を検索する、名前の解決(name resolution)を行う。
a.comにアクセスすると、どんなことが起きるのか?
指定されたホスト名のipアドレスが知りたい。
↓
リゾルバに「名前解決してほしいよー」と言う。
↓
/etc/resolv.confに書かれている
DNSサーバーに聞く。
↓
各DNSサーバー(色々あるけど、ここでは割愛)と協力して、ipアドレスを見つける。
↓
リゾルバへ返す。
/etc/resolv.conf
ファイル。
名前解決(ホスト名からIPアドレスを調べること)の設定を行う。
resolv.confのnameserver
コンピュータが名前解決に使う。
DNSサーバのIPアドレスを書く。
resolv.confのoptions
レゾルバの内部の変数を変えられる。
resolv.confのedns0
DNSの拡張のサポートが有効になる。
RFC2671で規定されている。
systemd-resolved
DNSのリゾルバ(DNSのクライアント)を制御するための仕組み。
$ systemd-resolve --status
詳細な状況表示をが確認できる。
Global
LLMNR setting: no
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
Current DNS Server: 127.0.0.1
DNS Servers: 127.0.0.1
DNS Domain: home
net
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa
168.192.in-addr.arpa
17.172.in-addr.arpa
resolv.confに、nameserver 127.0.0.53が最初から、書かれている理由
「systemd-resolve」が「127.0.0.53」のTCP53番ポートで待ち受けているため。